On Thu, 09 May 2013 23:35:53 +0800, chandan kumar 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. [snip] > if __name__ == "__main__": > > CurrDir=os.getcwd() > files = glob.glob('./*pyc') > for f in files: > os.remove(f) > OpenPort(26,9600) > SetRequest(ER_Address) > #SysAPI.SetRequest('ER',ER_Address) > > print "Test Scripts Execution complete"
What kind of 'port' is 26? Is that valid on your machine? My guess is that <ser> is NULL (because the open is failing, likely due to the port selection), leading to your subsequent problems. HTH.. -- http://mail.python.org/mailman/listinfo/python-list