Pat, I did look into the DIR-SEPARATOR (DIR_SEPARATOR on python?) constant. It did not appear to be documented anywhere in the gimp docs that I could find with a search engine. From an old scheme script I found posted I was able to find the following: The DIR-SEPARATOR constant appears to be just a "/" on platforms where the OS is Linux and "\" on platforms where the OS is Windows. The following is pasted from a Script-Fu Console and a Python-Fu Console (Linux). *** Script-Fu Console Welcome to TinyScheme Copyright (c) Dimitrios Souflis Script-Fu Console - Interactive Scheme Development > (string-append "Yaba" DIR-SEPARATOR "Daba" DIR-SEPARATOR "Doo") "Yaba/Daba/Doo" *** PYTHON CONSOLE GIMP 2.8.10 Python Console Python 2.7.5 (default, Feb 11 2014, 10:29:30) [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] >>> import os >>> print os.sep / >>> from gimpfu import * >>> print DIR_SEPARATOR Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'DIR_SEPARATOR' is not defined >>> print DIR-SEPARATOR Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'DIR' is not defined >>> if DIR_SEPARATOR == "/": ... print "YES" ... Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'DIR_SEPARATOR' is not defined >>> In python, os.sep does the same job that we would expect from what we see in the scheme example except it has the following advantages:
In the code I use python functions that take care of the separator. e.g. srcFile = os.path.join(srcPath, srcFile) Python sticks in the right separator for the host OS. From my point of view, it seems like using the DIR_SEPARATOR and manually concatenating strings would make the code clumsy. I did not see anywhere where knowing what the separator character was would be an advantage. I wanted to keep the focus of the tutorial on Automation and not get sidetracked too much on design and architecture. It is worth while to note that if you can design a block of code (like autoBase.py) that does not use the gimpfu library, you can run it on any python shell and use any debugging tools at your disposal. This is a real advantage over debugging in Gimp. So I view using a gimp constant instead of a python library function (os.sep) as kind of a mistake. Please let me know if I missed something. Stephen On 2/20/2014 1:03 PM, Pat David wrote:
-- Stephen Kiel 26602 Strafford Mission Viejo, CA 92692 Mobile/SMS (949) 702-1993 Home (949) 367-2915 snick.kiel@xxxxxxxxx http://stephenkiel.blogspot.com/ |
_______________________________________________ gimp-docs-list mailing list gimp-docs-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gimp-docs-list