Did you investigate whether there was a relation between the file/panel from where you opened SublimeREPL: Python and the output of print os.getcwd()
? SublimeREPL initializes its cwd at its startup of the REPL. The cwd will stay for the entire lifetime of the REPL.
As you pointed out, the default cwd for SublimeREPL: Python is:
"cwd": "$file_path"
This means that starting SublimeREPL: Python with your cursor in a blank Sublime panel, results in /opt/sublime_text/
as the cwd. This could be considered undesired and confusing.
However, if you start SublimeREPL: Python while your cursor is in the .py file that you want to run, the REPL will use the folder of your current .py file as its cwd.
Personally I think this is the desired behaviour, but you have to know it before it becomes convenient.
If you change the settings for the cwd to:
"cwd": "$folder",
the above behaviour of the stays unchanged for cases where you're not using sublime-projects. When you do use a sublime-project, the python REPL cwd will be the main project folder, independent of the cursor location at REPL startup. This might be the desired behaviour if you have a python-driven project. However, if you are just using some python scripts in a bigger project, you probably don't want your main project folder to be the cwd in the python REPL.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…