dev_appserver works normal when run it. But if i try o debug, i found an error caused by
__file__
that is changed on jpydaemon.py. Has anyone successfully debugged apps on NetBeans?
Nope but I'm interested in setting this up. You have to attach the netbeans debugger to the port somehow. This may help you: here's an example I was reading about for java: http://blogs.oracle.com/leonfan/entry/netbeans_development_series_for_google
Quoted what I found pertinent to your question dynback
"How to debug application for Google App Engine
Since we already map 'test' action to 'debug', we should right click on project and choose 'test' to do debug'. When system is running and listenning on Java remote debug port 5005, attach debugger under menu 'Debug':"
You need to make sure the port in your debug settings is not in use.
I am assuming you have the python plugin in stalled for Netbeans.
Go to your settings and select python and then the Debugger tab.
The debugger port is set there.
Check your in use ports (In Windows open a command prompt and run the NetStat command)
If the port configured in the debugger tab is in use then select a port that is not in use and try again.
The default port appears to be 29100 but when I first installed the python plugin that was not the setting I saw there.
When I changed it back to the default which was not in use it worked.
I hope that helps.
Related
I am looking for a way to debug remote python script without any set up like in the answer here
I set remote interpreter, set up a debug configuration, click a debug button and got error Event not found:
ssh://myuser#my_ip:my_port/usr/local/bin/python -u /myuser/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support --client '0.0.0.0' --port 46994 --file /opt/my_work_dir/my_script.py
/: Event not found.
Seems like pyCharm takes care about all debug setting --multiproc --qt-support --client '0.0.0.0' --port 46994 but I have the wrong configuration.
Is there a way how to debug python script without putting pydevd.settrace('host', port=21000, stdoutToServer=True, stderrToServer=True) and other actions?
I was able to fix this problem by reinstalling PyCharm.
(# 1 and 5 are optional)
Export minimum settings you want to restore such as Keymap (File > Export Settings)
Uninstall your current PyCharm
Install new PyCharm
Launch new PyCharm and don't import your pre-existing setting at the first start up
Import your settings from the old PyCharm (File > Import Settings)
I guess this happens when some environment related settings are messed up.
Notice that you need to remember your settings for the remote interpreter as it will be gone when reinstalling.
I use vagrant quite often with pycharm and debugging has always worked great for me as long as i setup the interpreter to the one inside the vagrant box running.
If you go to settings->project->project interpreter and then setup a connection to your remote interpreter it will usually install the pycharm-debug.egg etc and you can debug run your project against this interpreter and set breakpoints in pycharm and it will break on those.
Here is their docs on setting this up https://www.jetbrains.com/help/pycharm/2016.1/configuring-remote-python-interpreters.html
I set up remote debugging as described under the section
Remote debug with a remote interpreter
(not the Server!!) and it works very well.
Here the link: https://www.jetbrains.com/help/pycharm/2016.1/remote-debugging.html
You just have to set up the remote interpreter (I used ssh) and then set up your run configurations. Let me know if you need further help.
Here is my run configuration in PyCharm:
It might be the same issue as this. Use bash as your login shell if you use another one like csh or tcsh.
The issue I'm facing right now:
I deploy Python code on a remote host via SSH
the scripts are passed some arguments and must be ran by a specific user
the PyCharm run/debug configuration that I create connects through SSH via a different user (can't connect with the user that actually runs the scripts)
I want to remote debug this code via PyCharm...I managed to do all configuration, I just get permission errors.
Are there any ways on how I can run/debug the scripts as a specific user (like sudo su - user)?
I've read about specifying some Python Interpeter options in PyCharm's remote/debug configuration, but didn't manage to get a working solution.
If you want an easy and more flexible way to get into the PyCharm debugger, rather than necessarily having a one-click "play" button in PyCharm, you can use the debug server functionality. I've used this in situations where running some Python code isn't as simple as running python ....
See the Remote debug with a Python Debug Server docs for more details, but here's a rough summary of how it works:
Upload & install remote debugging helper egg on your server (On OSX, these are found under /Applications/PyCharm.app/Contents/debug-eggs)
Setup remote debug server run configuration: click on the drop-down run configuration menu, select Edit configurations..., hit the + button, choose Python remote debug.
The details entered here (somewhat confusingly) tell the remote server running the Python script how to connect to your laptop's PyCharm instance.
set Local host name to your laptop's IP address
set port to any free port that you can use on your laptop (e.g. 8888)
Now follow the remaining instructions in that dialog box: copy-paste the import and pydevd.settrace(...) statements into your code, specifically where you want your code to "hit a breakpoint". This is basically the PyCharm equivalent of import pdb; pdb.set_trace(). Make sure the changed code is sync'ed to your server.
Hit the bug button (next to play; this starts the PyCharm debug server), and run your Python script just like you'd normally do, under whatever user, environment etc. When the breakpoint is hit, PyCharm should drop into debug mode.
I have this (finally) working with ssh RemoteForward open, like so:
ssh -R 5678:localhost:5678 user#<remotehost>
Then start the script in this ssh session. The python script host must connect to localhost:5678 and of course your local pycharm debugger must listen to 5678
(or whatever port you choose)
I have a remote interpreter set up in PyCharm.
Everytime I close and reopen PyCharm, the connection seems to be broken, and the process to "reopen" the connection doesn't feel efficient to me.
Before doing the following, it is not possible to run any script.
Here is what I usually do:
File -> Settings
Project -> Project Interpreter
Click on the gear icon on the right.
Choose "More"
With my remote interpreter selected, click on "Edit"
Change "SSH Credentials" for "Deployment Configuration" (all the info is already filled)
Click "ok" multiple times to close everything up.
At that point, I can run any scripts on the remote machine.
What is the best/fastest way to do this? (any way to "save the settings"?)
Check option "Visible only for this project" of deployment configuration. This error occurs when the check mark is set.
https://www.jetbrains.com/help/pycharm/2018.3/deployment-connection-tab.html
if this checkbox is selected in an SFTP configuration, you cannot use
its SSH credentials for configuring a remote interpreter.
This was a bug in version 4.0.2 of PyCharm and was corrected in version 4.0.3.
Edit: No longer true. I tried with another computer and having the most recent version doesn't fix the problem.
i meet the same error, file->settings checking your interpreter setting,
You don't set the 'host' and 'post',or your set but the content was clear. check again, and it truly work
I have a problem that I haven't been able to find an answer to.
I'm trying to debug a Python program running on a Raspberry Pi. The source code is located on my PC.
I set up an FTPS deployment and remote interpreter over ssh.
When I just run the app on the remote Raspberry Pi there are no problems.
The problem appears while I try to set up a breakpoint. In this case pydev writes:
>pydev debugger: warning: trying to add breakpoint to file that does not exist:
/home/pi/python/f:/python projects/server/server.py (will have no effect)
Pycharm thinks that the path to the app is the path on the remote computer + the path on the local computer.
Does anyone know what setting might be causing this and how to fix it?
From Run/Debug Configuration: Python section of PyCharm 3.4.0 Web Help:
Path mappings –
This field appears, if a remote interpreter has been
selected in the field Python interpreter. Click the browse button
to define the required mappings between the local and
remote paths. In the Edit Path Mappings dialog box, use add/delete
buttons to create new mappings, or delete the selected ones.
Configuring this option in your debug configuration should solve your problem.
Maybe it's obvious, but I was getting the same problem when using ~ instead of writing out the whole path of my home directory for the remote mapping.
I have just installed GAE launcher and am trying to run a sample application to make sure it works and I am getting the below error.
raise BindError('Unable to bind %s:%s' % self.bind_addr)
google.appengine.tools.devappserver2.wsgi_server.BindError: Unable to bind localhost:8000
2014-03-24 10:54:54 (Process exited with code 1)
I am trying to run the python version of the app with python 2.7 and am using windows 8.1 operating system. I did not create any files for the app, I just created a new application and am trying to run it in localhost.
Can someone please tell me what this error means and how to fix it?
The app server starts two servers: one for your application, the other for development console.
Change the ip address for the development console with:
dev_appserver.py --admin_port=9000
Another process is already bound to port 8000. Use netstat -an or netstat -anb or similar to investigate. It may be another instance of your development server.
Edit: If port 8000 is really occupied, Command-line arguments in the The Python Development Server says you can append --admin_port to change the 8000 to another free port.
For me, I have to use both --admin-port and --port
dev_appserver.py --admin_port=9000 --port=9999 app.yaml
I hope it might help others using PyCharm to understand where to set the admin port to something different than 8000.
Go to your "Run/Debug configurations" and in the configuration tab, add the following into "additional options":
--admin_port=9000