1- #!/usr/bin/python
1+ #!/usr/bin/env python
22
33import os
44import sys
2727
2828try :
2929 from defcon import Font
30- except :
31- print "ERROR: This script requires defcon. It can be downloaded from https://github.com/typesupply/defcon"
30+ except ImportError :
31+ print (
32+ "ERROR: This script requires defcon. "
33+ "It can be downloaded from https://github.com/typesupply/defcon" )
3234 libraryNotFound = True
3335try :
3436 import WriteFeaturesMarkFDK
35- except :
36- print "ERROR: This script requires WriteFeaturesMarkFDK.py. It can be downloaded from https://github.com/adobe-type-tools/python-modules"
37+ except ImportError :
38+ print (
39+ "ERROR: This script requires WriteFeaturesMarkFDK.py. "
40+ "It can be downloaded from "
41+ "https://github.com/adobe-type-tools/python-modules" )
3742 libraryNotFound = True
3843
3944if libraryNotFound :
@@ -49,8 +54,8 @@ def generateMarkFiles(font):
4954 ufoFont = Font (fontFileName )
5055 styleName = ufoFont .info .styleName
5156
52- print '*******************************'
53- print 'Exporting mark files for %s...' % (styleName )
57+ print ( '*******************************' )
58+ print ( 'Exporting mark files for %s...' % (styleName ) )
5459
5560 WriteFeaturesMarkFDK .MarkDataClass (
5661 ufoFont , folderPath , trimCasingTags ,
@@ -68,7 +73,7 @@ def run():
6873
6974 # make sure the path is valid
7075 if not os .path .isdir (baseFolderPath ):
71- print 'Invalid directory.'
76+ print ( 'Invalid directory.' )
7277 return
7378
7479 # if a path is not provided, use the current directory
@@ -78,13 +83,13 @@ def run():
7883 t1 = time .time ()
7984
8085 fontPath = os .path .abspath (sys .argv [- 1 ])
81- print fontPath
86+ print ( fontPath )
8287
8388 if os .path .exists (fontPath ) and fontPath .lower ().endswith ('.ufo' ):
8489 generateMarkFiles (fontPath )
8590
8691 else :
87- print "No fonts found"
92+ print ( "No fonts found" )
8893 return
8994
9095 t2 = time .time ()
0 commit comments