Go Down

Topic: arduino and pthon why not working? (Read 779 times) previous topic - next topic

doraemon

I installed pySterial as suggested here :
http://www.arduino.cc/playground/Interfacing/Python

and this is what I got in python. any idea what went wrong? any clue how I can still get my win-pc to talk to arduino in python?


Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

   ****************************************************************
   Personal firewall software may warn about the connection IDLE
   makes to its subprocess using this computer's internal loopback
   interface.  This connection is not visible on any external
   interface and no data is sent to or received from the Internet.
   ****************************************************************
   
IDLE 1.2.1      
>>> import serial

Traceback (most recent call last):
 File "<pyshell#0>", line 1, in <module>
   import serial
 File "C:\Python25\Lib\site-packages\serial\__init__.py", line 13, in <module>
   from serialwin32 import *
 File "C:\Python25\Lib\site-packages\serial\serialwin32.py", line 9, in <module>
   import win32file  # The base COM port and file IO functions.
ImportError: No module named win32file
>>>

orphans

You need the win32all extension - see https://sourceforge.net/projects/pywin32/ for downloads.
Joe

doraemon

i know this is probably pretty stupid but where do I extract that into?

doraemon

Well I installed pyserial and I am still getting this:
>>> import serial

Traceback (most recent call last):
 File "<pyshell#6>", line 1, in <module>
   import serial
 File "C:\Python25\Lib\site-packages\serial\__init__.py", line 13, in <module>
   from serialwin32 import *
 File "C:\Python25\Lib\site-packages\serial\serialwin32.py", line 9, in <module>
   import win32file  # The base COM port and file IO functions.
ImportError: No module named win32file

I just installed it via the .exe I can find it in C:\Python25\Lib\site-packages\serial\
I then started python and entered
import serial
and that's where I am at

I using Python 2.5 under XP.

I know I am probably asking something like "how do I turn the lights on" while I am standing next to the light switch but I just can't get it to work.
Thanks in advance.

doraemon

Ok I got the win32api package now (http://sourceforge.net/project/showfiles.php?group_id=78018)
so now I can import serial, but I am getting this:

ser = serial.Serial('/dev/tty.usbserial',9600)

Traceback (most recent call last):
 File "<pyshell#2>", line 1, in <module>
   ser = serial.Serial('/dev/tty.usbserial',9600)
 File "C:\Python25\Lib\site-packages\serial\serialutil.py", line 156, in __init__
   self.open()
 File "C:\Python25\Lib\site-packages\serial\serialwin32.py", line 55, in open
   raise SerialException("could not open port: %s" % msg)
SerialException: could not open port: (3, 'CreateFile', 'The system cannot find the path specified.')

I guess I am making some progress but any help would be appreciated.

doraemon

holly **** batman it worked.
Well it took me a while but here is how it worked

after installing pyserial and win32api
>>> import serial
>>> ser = serial.Serial(6) //6 is the usb port that the arduino is plugged into
>>> ser.write('H')//got my LED to blink

Well praised be the internet and thanks to all the people that helped them. I hope this helps guys like me when they stumble across this problem.

Go Up