>>> execfile(‘myscript.py’) # Execute ‘myscript.py’
-
Pages
-
Categories
-
Archives
>>> execfile(‘myscript.py’) # Execute ‘myscript.py’
This is comes in very handy when working in the Python interpreter:
>>> import os
>>> os.getcwd() # Returns the current working directory; usually the directory you were in when you started the interpreter
>>> os.chdir(‘/path/to/directory’) # Change the current working directory to ‘path/to/directory’. Also accepts bash commands like ‘..’ and ‘/’
Sometimes I am forced to use windows, and for some reason (although I can’t blame anyone not giving a crap) there is no easy_install for Python 2.6 on Windows. So I followed these instructions from monkut on the Stack Overflow forum:
For installing setuptools for 2.6 download “ez_setup.py” from:
http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06
And run it [In the terminal, navigate to [...]