I use the RemoteFS extension in VSCode to connect to my remote SSH server. When I open a .py file on the remote server in VSCode, and then add #%% comment to the .py file, I don't get the option to run a Jupyter cell like I would locally.
Has anybody gotten VSCode's Python extension working with it's built-in Jupyter support and the RemoteFS extension?
We had an overly restrictive file check for when we allowed our "Run Cell" commands to show up and it was limiting it to local files only. I've fixed that issue in the following PR here:
https://github.com/Microsoft/vscode-python/pull/4191
I verified that I was seeing the cell commands using Remote FS after that. Sadly this just missed the cutoff for our recent January release, so it won't show up in the extension until later in February. If you want to check out the fix you can access our daily development build here:
https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING.md#development-build
That build has the fix already, but it's not the full public release.
Related
I was trying to debug a modified python script for The Sims 4, running the mod's code in the game context and trying to access the variables using the pydevd-pycharm package and a python debug server, both provided by PyCharm Pro. Although I followed the necessary instructions and settings (described below), I was still unable to successfully debug.
The method I used to perform the debug attempt is as follows:
Inside the PyCharm Pro installation files (version 2022.3.2), I took a copy of the file “pydevd-pycharm.egg” and changed the extension of that file to “.zip” so that I could edit it;
Inside the python installation files (version 3.7.0), I made a copy of the “ctypes” directory and inserted it inside the “pydevd-pycharm.zip” file created in the previous step; this “.zip” file was inserted into the Mods directory, like any other mod;
I configured a python debug server in Pycharm Pro and created a command for The Sims 4 that contained the code to connect to the debug server. The command was as follows:
import sims4.commands
#sims4.commands.Command('start.debug', command_type=sims4.commands.CommandType.Live)
def startdebugging(_conection=None):
import pydevd_pycharm
pydevd_pycharm.settrace('localhost', port=5678, stdoutToServer=True, stderrToServer=True)
I also inserted the command as any mod in the Mods directory and started the python debug server (which was waiting for a connection); I minimized PyCharm Pro and started the game; already inside the game, I started the command start.debug; if everything had gone well, I would be debugging the mod script now.
(If you want to know more about the method I used, the tutorial link is: https://youtu.be/RBnS8m0174U)
In conclusion, i want to know why the method I ran ended up not working and, if possible, suggestions on how I can modify the debug method so that it finally works.
I’m using VScode to develop a Django web application on the next environment:
• OS and Version: Windows 10
• VS Code Version: 1.52.2
• Python Extension Version: v2021.5.842923320
• Remote – SSH Version: v0.65.4
From my Windows laptop, I work on an Ubuntu 20.04 VM using the Remote – SSH plugin, So I have configured a python3.9 virtual environment with Django3.2 and others python packages. Also, I have pylint installed and all works as expected.
The issue arises when I mount a folder inside the application media folder (inside the workspace) from another station through sshfs. What happens is that autocomplete stops working and when y press Clr+Space I just get a loading message.
Note that this folder that I mount through sshfs is very big more than 1 TB with many files including python scripts and also I note that even when I close the VScode I cannot unmount this folder because the fusermount said that the folder is used by some process (I guess is the VScode process inside the VM). After all, if I don’t open the VScode I'm able to mount and unmount this folder without a problem.
I have also excluded this media folder using the "files.exclude" and "files.watcherExclude" but the issue persists.
There is someone who has had this issue before or some similar problem. I would appreciate any suggestions.
[Update]
Even using files.exclude, serach.exclude or not, the Intellisence works fine for a while if I mount the folder after open VScode. But if I close and reopen the Vscode the intellisence stops work. The same issue if I mount the folder before open the VScode.
[Update2]
Python language sever OUTPUT panel
Best Regards.
creating a "pyrightconfig.json" at the root of the workspace, and adding the exclude solve the issue https://github.com/microsoft/pyright/blob/main/docs/configuration.md#main-pyright-config-options
{"exclude": ["**/application/media"]}
You should take search.exclude instead of files.exclude.
// Configure glob patterns for excluding files and folders in fulltext searches and quick open. Inherits all glob patterns from the `files.exclude` setting.
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
// Configure glob patterns for excluding files and folders. For example, the file Explorer decides which files and folders to show or hide based on this setting. Refer to the `search.exclude` setting to define search specific excludes.
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
},
The official docs
Update:
Which Language Server are you using? Pylance?, Jedi?. Could you try to switch the Language Server?
And could you have a look at these panles?
Update2:
Can you try to upgrade the Python extension? And if it doesn't work, can you try to downgrade the node version to 12? You can refer to this page.
I found the configuration for cpp (https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Debugger/gdb/Windows%20Subsystem%20for%20Linux.md) and tried to change it for python debugging but it doesn't work. Any suggestion to make it work?
It should be mentioned that the Python extension for VS Code does not officially support WSL yet, but the enhancement request has been made and we do plan on supporting it.
Beyond extensions installations, IDE_PROJECT_ROOTS environment variable also may affect the debugger. For usual WSL standalone python code debugging, making sure this variable is not set (or set to the location of the files) when the VS code is opened helps.
For "step into" debugging of jupyter notebook having the python files path(s) as a part of IDE_PROJECT_ROOTS (for example export IDE_PROJECT_ROOTS="/tmp:/foo_pythonfilespath" set in .bashrc) will help to carry out "step into" python-code debugging in VSCode.
This is now supported and just requires installing the Microsoft Python extension and then to quote the documentation on remote debugging with WSL:
Once you've opened a folder in WSL, you can use VS Code's debugger in
the same way you would when running the application locally. For
example, if you select a launch configuration in launch.json and start
debugging (F5), the application will start on remote host and attach
the debugger to it.
See the debugging documentation for details on configuring VS Code's
debugging features in .vscode/launch.json
I am following a very simple tutorial for google app engine and at a point, after having installed Google sdk for python, it is asked to deploy the hello world app using the command from windows CMD:
>dev_appserver.py helloworld
My problem is: when I type this command, my Pycharm automatically pop up and open a tmp folder containing dev_appserver.py, as if I wanted to edit the file. I think that, when pycharm is installed, it forces a redirection of every command of the form >test.py to open the corresponding file in pycharm instead of executing the command.
What can I do to get rid of this?
Fixing the file association problem means removing the .py file association (likely created at pycharm's installation), which depends on your Windows version.
This official suggestion can be applied to several Windows versions.
For alternate solution search for "file association remove delete" and your Windows version, plenty of advice out there.
Note: after removing the association you'll need to manually select the application to use when you actually want to edit a .py file (which is not a big deal for one which typically opens the files from pycharm project windows).
I have a Python interpreter that runs on a CE device and is a C application. Currently the device comes configure with a root '\' folder and a '\Application' folder. If I install and run python on the '\' drive everything is fine, but if I try to put it on the '\Application' drive it will not run.
In digging further, the problem is with the CreateFileW call. When trying to access '\PythonLib' I get a normal error code of 80 saying the file exists, when I try to access '\Application\PythonLib' I get an error code of 5, or Access is Denied.
Has anyone had any experience with this? Any C++ app we develop in Visual Studio 2008 and run on the device has no problem accessing '\Application', but anything we try with Python can not seem to resolve that path.
I found that the problem was the attributes on the CreateFile calls. For some reason on our device the '\' directory needs different attributes then the '\Application\' folder. mainly I needed to add the FILE_FLAG_BACKUP_SEMANTICS bit to the FlagAndAttributes field.