Python3 project debugging in Netbeans 6.9.1 - netbeans

This should be quite a popular problem but neither Google nor stackoverlow search helped my with it.
I want to develop Python3 programs in Netbeans 6.9.1. But when I create project, toggle a breakpoint and press on the Debug button I see following output:
[LOG]PythonDebugger : overall Starting
[LOG]PythonDebugger.taskStarted : I am Starting a new Debugging Session ...
[LOG]This window is an interactive debugging context aware Python Shell
[LOG]where you can enter python console commands while debugging
>>> File "/home/proger/.netbeans/6.9/config/nbPython/debug/nbpythondebug/jpydaemon.py", line 219
print self.debuggerFName
^
SyntaxError: invalid syntax
Debug session Abort =1
>>>
And below the log window I see:
ERROR::Server Socket listen for debuggee has timed out(more than 20 seconds wait) java.net.SocketTimeoutException: Accept timed out
So if I understand it right Netbeans tries to debug Python3 code with Jython2.something debugger. Is there a way to attach right debugger?

I met the same problem when using NetBeans. I solved this problem by editing the jpydaemon.py
change the code about 219 line
print self.debuggerFName
==>
print(self.debuggerFName)
Restart NetBeans, and it works.

I don't know how Netbeans work, but from the error message it looks like the Python 3 interpreter gets fed Python 2 code. I would venture that Netbeans hooks a debug server into Python via a breakpoint hook, so when a breakpoint is reached it starts a debugging server that the netbeans IDE then tries to talk to.
This debugserver (jpydaemon.py) evidently has not been ported to Python 3, at least not in your version.
I doubt anything is being executed by Jython. The code in this case seems to be written for Jython as it's called jpydaemon.py, and in any case Jython doesn't support the Python 3 syntax yet, so if you are trying to develop Python 3 code and run it with Jython you are likely to fail quite miserably. :-)
Update: after looking at jpydaemon.py I conclude that I guessed exactly correctly. jpydaemon contains the debugger serveice, which is hooked into the debugging hooks via sys.settrace(). So the problem you are having is quite simple: jpydaemon.py is not ported to Python 3 yet, so you can't use Netbeans internal debugger to debug Python 3 code.

Related

Elixir: VS Code ExUnit cannot find Mix

I cannot load or run my tests, from within VS Code.
I'm a new user to Elixir, and to VS Code. I'm running Lubuntu 21.10 (Impish). I've downloaded Erlang/OTP 25 (.deb), and Elixir 1.14 (precompiled binary in /usr/share/elixir), and can get anything I need running in a Bash terminal. Again, in a standard QTerminal window,
erl, iex, mix, elixir, etc. all work fine.
In VS Code, however, I get some errors. I feel stupid, but I'm coming from Sublime Text, so please forgive me.
In the left pane of VS Code, ExUnit shows an error (red):
Clicking on this error gives me this, on the bottom right pane. The command line options, passed to mix test, seem to be the default configuration:
This result is bizarre to me, because I can open the integrated terminal, execute /bin/sh, and then run the exact mix test line that's displayed:
/usr/share/elixir/bin has been added to my PATH variable, in ~/.bashrc, ~/.profile, and /etc/environment.
However, I am further confused by all tests being excluded, and wonder if there's some connection to the core issue:
Note that I can run my tests just fine, using different command line options. I've tried adding tags, but that didn't fix the problem.
I tried Google'ing this, and played around with my settings. Here is what I have configured in the "User" settings.json, and I made sure nothing overrides this in "Workspace" settings:
Changing the useNativeTesting setting doesn't solve the problem.
On another (?) note, I get a "failed to run elixir" upon VS Code startup:
Again, I have no problem running commands from a Linux terminal, or from a terminal within VS Code.
Plot twist: If I remove the precompiled Elixir 1.14, and downgrade to an older version, via apt, the problem goes away. But Lubuntu 21.10 doesn't offer Elixir 1.14, and I'm really into using the new dbg() feature.
But for now, I cannot load or run my tests, from within VS Code, apparently because Mix cannot be found.
Thanks to Daniel Imms, from the VS Code team, for answering my question on Twitter:
"Try moving where ever you init mix and elixir (.bashrc?) into your .bash_profile and then logging out and in again or restarting. I'm guessing it's in your bashrc which doesn't run in non-interactive sessions like in tasks."

Visual Studio Code with XDebug Getting Stuck

I'm using XDebug with Visual Studio Code on Windows 10 to debug PHP.
The debugger works but from time to time it's getting stuck (hits the breakpoint but doesn't respond to step in, step over commands).
I tried switching to XDebug nts version (Not Thread Safe) but it doesn't help. Restarting the web server (Apache) doesn't resolve it either. Sometimes computer restart helps but not always...
Any solution or workaround? (Even a command line that frees this deadlock)
Having out of context debug expressions in the watch window causing the debugger to get stuck.You should clear the watch window from expressions.I guess the evaluation of out of context expressions make the debugger to get stuck.

Eclipse PyDev - Python stops when trying to run in debug mode

After upgrading to Python 3.6, Eclipse debug mode stopped working properly. It renders an error like this:
The strangest thing is that this issue does not raise in 100% of cases. Sometimes it goes away. And then again arises. I am lost trying to figure out why.
Although it happens when you're running the PyDev debugger, the debugger is probably only exercising some path in your code which has a bug and is usually not exercised (and thus leads to such an error).
In this case, attach a c/c++ debugger to the program to find the culprit (you can use the attach to after that error is hit)... On Windows you can use Visual C++ and on Linux GDB.
-- as a note, the issue is probably on some c/c++ library you're using (but given the info, it's really hard to pinpoint anything).

pydev remote debugging blocks when running to completion

I'm following these instructions to remotely debug a python script http://pydev.org/manual_adv_remote_debugger.html
Using breakpoints and stepping work without a problem, but after resuming the script (without any other further breakpoints) the script executes the remaining instructions, and then hangs instead of exiting normally. Even closing the server from pydev does not help, I have to Ctrl+Break the script
I am sure I've done this a while ago with an older eclipse+pydev, and the script resumed and exited normally (and it's very important for me not to mess the rest of the execution).
I've tried this with both Eclipse Luna and Liclipse pydev_4.0.0.201504132356, pydev_4.0.0.201504092214 on Windows 7 x64, same behaviour
Is this an intended behavior or a bug? How could I make pydev let the script end normally?
I can't reproduce this here... please report that as a bug adding details on how to reproduce it (i.e.: ideally, create a project on github and add a step-by-step on how to reproduce it so that it can be fixed... without being able to reproduce it properly, it may be pretty hard to fix).
Also, please give details on the OS and Python version used in the report (https://sw-brainwy.rhcloud.com/tracker/PyDev/)

Command line console for Unity 3d C#

Is there a command line console that I can try and execute lines of code in Unity?
Something like the Chrome console for javascript, or running python on the command line?
I am on windows 8.
I saw the immediate window in MonoDevelop, but it didn't seem to work without a debug session, and when I was debugging it said it wouldn't run when the application was running:
> this
The expression can't be evaluated while the application is running.
> this
Debug session not started.
It probably wanted to be at a breakpoint, which was not obvious to get working and kept crashing when I tried various ideas. I would rather just use the console independently from debugging - just to experiment with syntax etc.
What is the easiest way to bring up a console for executing lines of C# unity code?