[IPython-User] Automatically change to specific directory on start up?

reckoner reckoner@gmail....
Wed Aug 3 10:24:48 CDT 2011


Thanks. It works! For Windows users, you can use the win32api module to 
compress the pathname, especially useful if it has spaces in it:

>>> import win32api
>>> win32api.GetShortPathName ('C:\Documents and Settings')
'C:\\DOCUME~1'

Thanks again.


On 8/3/2011 7:05 AM, Thomas Kluyver wrote:
> On 3 August 2011 15:00, Julian Taylor <jtaylor.debian@googlemail.com
> <mailto:jtaylor.debian@googlemail.com>> wrote:
>
>
>     cd is a ipython magic, so this should work:
>     c.InteractiveShellApp.exec_lines = ['get_ipython().magic("cd /path")']
>
>
> exec_lines is translated before it's run, though, so IPython magics
> should work. The problem might be with path characters on Windows:
>
> http://ipython.org/ipython-doc/stable/interactive/reference.html#caution-for-windows-users
>
> Thomas


More information about the IPython-User mailing list