473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

debugging

Hi all,

Can someone help me out a little with Python? What do people use to
debug Python code? I don't understand how to use the built in debugger
and I haven't had any luck getting ddd to debug my Python programs. I
end up falling back on inserting print statements in my code to figure
out what's going on. This works but isn't always the fastest route to
a solution. So, I'm just wondering what other people do.

Thanks,
Doug
Jul 18 '05 #1
6 1478
Hi,
Can someone help me out a little with Python? What do people use to
debug Python code? I don't understand how to use the built in debugger
and I haven't had any luck getting ddd to debug my Python programs. I
end up falling back on inserting print statements in my code to figure
out what's going on. This works but isn't always the fastest route to
a solution. So, I'm just wondering what other people do.


I use print..... But if you want to have a graphical debugger, look into
eric. Actually, its much more, and if I were not so tied to xemacs key
bindings, I'd switch yesterday.

Diez
Jul 18 '05 #2
wr******@earthlink.net (Doug Farrell) writes:
Hi all,

Can someone help me out a little with Python? What do people use to
debug Python code? I don't understand how to use the built in
debugger
What have you tried? pdb.run('...') and pdb.set_trace() may be your
friends.
and I haven't had any luck getting ddd to debug my Python programs. I
end up falling back on inserting print statements in my code to figure
out what's going on. This works but isn't always the fastest route to
a solution. So, I'm just wondering what other people do.


Well, quite a lot of the time I ... insert print statements in my
code.

I also find stopping and actually thinking hard every now and again
helps, too :-)

Cheers,
mwh

--
ARTHUR: Yes. It was on display in the bottom of a locked filing
cabinet stuck in a disused lavatory with a sign on the door
saying "Beware of the Leopard".
-- The Hitch-Hikers Guide to the Galaxy, Episode 1
Jul 18 '05 #3
Doug,

I use a loggerclass to log debugging/tracing information
to a log file during the program execution. I trigger these
logging statements by setting python variables _trace and
_debug at the top of my program execution (normally by reading
them from a .INI file using ConfigParser). This way I can
trace/debug my program and then easily turn them off when
the code is finalized. I leave this code in the application
and find that it can prove to be very valuable should a
problem arise in the future. Just turn on trace/debug and
take a look at the log file. I don't believe that there
is significant overhead in a few "if _debug: logf.writelines..."
statements in the code.

-Larry
"Doug Farrell" <wr******@earthlink.net> wrote in message
news:88**************************@posting.google.c om...
Hi all,

Can someone help me out a little with Python? What do people use to
debug Python code? I don't understand how to use the built in debugger
and I haven't had any luck getting ddd to debug my Python programs. I
end up falling back on inserting print statements in my code to figure
out what's going on. This works but isn't always the fastest route to
a solution. So, I'm just wondering what other people do.

Thanks,
Doug

Jul 18 '05 #4
Doug Farrell wrote:
Can someone help me out a little with Python? What do people
use to debug Python code? I don't understand how to use the
built in debugger and I haven't had any luck getting ddd to
debug my Python programs. I end up falling back on
inserting print statements in my code to figure out what's
going on. This works but isn't always the fastest route to a
solution. So, I'm just wondering what other people do.


What OS are you running?

On Windows, PythonWin has a nice interactive debugger.

My favorite is Komodo, which is available for Windows, Linux, and Solaris:

http://www.activestate.com/Products/Komodo/

Komodo is not free, but the personal edition is pretty cheap, and the
commercial edition is well worth the price for commercial development.

-Mike
Jul 18 '05 #5
Doug Farrell wrote:
Hi all,

Can someone help me out a little with Python? What do people use to
debug Python code? I don't understand how to use the built in debugger
and I haven't had any luck getting ddd to debug my Python programs. I
end up falling back on inserting print statements in my code to figure
out what's going on. This works but isn't always the fastest route to
a solution. So, I'm just wondering what other people do.


"The most effective debugging tool is still careful thought, coupled with
judiciously placed print statements." -- Brian Kernighan (1978)

The 'print statements' method still works, anno 2004. Aside from that, I use
unit tests. I never use a debugger; I find stepping through code, or breaking
execution off halfway, rather clumsy.

Just my $0.02,

--
Hans (ha**@zephyrfalcon.org)
http://zephyrfalcon.org/

Jul 18 '05 #6
I second the recommend. on Komodo. I'm definitely happy with it myself. I
recently bought the personal edition.
If you install the ActiveState version, as you heard by now, you get
PythonWin which can debug. I notice the similarity in interfaces even, as
they were both made by ActiveState of course. However Komodo has a lot of
functionality beyond it, if you need that it is (if you even care about
Komodo and what I'm typing here, bye).

"Michael Geary" <Mi**@DeleteThis.Geary.com> wrote in message
news:10*************@corp.supernews.com...
Doug Farrell wrote:
Can someone help me out a little with Python? What do people
use to debug Python code? I don't understand how to use the
built in debugger and I haven't had any luck getting ddd to
debug my Python programs. I end up falling back on
inserting print statements in my code to figure out what's
going on. This works but isn't always the fastest route to a
solution. So, I'm just wondering what other people do.


What OS are you running?

On Windows, PythonWin has a nice interactive debugger.

My favorite is Komodo, which is available for Windows, Linux, and Solaris:

http://www.activestate.com/Products/Komodo/

Komodo is not free, but the personal edition is pretty cheap, and the
commercial edition is well worth the price for commercial development.

-Mike

Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
2
by: Andy Fish | last post by:
Hi, Using VS.NET 2003, when I use 'F5' to start debugging my web app, it obviously attaches the IDE to IIS for server debugging. However, it also seems to put IE into some kind of debugging mode...
2
by: Alex Clark | last post by:
Hi All, My system: WinXP Pro, VS.NET 2003, SQL Server Personal Edition. I'm having problems with my old favourite demon, SQL Debugging from within VS.NET. I have to say I've found this...
5
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The...
6
by: KevinGPO | last post by:
I am currently developing a website in ASP (VBScript) using MS Visual C#.NET IDE. I just create a new "ASP.NET Web Application" and point to my local webserver (IIS) of my website address. Then I...
5
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into the GAC. Each of the applications contains an...
5
by: =?Utf-8?B?Z2FkeWE=?= | last post by:
I can't get to debug on my local IIS using VStudio.net 2005 Prof. I can on the development server. I get the msg 'the server does not support debugging for asp.net...' I have done the following...
2
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use...
4
by: =?Utf-8?B?TWlrZSBHYWxl?= | last post by:
VS 2008 initially didn't debug classic ASP. SP1 fixes this in some ways. You can debug if you select the debug option to "Start Without Debugging, then either attach the debugger manually or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.