Category Archives: Python

Execute scripts from the Python interpreter

>>> execfile(‘myscript.py’) # Execute ‘myscript.py’

Posted in Python | Leave a comment

Change current working directory from inside the Python interpreter

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 ‘/’

Posted in Python | 3 Comments

easy_install for Python 2.6 on Windows XP

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 [...]

Posted in Python | Leave a comment