FontLab Forum
2012-05-23, 23:51:56 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the FontLab forum, read how to use it! Update: Archives from old MSN forums are now available on our forum.
 
   Home   Help Search Calendar Downloads Tags Login Register  
Del.icio.us Digg FURL FaceBook Stumble Upon Reddit SlashDot

Pages: [1]
  Print  
Author Topic: New script: runinfls.py to execute FontLab Python scripts from outside of FLS  (Read 902 times)
Adam Twardoch (FontLab)
Product and marketing manager, Fontlab Ltd.
Administrator
Hero Member
*****

Karma: +12/-4
Germany Germany

Posts: 329


FontLab Studio 5.0.4, Mac OS X 10.4.11


WWW
« on: 2011-09-13, 14:52:31 »

Attached is a Python script "runinfls.py" which can be used to execute another FontLab Python script from outside of FontLab Studio.

This runinfls.py script can be used from the commandline, where the script to be executed is given as argument (the filename or extension of the script does not matter). It can also be used as a module within other scripts. In such case, the Python code to be executed within FLS can be given as a file path, Python file object, or string.

The main advantage of the runinfls.py script is that:
1. It automatically locates the most recent version of FontLab Studio and executes the script within it.
2. It adds the missing __file__ functionality, i.e. when the script is running from a file, FontLab Studio "knows" its original location.

The latter functionality can potentially be useful when writing installation routines that should put some files inside of the FontLab data folders.

The script comes with a small example file. Unpack the attached runinfls-1.10.zip archive, and then:
To run it on Mac OS X, open Terminal, navigate to the unpacked contents (using "cd") and type:
Code:
python runinfls.py test.flpy
To run it on Windows, click on the Start button, type in "cmd" (or choose Run and type in "cmd"), navigate to the unpacked contents (using "cd") and type:
Code:
c:\python24\python runinfls.py test.flpy

The runinfls.py script is opensource under the MIT License.
Logged
Tags:
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!