Has it changed? I am just using it as import pdb; pdb.set_trace()
import pdb; pdb.set_trace()
but in the line the pdb
is used it throws now:
NameError: name 'raw_input' is not defined
For those asking for full traceback:
My app traceback and then:
if not serializer.is_valid():
vi +48 /usr/lib/python3.5/bdb.py # trace_dispatch
return self.dispatch_line(frame)
vi +66 /usr/lib/python3.5/bdb.py # dispatch_line
self.user_line(frame)
vi +259 /usr/lib/python3.5/pdb.py # user_line
self.interaction(frame, None)
vi +346 /usr/lib/python3.5/pdb.py # interaction
self._cmdloop()
vi +319 /usr/lib/python3.5/pdb.py # _cmdloop
self.cmdloop()
vi +32 /home/user/.virtualenvs/myapp/lib/python3.5/site-packages/noseprogressive/wrapping.py # cmdloop
orig_raw_input = raw_input
NameError: name 'raw_input' is not defined
Looks very python3.5 pdb to me, nothing about 2.7 pdb
Here's the issue.
You are using noseprogressive
library with 1.5.1
version which is too old around 6 years ago ( 26 Mar 2013 which is developed for Python 2.7
I guess).
https://github.com/erikrose/nose-progressive/blob/1.5.1/noseprogressive/wrapping.py#L32
They didn't handle the exception where they are assigning raw_input
to a variable orig_raw_input
which is why you are getting the NameError
when using raw_input
But in the latest version 1.5.2
, they handled it properly using try
and catch
.
https://github.com/erikrose/nose-progressive/blob/1.5.2/noseprogressive/wrapping.py#L33
Try updating the noseprogressive
library to the latest version which is 1.5.2
and it should be fine.
Hope this helps.
For Python 3.x, use input() . For Python 2.x, use raw_input() . Don't forget you can add a prompt string in your input() call to create one less print statement. input("GUESS THAT NUMBER!") here is the documentation https://docs.python.org/3/whatsnew/3.0.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.