Discussion:
[pytables-users] NameError: name 'p' is not defined
Rink Tang
2017-05-29 04:23:05 UTC
Permalink
I run the file examples/tutorial2.py with windows+Python3.6
the source code is here, http://www.pytables.org/usersguide/tutorials.html

there is an error, name 'p' is not defined
when run

e = [ p['TDCcount'] for p in table if p['ADCcount'] < 20 and 4 <= p['TDCcount'] < 15 ]print("Last record ==>", p)

how to fixed it?
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francesc Alted
2017-05-29 08:10:47 UTC
Permalink
'p' is a local variable inside the comprehension list and it used to be
available outside it in Python 2, but apparently this is no longer try in
Python 3. Just use 'e[-1]' instead.

Francesc
Post by Rink Tang
I run the file examples/tutorial2.py with windows+Python3.6
the source code is here, http://www.pytables.org/usersguide/tutorials.html
there is an error, name 'p' is not defined
when run
e = [ p['TDCcount'] for p in table if p['ADCcount'] < 20 and 4 <= p['TDCcount'] < 15 ]print("Last record ==>", p)
how to fixed it?
--
You received this message because you are subscribed to the Google Groups
"pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Search results for '[pytables-users] NameError: name 'p' is not defined' (Questions and Answers)
3
replies
Programming, please help!?
started 2009-02-25 14:32:55 UTC
programming & design
Loading...