Python editor: current working directory behavior is unexpected
See original GitHub issueCreate the following setup:
- the file browser lists no files
- create a python script
script1.py
that produces a file./file1.txt
- run
script1.py
in the editor../file1.txt
is created in the same directory - create a subdirectory
dir2
- in
dir2
create a python scriptscript2.py
that produces a file./file2.txt
- run
script2.py
in the editor../file2.txt
is created in the parent directory
I do realize that when one runs python dir2/script2.py
in a terminal window, cwd
is .
. However, in JL I expected cwd
to be the directory where the Python script is located, since a drill down in the file browser should be semantically equivalent to a cd dir2
. The script name in the editor also lists script2.py
not dir2/script2.py
, which seems to imply that cwd
is the location of the script, not the base directory in the file browser.
Related issue: https://github.com/elyra-ai/elyra/issues/1045
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Issue 22834: Unexpected FileNotFoundError when current ...
getcwd() raises FileNotFoundError when CWD is no longer valid and that is in a fundamental part of importlib that isn't worrying about non- ......
Read more >Run Python file in Terminal with error "& was unexpected at ...
I was not able to reproduce the problem with the following steps: change my default terminal to "cmd.exe"; right-click in the .py file's...
Read more >os.chdir() caused unexpected behaviour with python ...
I'm new to multi-threading in Python. In my code, I called a function which changes its working directory with chdir() as follows.
Read more >Python Files and os.path - 2021 - BogoToBogo
The current working directory is a property that Python holds in memory at all times. There is always a current working directory, whether...
Read more >Getting unexpected indent error when executing python script ...
It might be that the code in _init_ has been indented with TAB characters while the code in addlightgroup() has been indented with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kevin-bates Makes sense, I can take a look at that.
Reassigning to try to get this to the 1.4 release