Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I recently downlaoded a game on pydev.org. The code below is the code that you run for the game to play. My question is does the likes of os.path.dirname(__file__) mean? I have created games in python before but i always made them in the one class. Where as in this game this is outside of the folder where all the other classes are?

Can any1 help me. I have researched this but to no luck!

import sys
import os


try:
    __file__
except NameError:
    pass
else:
    libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
    sys.path.insert(0, libdir)

sys.path.insert(1, "lib")
import main
main.main()
share|improve this question
1  
Please try to give meaningful titles to your questions... – Lohoris Feb 1 '12 at 14:53
1  
Additionally, I think your research techniques need some work, as the first Google results of "python __file__" and "python os.path.dirname" return relevant pages describing each. – Josh Petrie Feb 1 '12 at 16:07

closed as off topic by Josh Petrie, Tetrad Feb 1 '12 at 16:53

Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Tried looking at the documentation?

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.