Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45041 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2013-05-10 01:49 +1000 |
| Last post | 2013-05-10 01:49 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Urgent:Serial Port Read/Write Chris Angelico <rosuav@gmail.com> - 2013-05-10 01:49 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-05-10 01:49 +1000 |
| Subject | Re: Urgent:Serial Port Read/Write |
| Message-ID | <mailman.1495.1368114548.3114.python-list@python.org> |
On Fri, May 10, 2013 at 1:35 AM, chandan kumar <chandan_psr@yahoo.co.in> wrote: > > Hi all, > I'm new to python and facing issue using serial in python.I'm facing the below error > > ser.write(port,command) > NameError: global name 'ser' is not defined > > Please find the attached script and let me know whats wrong in my script and also how can i read data from serial port for the same script. You're assigning to 'ser' inside OpenPort(), but then trying to use it in WriteSerialData(). You'll need to declare 'global ser' in OpenPort to make this work. Alternatively, you may want to cut down on the number of functions you have, since they're called in only one place anyway and have to share state. ChrisA
Back to top | Article view | comp.lang.python
csiph-web