error with relative paths in MakeOTF.py

38 views
Skip to first unread message

Cosimo Lupo

unread,
Sep 19, 2014, 7:04:23 AM9/19/14
to uafd...@googlegroups.com
Hello,

I'm running the latest AFDKO on a Windows machine. 
When I use relative paths for specifying the location of the outputFile in the current.fpr project file (e.g. "OutputFontPath    ..\TestFont-Regular.ttf"), MakeOTF.py raises a WindowsError exception:

Traceback (most recent call last):
  File "C:\Users\simoneless\Documents\bin\FDK\Tools\SharedData\FDKScripts\MakeOTF.py", line 2428, in <module>
    main()
  File "C:\Users\simoneless\Documents\bin\FDK\Tools\SharedData\FDKScripts\MakeOTF.py", line 2423, in main
    runMakeOTF(makeOTFParams)
  File "C:\Users\simoneless\Documents\bin\FDK\Tools\SharedData\FDKScripts\MakeOTF.py", line 2318, in runMakeOTF
    copyTTFGlyphTables(inputFilePath, tempOutPath, outputPath)
  File "C:\Users\simoneless\Documents\bin\FDK\Tools\SharedData\FDKScripts\MakeOTF.py", line 1789, in copyTTFGlyphTables
    fixPost(glyphList, inputFilePath, outputPath) # This has the side-effect of
creating outputPath if it doesn't yet exist.
  File "C:\Users\simoneless\Documents\bin\FDK\Tools\SharedData\FDKScripts\MakeOTF.py", line 1903, in fixPost
    os.rename(newTTFName, outputPath)
WindowsError: [Error 2] The system cannot find the file specified

The reason is simply because the makeRelativePath() function is returning a path for outputFilePath which contains a UNIX forward slash "/", instead of the required Windows backslash "\\":
To fix this, one needs to request the OS-specific path separator from the Python os module, using os.path.sep, and use that instead of the forward slash:

So, the lines 2075 and 2086:

    relDir = "../"*numDir

should be replaced with something like:

    relDir = (".."+os.path.sep)*numDir

All best,

Cosimo


PS: It would be nice if the AFDKO source code were hosted on Github or SourceForge, where others could help to spot and fix similar issues.

Cosimo Lupo

unread,
Sep 19, 2014, 11:36:29 AM9/19/14
to uafd...@googlegroups.com
Oops, I didn't realise the AFDKO is already on Github:


That's good news! 
Thanks for making it available. 

C.

Read Roberts

unread,
Sep 19, 2014, 12:00:50 PM9/19/14
to uafd...@googlegroups.com
Yes, your e-mail was very timely – I was actually in the process of updating the FDK web site!

- Read


--
You received this message because you are subscribed to the Google Groups "UAFDKOML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uafdkoml+u...@googlegroups.com.
To post to this group, send email to uafd...@googlegroups.com.
Visit this group at http://groups.google.com/group/uafdkoml.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages