Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45041
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.177 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.71; '*S*': 0.06; 'assigning': 0.09; 'kumar': 0.09; 'python': 0.11; 'anyway': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nameerror:': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'trying': 0.19; 'error': 0.23; 'script.': 0.24; 'script': 0.25; 'subject:/': 0.26; 'defined': 0.27; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'have,': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'fri,': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'read': 0.60; 'new': 0.61; "you're": 0.61; "you'll": 0.62; 'name': 0.63; 'serial': 0.72; 'cut': 0.74; 'subject::': 0.85; 'subject:Port': 0.91; 'subject:Serial': 0.91; 'state.': 0.95; 'subject:Urgent': 0.96; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=jesZ1EMv459XUHDeyiUznLrg9kLkG9tIwkN8q3Qzuws=; b=PYtIh8JJ9I7LJf0c0wQi2R9NcjV02INUhSLUKOhBkbXXLp4eZmgm0IQop2D4+0zdWU 1cyff6WuFRabT45trZsGKj/bsVm2+JSziJXqJ4UKGrfIi09qlw8d/hOgQIplhET2zEgg hxVh96uacsaOsVzfOmjSlcHFBvSXy1iIAW2P0Q7LVpdCCN4qegjkPl4Km19jSC8/6HBT Z+coVZSwjfzaT6mXEfrBl8OExk9uOz7Y5BerN7JRsW5Y57VWrNdPnfJyEmPxSsOicymo GX+YlxdCDvhcNEbslj+EyWxajxjKL/53eTjM9Zk866lWQNywanWiBTnLBEiTKWg9VIWZ P6rw== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.75.46 with SMTP id z14mr8198950vev.52.1368114545926; Thu, 09 May 2013 08:49:05 -0700 (PDT) |
| In-Reply-To | <1368113753.5157.YahooMailClassic@web190506.mail.sg3.yahoo.com> |
| References | <1368113753.5157.YahooMailClassic@web190506.mail.sg3.yahoo.com> |
| Date | Fri, 10 May 2013 01:49:05 +1000 |
| Subject | Re: Urgent:Serial Port Read/Write |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1495.1368114548.3114.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1368114548 news.xs4all.nl 15986 [2001:888:2000:d::a6]:34351 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:45041 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Urgent:Serial Port Read/Write Chris Angelico <rosuav@gmail.com> - 2013-05-10 01:49 +1000
csiph-web