Sublime Forum

Directory error in Python build system

#1

Hello everyone, I have an issue on building a python program.

My program “rename.py” is saved in directory /Users/wang/Desktop/IH_1910_$5_html. I build it in Sublime with original Python build system and I get the path error as posted. And I find out the problem is that Sublime does not put “” in front of “$” when it execute python -u “Directory”.
Then I run the program successfully by running following code in Terminal.

python -u “/Users/wang/Desktop/IH_1910_$5_html/rename.py”

Can someone fix it?

Here’s my python program:

import os
for fn in os.listdir("."):
print(fn)

Here’s the error code in Sublime:

python: can’t open file ‘/Users/wang/Desktop/IH_1910__html/rename.py’: [Errno 2] No such file or directory
[Finished in 0.4s with exit code 2]
[shell_cmd: python -u “/Users/wang/Desktop/IH_1910_$5_html/rename.py”]
[dir: /Users/wang/Desktop/IH_1910_$5_html]
[path: /Users/wang/.rvm/gems/ruby-2.4.2/bin:/Users/wang/.rvm/gems/ruby-2.4.2@global/bin:/Users/wang/.rvm/rubies/ruby-2.4.2/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Applications/exceltk:/Users/wang/.rvm/bin]

0 Likes

#2

ST sometimes has trouble with dollars in paths and filenames, due to the way it expands variables internally



0 Likes

#3

In this particular case, it looks more like an issue with shell expansion of variables due to the usage of shell_cmd.

0 Likes