I used pyglet for the first time for my entry in the latest PyWeek. I found 
it excellent and very easy to use!

... expect that I created a platform dependent bug because of the way 
"resource.path" tries to prevent platform dependent issues! I used 
os.pah.join to add subfolders to the path, ie

resource.path = [os.path.join('data', 'stuff')]
resource.reindex()

This worked fine on OSX and Linux and then failed for Windows users. The 
documentation in the resource.py file makes it obvious you should just 
hard-code the forward slashes. The web documentation doesn't point this out 
and just implies this by using hard-coding in the example.

I have a lot of experience in cross-platform development so hard-coding 
slashes feels so wrong that you would have to put a giant flashing red bulb 
to make me notice that it is the right thing to do!

So my suggestion is to either,

- put a giant flashing red bulb in the web documentation to reinforce that 
you should not use os.path.join (I suggest being explicit about not using 
it, eg "*DO NOT USE os.path.join - forward slashes are used on all 
platforms"*
*
*
- alternatively consider adding an interface to adjust the path that 
includes an addSubFolder method which takes a list of folders and joins 
them in the background (eg, resource.add_sub_folder('data', 'stuff')) and 
then document this as the preferred approach for adjusting the path.

The later I think is better. I understand you are trying to avoid 
inexperienced programmer errors but in a way you are training them that it 
is OK to hard code slashes and, in the process, tripping up experienced 
programmers who are too lazy to read the docs (like me ;)


Paul


-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to