atom-python-run
atom-python-run copied to clipboard
Seem to have a bug on directory name recognition
The error message is as follows when I press F5 to run a python file:
python /Users/spencer/.atom/packages/atom-python-run/lib/../cp/main.py --pause python /Users/spencer/PolyU/COMP5121/assignments/assignment 1/knn.py Error: Expected optional option argument: got "1/knn.py" instead
Is there something wrong with the space parsing of the directory string?
looks like it. can you post both console and cp log?
Sure thing. # console log: platform: darwin shell: osascript option: -e call: python script: /Users/spencer/.atom/packages/atom-python-run/lib/../cp/main.py command: tell app "Terminal" to do script " python /Users/spencer/PolyU/COMP5121/assignments/assignment 1/knn.py" /Users/spencer/.atom/packages/atom-python-run/lib/terminal.js:227 pause: true pipeFile: false pipePath: log: true args: python,/Users/spencer/PolyU/COMP5121/assignments/assignment 1/knn.py options: { "cwd": "/Users/spencer/PolyU/COMP5121/assignments/assignment 1", "detached": true } /Users/spencer/.atom/packages/atom-python-run/lib/terminal.js:239 stdout: tab 1 of window id 2148
/Users/spencer/.atom/packages/atom-python-run/lib/terminal.js:245 child process exited with code 0 # cp log: INFO: Platform: darwin INFO: Version Info: v0.2.0 DEBUG: Log Path: /Users/spencer/.atom/packages/atom-python-run/cp.log DEBUG: _ast: "['--pause', 'python', '/Users/spencer/PolyU/COMP5121/assignments/assignment', '1/knn.py']" DEBUG: Index: "0" Token: "--pause" DEBUG: Index: "1" Token: "python" DEBUG: Index: "2" Token: "/Users/spencer/PolyU/COMP5121/assignments/assignment" DEBUG: Index: "3" Token: "1/knn.py" ERROR: Error: Expected optional option argument: got "1/knn.py" instead
thats no good. ill check it out soon and issue a patch on my down time. this looks similar to issue #55 but is not the same. although, this does confirm that the {file} argument isnt handling spaces the way it should.
as a test, see if qouting {file} helps. i.e. python "{file}" and post console log and cp log results after qouting.
{file} should always be qouted to contain spaces found in file paths.
F5 Command
{file} = {dir}/{name}{ext}
python -i "{file}"
This feature, unfortunately, currently fails. Not exactly sure where, which has been there since v0.8.0.
Because this fails, paths containing spaces occassionally fail. Maybe you can have better luck.
Even if the {file} parameter contained spaces, the qoutes would contain those spaces and read {file} as a single arugment.
My fault, I use simply a String.split function to split them... I had planned to fix it in about v0.8.0's release, then I forgot it... I will fix it soon.
I'm having this same problem: can't open files in directories that have spaces in the names.