live-share
live-share copied to clipboard
Running Python as guest results in incorrect file path
When connecting to myself in liveshare and running a python program, it does not run from the correct directory. When I run the file as the liveshare leader, the following command is executed: & "C:/Users/my_name/Anaconda3/python.exe" "c:/Users/my_name/source/repos/test.py" and the correct output is given. However, when running from liveshare connected to myself, the following command is executed: & "C:/Users/my_name/Anaconda3/python.exe" /test.py. Since there is no file at /test.py, I am given a generic python error that there is no file there. 'can't open file '/test.py': [Errno 2] No such file or directory'. However, when I manually type in the command generated by the host, the file is run properly.
Product and Version: VSC 1.45 OS Version: Windows 10 Live Share Extension Version: 1.0.2236 Target Platform or Language: Python
Steps to Reproduce / Scenario:
- Create a new folder and python file inside. Open the folder and liveshare it
- Attempt to run it from the shared machine with the run button
Thanks for your help, I'm a student trying to attend a virtual hackathon. log.zip
Hi Stanley,
Thanks for reporting this issue. Do you have launch configuration in .vscode/launch.json? If you do, can you please share the launch configuration you have there from your host machine?
When you launch from your guest machine, what launch configuration do you use?
My launch.json file is as follows on both the host and guest:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/test.py",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}"
}
]
}
I just realized the command run by the Guest is run in the Guest's local terminal, not in the shared terminal, resulting in an error. When the command & "C:/Users/my_name/Anaconda3/python.exe" /test.py is run from the shared terminal, the expected output is given. Thanks.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically in 2 days.