views:

30

answers:

3

How can I open a Python interpreter at a specific network path in Windows?

In the Explorer address bar the path is in UNC form: \\myhost\myshare\....

I can't work out how to change to this directory from the Windows command line, nor in what format I could pass it as an argument to os.chdir.

I'm running Python 2.5 on Windows XP. IDLE is installed.

Thanks!

A: 

You need to map it as a drive.

Habbie
This works, thanks, though I think someone unfamiliar with this process might find your answer a little terse/cryptic :) Would you consider expanding it a little?
Ian Mackinnon
A: 

hope this helps : http://www.blog.pythonlibrary.org/2008/05/12/mapping-drives-on-windows/

EDIT :

for root, dirs, files in os.walk(r'\\myhost\myshare\'):
    print root, dirs
jknair
+1  A: 

Well, I'm going to ask it anyway because it has bit me before but have you tried something like this?

path = r'\myhost\myshare\some_file.dat'

The r being the important bit here. See this post as well: http://bytes.com/topic/python/answers/29322-unc-paths-file-object-open

raeb
Thanks! I was just thinking of the backslashes as benign path separators when of course they'll be treated as escapes. (Looks like your example is still missing an extra backslash at the start though)
Ian Mackinnon