Anyone know how to debug Python using PDB in Windows XP?
My system has some deadlock. I want to use PDB to track my system.
My Config: VC 2005, Python2.7
I would recommend using the Winpdb GUI debugger, which works great on Windows (and other OSes too--the name is misleading) and can attach to processes after launch. There's a great tutorial that gets you all the basics, which has been enough for me every time I've needed it, at least. Good luck!
I think the following page will help you. It's pydev with Eclipse.
http://pydev.org/manual_adv_remote_debugger.html
Related
Is there a way to integrate standard Python documentation into Eclipse? So it will be possible to press F1 on an API function and get its description in the Help view of Eclipse.
I use PyDev.
Thanks.
I've had the same problem, so I kinda made an Eclipse plugin for that purpose.
Or download from Sourceforge
PyDev, nor Eclipse, does not provide integrated on-line help for the Python documentation. Unlike with Java, Python API source code documenting has several competing documentation standards and implementing support for them would be difficult.
However if the function under the cursor can be resolved its docstring is shown in a pop-up note.
http://www.python.org/dev/peps/pep-0257/
Also because Python is dynamic language, as opposite to static languages like Java, you rarely can resolve functions to their source in code development time.
Using Python console debugger you can use the help() command when the application is being run
>>> help(obj.myfuction)
None that I know of, but that would be very useful in pydev. You should suggest it in the eclipse pydev forum ,or code it yourself! If I was still a CS student I'd help..
Zeal - https://zealdocs.org/
Although I do not see how to integrate it in Eclipse, it is pretty useful next to it on your desktop. And it is not only Python docs, but may more. A real life saving stuff this Zeal docs!
Just a footnote: I do not use Eclipse that much as I switched to PyCharm and Jupyther.
please advise me some good Python IDE, I was using netbeans but it does not have suitable code completion (when I press "." it gives me methods of all classes of python. It would be nice if netbeans would work as for ex. for PHP..
Thank you.
Eclipse with Pydev
nothing better out there
Pytools should add intellisense for python to visual studio if you are developing on windows. I have not tried it myself so I don't know how good it works.
I have also been searching for a good IDE for Python development. I tried using Emacs and Komodo but finally settled for PyCharm. It does a really good job at auto completing the code and I find it to be worth the money.
Depending on the type of development you do, you could get a discounted or even a free license.
well, many IDEs now come with pretty good code completion. Eclipse with pydev is nice, or you can get aptana studio 3 to perform similar to it.
Theres also jetbrain's PyCharm, if you don't mind paying for a licence (they do give a trial version too if you want to test it before buying). There are a lot of such IDEs, guess you have to try them out to see which suits your code completion tastes better.
Try Geany and Ctrl+Enter. Foo bar <= wrote this because SO said answer was to short ;)
PyCharm for pay or Komodo Edit for free.
Komodo has since long time an excellent Python support
I found the below links very helpful in deciding the python IDE. They provide a lot of insight into the features with respect to all the relevant IDEs. It looks like most of them have auto-code completion feature as per these links. Since I have been using eclipse and VS Code all my life, I stick with Pydev or VS Code, yes will need some plugins to install. Pycharm has lot of features, if you can afford paying some money. I also found intelliJ also supports a lot of features.
What IDE to use for Python?
https://wiki.python.org/moin/IntegratedDevelopmentEnvironments
I packaged my Python app with py2exe. My app is a wxPython GUI, in which there is an interactive Python shell.
I noticed that I can't do help(whatever) in the shell. I investigated a bit and discovered that after the py2exe process, 3 items were missing from __builtin__. These are help, license, and another one I haven't discovered.
Why is this happening and how can I stop it? I want the users of my program to be able to use the help function of Python.
Reason: These are added by the site module. I believe that py2exe doesn't package that.
Fix: Either explicitly import site or reimplement help (trivial).
See also: http://docs.python.org/library/constants.html#constants-added-by-the-site-module
besides from using a completely integrated IDE with debugger for python (like with Eclipse), is there any little tool for achieving this:
when running a program, i want to be able to hook somewhere into it (similar to inserting a print statement) and call a window with an object inspector (a tree view)
after closing the window, the program should resume
It doesnt need to be polished, not even absolutely stable, it could be introspection example code for some widget library like wx. Platform independent would be nice though (not a PyObjC program, or something like that on Windows).
Any Ideas ?
Edit:
Yes, i know about pdb, but I'm looking for a graphical tree of all the current objects.
Nevertheless, here is a nice introduction on how to use pdb (in this case in Django):
pdb + Django
Winpdb is a platform independent graphical GPL Python debugger with an object inspector.
It supports remote debugging over a network, multiple threads, namespace modification, embedded debugging, encrypted communication and is up to 20 times faster than pdb.
Some other features:
GPL license. Winpdb is Free Software.
Compatible with CPython 2.3 through 2.6 and Python 3000
Compatible with wxPython 2.6 through 2.8
Platform independent, and tested on Ubuntu Jaunty and Windows XP.
User Interfaces: rpdb2 is console based, while winpdb requires wxPython 2.6 or later.
Here's a screenshot that shows the local object tree at the top-left.
(source: winpdb.org)
pdb isn't windowed, it runs in a console, but it's the standard way to debug in Python programs.
Insert this where you want to stop:
import pdb;pdb.set_trace()
you'll get a prompt on stdout.
If a commercial solution is acceptable, Wingware may be the answer to the OP's desires (Wingware does have free versions, but I don't think they have the full debugging power he requires, which the for-pay versions do provide).
Python Debugging Techniques is worth reading. and it's Reddit's comment is worth reading too. I have really find some nice debug tricks from Brian's comment. such as this comment and this comment.
Of course, WingIDE is cool (for general Python coding and Python code debugging) and I use it everyday. unlucky for WingIDE still can't embedded a IPython at now.
You can use ipython, with the %debug statement. Once your code crashes, you can add breakpoints, see objects etc. A very crude way to kickoff the debugger is to raise Exception at some line of your code, run it in ipython, the type %debug when it crashes.
Has anyone tried the NetBeans 6.5 Python IDE?
What are your opinions? Is it better/worse than PyDev? Do you like it? How does it integrate with source control tools (especially Mercurial)?
I will share some of the feelings from using it for quite a while now. Things that are roughly the same quality as in Eclipse+Pydev+mercurial:
editor, code-completion
debugger features
Things that are better:
autoimport
color schemes (Norway today rocks)
Mercurial support (though it is getting better and better in Eclipse)
Things that are worse:
zipped egg packages are not recognized for either code completion or the autoimport
libdyn packages (e.g. datetime) are not recognized
debugger is having trouble with multiprocessing package
you cannot choose file from outside of the project (/usr/bin/paster) to be the main file (this is what I use to debug Pylons applications)
Does anyone have something to add to the list?
BraveSirFoobar, it would be nice to know more about what problems you found -- the very, very slow part, as well as the crash. The first time you run the IDE it will index information about your Python platform and project and libraries - such that it can do quick code completion, go to declaration etc. later - but once that's done it's not supposed to be slow - but there might be bugs.
Mercurial should definitely be supported well, since the NetBeans project itself (and Solaris and Java) are all hosted in Mercurial repositories.
We plan to have really deep support for Python, much in the style of our Ruby support. One of the things which really helped in our Ruby work was the feedback from our early adopters, so if you try Python and have issues with it, please let us know so we can fix it. (Feedback links here: http://wiki.netbeans.org/Python )
-- Tor
Compared to pydev, I found it very, very slow, and it crashed (once) when I created a project from existing sources. It's still beta, though.
Integration with SCMs will be as good as netbeans is already (I only tried subversion, which worked fine).
Feature-wise it was about the same : refactor, debugging, code assist... I'll stick with pydev for the moment, which is IMHO a great tool.
Sun use Mercurial internally now, so expect that their IDE support for it will be top notch.
Having worked with PyDev and PyDev extension for Eclipse for the past few months, the move to NetBeans has been a very pleasurable one.
Without having to hunt all the different plug-ins for PyDev and Eclipse, NetBeans had everything I needed out of the box:
auto completion, super fast index search, style control import control, you name it.
And it seemed LESS bug prone than Eclipse (which is pretty stable).
Also, the built-in Vim like auto code snippets it uses are just fantastic.
IMO, it beats Eclipse hands down.
I'm hooked.
I started using it a little while back and I like it. I usually develop in a simple editor (SciTE), NetBeans is nice to organize larger projects.
wrote about it briefly here
How does it compare with PyDev Extensions? I've recently installed it and, to be honest, couldn't imagine myself going back to PyDev.
NetBeans seems interesting though, if only I wasn't already hooked onto a couple of other Eclipse plug-ins as well.
After looking at this, I decided to go ahead with PyDev than NetBeans.
However best wishes to NetBeans team for a faster and better Python support. Cant wait for that :)