Closed Kee-Wang closed 7 years ago
True, that is why even windows cmd.exe
have working directory flag and execution argument flag. You can try enable Use exec cwd argument when launching terminal
, this works with some terminals.
Already tried but unfortunately it won't work for my terminal.
Actually, it's not on "terminal" level. It's on node.js exec
level. But, unfortunately, this does not work for most things. I have no ideas how to make it work. But, if you will have success on this in form of "run terminal with execution command in 'this' directory" from terminal, then this can be done in run-in-terminal too.
Fixed in #17
Hi. So that run-in-terminal can actually run the python script in the terminal. That's good.
But, there is a problem: I have no control of the working directory. That is
f=open('somefile.py')
will fail even if
somefile.py
is in the {working_directory} and even if it can be read successfully manually using terminal.Let me explain:
So currently it seems run-in-terminal first open the
terminal.app {working_directory}
and I got a terminal and in the {working_directory}. Then when it tries to run the python script. But it opens another terminal and starts to run .py {file_path}. That is how things went wrong.Since now it opens a new terminal without {working_directory} information, it simply goes to home 'cd ~' and then execute the python script using
./path/file.py
. No wonderf=open('somefile')
will fail!I knew this because I tried:
f=open('test','w') f.write('This is test message) f.close()
And it succeed. And guess what, I found this newly written file in the home directory 'cd ~'.