Python extension - Debug adapter process has terminated unexpectedly - python-3.x

After installing the Python extension, I find myself not being able to debug. When I select any of the default launch configurations and press the green arrow to start debugging, it notifies me with the error message in the title. I am not using any external modules, I am simply trying to run a single line hello world program and this error still appears. I have tried reinstalling the extension, deleting the .vscode folder and checking the path of my Python interpreter.

I had the same problem, it was gone after I delete c:\users\username\ .code and reinstall vscode. hope that helps.
Lidong

Related

Unable to run Python files in terminal of VSC

i have installed VSC and set up the necessary dependencies for python.
Using a simple hello world example, i can run the file using run and debug option.
I can also run it by manually typing python hello.py in the terminal.
However, when i use the run button (top right hand corner), i get an error.
Can i check how to solve this?
Thank you.

execute to exe. successful by pyinstaller, but the exe. is not work. How can I debug it

It's work on Spyder (Anaconda3) and execute script to exe by pyinstaller without any errors, but nothing happens when I double click exe (also try cx_freeze, but still not work either).
How can I debug it? Appreciate for your help.
import os,shutil
cur_path=os.path.dirname(__file__)
sample_tree=os.walk(cur_path)
for dirname,subdir,files in sample_tree:
allfiles=[]
basename=os.path.basename(dirname)
for file in files:
ext=file.split('.')[-1]
if ext=="csv":#讀取.csv to allfiles
allfiles.append(file)
elif ext=='log':#讀取.log to allfiles
allfiles.append(file)
for file in allfiles:#Copy csv and log of sample_tree to destfolder
destfile = cur_path
srcfile=dirname + "/" + file
shutil.move(srcfile,destfile)
p.s. python 3.6/pyinstaller 3.3/Win 10
Debugging is s simple enough process.
In cx_Freeze you can find any errors by doing the following:
Before building ensure your script works correctly.
When building from a setup script see If any errors or warnings appear while it turns into an application. Do not worry if you get warnings you get these even when the application works correctly just ensure you know about them since they may give you a clue why it is not working.
When you application has been built it run it from command line. This final step will show up any errors.
Next you need to configure you setup script accordingly and recompile it and finally run through the process again to see if you have fixed the problem.
For Pyinstaller follow the same process.
In both modules the best debugging method is to run it from command line.
You can check your application by opening a new terminal window where the application is located and running it
For Linux and CMD (Windows):
yourappname
and for PowerShell:
./yourappname

Spyder external system terminal does not work (Python3.6)

I am not sure if this is a right place to ask this type of questions. I am a python beginner or programmer overall at this point. I am using Spyder to use python 3.6 (via Anaconda). I wrote a code that works fine when I run it in the current Ipython console. But I really need to run it in an external system terminal. In order to do so, I chose the following path: Run-> configuration per file -> execute in an external system terminal. That has been working fine. But now it refuses to work!
I validated that there is nothing wrong with my code by running something simple and saw that running via external system terminal does not work.
So far I deleted Anaconda and re-installed it. Could someone suggest what I should be looking for to diagnose the problem and fix it?
Thanks!
I had the same problem and noticed that unless the Working directory settings is set to "The directory of the file being executed", it won't work.
You can change it in "Run" > "Run configuration per file".

Pycharm tensorflow ImportError but works fine with Terminal

I made a virtualenv with tensorflow installed and I changed Python interpreter set to the location where the virtualenv is located at. When I ran the program, it gives the error:
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
I have the following lines written in my .bashrc file
export CUDA_HOME=/usr/local/cuda-8.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
export PATH=${CUDA_HOME}/bin:${PATH}
Also, I found the libcudnn.so.5 file in the following path:
/usr/local/cuda-8.0/lib64
I encountered this error before I opened PyCharm and I did manage to install the correct cudnn version. The problem is, I can use
$ source [virtualenv_path]
to active the virtualenv and run python in terminal and everything works fine, no errors shown. The program also runs without error in Pycharm's terminal but it just gives me the above error whenever I click the run button. Could there still be something wrong with the environment variable? How do I fix it?
Unfortunately in pycharm you have to set CUDA_HOME and LD_LIBRARY_PATH inside the IDE. To do that go to the Run menu->edit configurations then choose your project. Then you click on the Environment Variables and add an entry for CUDA_HOME and LD_LIBRARY_PATH. When you have done that you can run directly from inside pycharm. I would also recommend setting the defaults to have these paths as well, so you don't have to do this for every project. Also it wouldn't hurt to make sure you have the interpreter from source [virtualenv_path] set while you are on this setting page. Let me know if you have trouble finding where to do this.
I've read this other Stackoverflow post: Pycharm environment different than command line, and it seems that the problem is that openning PyCharm in the normal way won't preserve the bash environment. The solution is to open PyCharm from the command line and everything works now. All you need to do is to open PyCharm using charm and everything works fine now.
I have searched a lot, but I didn't find the right solution for this question anywhere. I found the solution with my friends and I would like to share with you also.
If your Tensorflow works in terminal properly but doesn't work in Pycharm you have two solutions:
1- Open Pycharm from Terminal. For me:
pycharm-community
2- If you are using Unity, you need to edit .profile, because Pycharm doesn't preserve .bashrc: So, open a terminal and type:
gedit .profile
Then, add the following codes at the end of the opened file:
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Save and exit. Now, you can work with Tensorflow in Pycharm without the necessity of opening the Pycharm form terminal.

cx_freeze executable runs from cmd but not on click

After dealing with all .egg issues with cx_freeze, I'm having issues running the .exe on click or from .bat. If I run the .exe from cmd, it runs perfectly. But if I click on the .exe, I get a popup list of errors that goes off the page.
I've tried changing the base=None and base=Win32GUI to no avail.
I'm running python 3.4 from and Anaconda environment. The errors make it look like on running, the .exe is looking in the normal python path, but there are references the the correct python path as well.
Any experiences with this?
Error from clicking. This goes off the screen so I can't see the final error:
error

Resources