This sounds like a perfect job for pdb.

One easy way is to put these lines where you want it to pause execution:

    import pdb
    pdb.set_trace()

Then you can type 'n' (next) to go line-by-line. If you type a
variable name or "print varname" at any time it will print the current
value.

Another way which is even better is to create a file named .pdbrc
(note the leading period) in the same directory as manage.py (wherever
you'll be launching your code from).

Assuming the line "nme = k.split('_')[0]" is on line 23:

break 
/home/lawgon/servicefirst/servicefirst/../servicefirst/incident/views.py:23

This will halt on line 23.

Even better:
break 
/home/lawgon/servicefirst/servicefirst/../servicefirst/incident/views.py:23,
'product' in k
This will halt on line 23 if 'product' is in 'k.'

If you use a .pdbrc file, instead of manage.py runserver, do this:

python -m pdb manage.py runserver

That will help you find the problem. Note also that you don't need to
import pdb anywhere in your code if you do the latter method. It's
great for debugging imported modules as well.
More info: http://www.doughellmann.com/PyMOTW/pdb/

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to