locked
Python and Paths: UNC vs mapped drives RRS feed

  • Question

  • Hi,

    I have read through the previous threads about some of the issues related to UNC paths, Python, etc.  This turning out to be a huge problem for us.  We are trying to enable an open source Python project (IPython: ipython.scipy.org) to work with the scheduler.  In particular we have a command line program that we want to use to submit parallel Python jobs for users (it is actually more complicated than that, but from the scheduler perspective, that is it).  I want to make sure I understand the issues related to paths...

    Are the following correct descriptions?

    * It looks like you have to use a UNC path for the working directory, rather than a mapped drive.

    * But, cmd.exe doesn't accept this so it defaults the working dir to C:\Windows.

    * But, the environment variables get set correctly (%CCP_WORKDIR%)

    * But muchof Python cannot handle UNC directories.  I am still trying to figure out what parts can and can't handle UNC paths, but this looks like this might be a huge issue for us.

    * It looks like the %PATH% environment variable is completely ignored when finding executables run by tasks.  This, in combination with the ban on mapped drives, means that if an executable is on a shared drive, you have to give its UNC path at the command line:  \\server\share\program.exe

    * Are drives simply never mapped on the compute nodes?  From my tests, it looks like sometimes they are.  For example, sometimes my python script can do os.chdir(r'z:\\documents') on a compute node.  Sometimes not.  Am I just asking for trouble here?

    * We need a robust UNC based method of finding a users home directory.  Currently we use %homedrive%%homepath%, but that gives us the mapped drive version.  It looks like %HOMESHARE% might have the information in UNC form, but are we always guaranteed that will give the UNC path to the home directory?  What if the home directory for a user is local (not shared) - what is %HOMESHARE% in that case?

    Cheers,

    Brian
    Sunday, November 8, 2009 1:02 AM

Answers

  • So I have made some progress with all of this.

    It seems like the things I was describing above are basically the case.  It seems that the golden rule for paths with the scheduler is to use UNC paths everywhere. 

    I have managed to get Python to handle these at the level I need them to, so even though all this is quite awkward, I can move forward.

    Cheers,

    Brian
    Sunday, November 8, 2009 10:31 PM

All replies

  • So I have made some progress with all of this.

    It seems like the things I was describing above are basically the case.  It seems that the golden rule for paths with the scheduler is to use UNC paths everywhere. 

    I have managed to get Python to handle these at the level I need them to, so even though all this is quite awkward, I can move forward.

    Cheers,

    Brian
    Sunday, November 8, 2009 10:31 PM
  • Brian,
    We always recommend using UNC Paths.  Drive mapping is not a per-user setting.  They may persist between some sessions and not others (I'm not exactly sure how it works).  If you can find a way to enforce them across sessions (it may be possible with Group Policy) go for it, but we recommend UNC Paths as the most reliable way to access shares.

    Thanks,
    Josh
    -Josh
    Monday, November 16, 2009 9:01 PM
    Moderator