Run python script from enthought canopy with an absolute path as an argument
Question: I would like to run a python script from enthought canopy v1.5.0.2717, either
in mac or windows, and provide a absolute file path as an argument using the
run configuration dialog.

In the run configuration I put an argument (for example):

    
    
    '/Users/dir/Data/University stuff/CQT/Data/ScriptRunFolder/testingPythonRfRamp.xml' 
    

The my script contains the following code:

    
    
    import sys
    print sys.argv[1]
    

I then click "run" and the printed string is:

    
    
    '/Users/dir/Data/University'
    

Another example is using the path:

    
    
    'C:\User\Program files\test.txt'
    

and it prints

    
    
    'C:UserProgram'
    

It looks like it splits the path at the spaces, and deletes the "\".

Running the script from the command line like:

    
    
    $python myScript.py '/Users/dir/Data/University stuff/CQT/Data/ScriptRunFolder/testingPythonRfRamp.xml'
    

Results in the correct printed string:

    
    
    '/Users/dir/Data/University stuff/CQT/Data/ScriptRunFolder/testingPythonRfRamp.xml'
    

How can I achieve the same result using Canopy?


Answer: The shell will group everything within double-quotes into a single parameter,
not single quotes.

    
    
    >type showme.py
    import sys
    print(sys.argv[1:])
    
    
    >python showme.py 'i am sad'
    ["'i", 'am', "sad'"]
    >python showme.py "i am happy"
    ['i am happy']
    

