473,387 Members | 1,532 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.

Facing problem with Debugging with UI

440 256MB
Hi,

I am not able to debug the application,when I have integrated UI with the application modules.

Whether I have to set/activate any options to debug the application code?

Thanks in advance
PSB
Apr 16 '07 #1
6 1037
bartonc
6,596 Expert 4TB
Hi,

I am not able to debug the application,when I have integrated UI with the application modules.

Whether I have to set/activate any options to debug the application code?

Thanks in advance
PSB
Honestly, most python programmers just throw in print statements for debugging. With a gui, you could also pop up a dialog with the state info that you are interested in.
Apr 16 '07 #2
psbasha
440 256MB
So ,We cannot debug line by line and check for the variable values.To get this details we have to use "print" statement .

-PSB
Apr 16 '07 #3
bartonc
6,596 Expert 4TB
So ,We cannot debug line by line and check for the variable values.To get this details we have to use "print" statement .

-PSB
You can do it. It's just that PythonWin never worked very well for me and IDLE doesn't like GUI debugging at all.
I remember reading in the help on PythonWin that it has an option for GUI debug mode.

Using print just seems to be the quickest and most practiced way of doing debugging. (For example, I've been using Boa Constructor for over 6 months - while learning wxPython - and have never even tried the debugger.)
Apr 16 '07 #4
ghostdog74
511 Expert 256MB
So ,We cannot debug line by line and check for the variable values.To get this details we have to use "print" statement .

-PSB
yes , you can, using the pdb module.
Apr 17 '07 #5
psbasha
440 256MB
Could you please help me.How to use this module for debugging the application functionality thru UI as entry point?

Thanks
PSB
Apr 17 '07 #6
ghostdog74
511 Expert 256MB
Could you please help me.How to use this module for debugging the application functionality thru UI as entry point?

Thanks
PSB
if you are using a UI, your UI should come with debugging facilities. Even Pythonwin or IDLE does a bit of debugging for you. this pdb module is sort of command line debugging. Here's a simple guide on how to use it.
imagine you have this code:
Expand|Select|Wrap|Line Numbers
  1. import pdb,sys
  2. def afunc():
  3.      a = 1
  4.      b = 2
  5.      c = a+b
  6.      return a,b,c
  7. pdb.set_trace()  #put the trace starting here.
  8. a = 100
  9. b = 200
  10. d = afunc()
  11. sys.exit()
  12.  
output:
Expand|Select|Wrap|Line Numbers
  1. # ./test1.py
  2. > /test/test1.py(13)?()
  3. -> a = 100
  4. (Pdb) n
  5. > /test/test1.py(14)?()
  6. -> b = 200
  7. (Pdb) n
  8. > /test/test1.py(15)?()
  9. -> d = afunc()
  10. (Pdb) s
  11. --Call--
  12. > /test/test1.py(6)afunc()
  13. -> def afunc():
  14. (Pdb) n
  15. > /test/test1.py(7)afunc()
  16. -> a = 1
  17. (Pdb) n
  18. > /test/test1.py(8)afunc()
  19. -> b = 2
  20. (Pdb) n
  21. > /test/test1.py(9)afunc()
  22. -> c = a+b
  23. (Pdb) n
  24. > /test/test1.py(10)afunc()
  25. -> return a,b,c
  26. (Pdb) p c
  27. 3
  28. (Pdb) n
  29. --Return--
  30. > /test/test1.py(10)afunc()->(1, 2, 3)
  31. -> return a,b,c
  32. (Pdb) n
  33. > /test/test1.py(17)?()
  34. -> sys.exit()
  35. (Pdb) p d
  36. (1, 2, 3)
  37. (Pdb) n
  38. SystemExit: None
  39. > /test/test1.py(17)?()
  40. -> sys.exit()
  41.  
once the script executes, you go to the debug prompt. type 'h' for a list of commands you can use to debug. most common ones I use are s,l, h, p , n. 'l' shows you where you are now, 'p' prints out values of variables , 'n' means next step. 's' means if you hit a function, you step into that function.
Noticed when i hit the afunc() functoin, i use s to step into it. then i continue with 'n' . when when it reaches c=a+b, i hit 'n' to execute it, then i do a 'p c' to print the value of c. After the return , i did another 'p d' to print the value of the afunc(), which is a tuple. Well, this is very short, please go experiment it yourself. there's always google if you need more resources.
Apr 17 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John | last post by:
Internet Facing SQL Server, Login Security? How? I would think that our Project is fairly common. We're stuck on a security question. We have a typical SQL Server 2000, running under Windows...
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...
5
by: psbasha | last post by:
Hi, Currently I am using Active Python 2.4.2 IDLE.I am facing the following issue. - When I modify the code in different modules and execute the main module ,and if any error is coming in some...
2
by: jiang.haiyun | last post by:
Hi, I am having some serious problems with PyQT4, when i run pyqt script, I always get 'Segmentation fault'. the script is simple: ====================== %less qttest.py from PyQt4 import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.