import serial failure

Zachary Ware zachary.ware+pylist at gmail.com
Wed Apr 16 14:08:22 EDT 2014


On Wed, Apr 16, 2014 at 12:56 PM, J W Burton <jahree1129 at gmail.com> 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.
>
> import time
> import serial

Your file is named serial.py, so "import serial" in that file will try
to import itself.  You can see this in the traceback you posted,
everything is coming from "C:\Users\Jahree\serial.py".  Rename your
serial.py and things should work as expected.

Hope this helps,
-- 
Zach



More information about the Python-list mailing list