import serial failure

Peter Otten __peter__ at web.de
Wed Apr 16 14:15:29 EDT 2014


J W Burton wrote:
> I have installed both Python 2.7 AND Python 3.3 and the corresponding
> pyserial files from
>>ihttps://pypi.python.org/packages/any/p/pyserial/pyserial-2.7.win32.exe#md5=21555387937eeb79126cde25abee4b35n
> my
>> for 2.7
>> When I look in my Python27/Lib/site-packages/serial folder I see
> package files
>> but when I run a program using import serial, I get an error
> Traceback (most recent call last):
> File "C:\Users\Jahree\serial.py", line 2, in <module>
> import serial
> File "C:\Users\Jahree\serial.py", line 5, in <module>
> ser = serial.Serial(
> AttributeError: 'module' object has no attribute 'Serial'
>> I'm guessing there is a path not set correctly - I'M STUCK
>> Please help.
>> Thanks
>> ps: the following is serial.py file I'm using for testing.

Your choice of filename is unfortunate ;)
 
> import time
> import serial

The file is importing itself here. Rename your
C:\Users\Jahree\serial.py
to something unique, say
C:\Users\Jahree\myserial.py
delete 
C:\Users\Jahree\serial.pyc
and everything should be OK.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /