Why will my com4 not work????

Hi all

What is wrong with my code??: pyserial, blender 2.49b,python 2.6.2 installed running on Vista, AMD Turion 64

Python script error from controller “cont#CONTR#1”:
Traceback <most recent call last>:
File “serial.py”, line 4, in <module>
File “serial.py”, line 8, in <module>
AttributeError:‘module’ object has no attribute ‘Serial’
:frowning:

BGE:

1 # import game logic and serial modules
2 #import Blender
3 import GameLogic
4 import serial
5 #from serial import *
6
7 #-------------------------------------------
8 serialport = serial.Serial(“com4”, 9600, timeout=0)
9 for i in range(1, 20):
10 x = serialport.read(size=1)
11 y = ord(x)
12 print “y=”, y
13
14 else:
15 serialport.close()

I went over this a million times…should be working perfectly…am really at the end of my rope here:spin:…thanks

You might have the same problem: http://ubuntuforums.org/showthread.php?t=947236

greetings

splintercdo

Yes,Splintercdo!!

That annoying error message has dissapeared, renaming the script file did it, now I am left with the generic error “ImportError: No module named serial”

Why is that, I have the pyserial “serial” folder under my Blender Scripts path @ “C:\Program Files\Blender Foundation\Blender\scripts\serial

Any insights would be appreciated

you maybe have to install the python serial module?

i dont know that, but that possibly will help.

start the console

input : python -> python will start when you press enter

input: import serial -> if you get no error when pressing enter everything works. i myself get an error when trying to import and i guess you work on windows and the blender folder is not in your pythonpath system variable?

i dont even know if you need the serial in python directly or if my post is totally useless for you, but i thought i’d give it a try :smiley:

greetings
manarius

Attachments


I think that manarius might be correct you just have to set system variable that it points to directory where you installed pyserial

I don’t know how you was installing pyserial, but here is link how to install egg files in python: http://pypi.python.org/pypi/setuptools

and in attachment you can see how to set up system path variable

Hope this helps

splintercdo

Attachments




and theres the nice little thing called easy_install

its a python package which enables you to call

easy_install package_name

from the console.

this nifty little thing gets all the depending libraries for the library you try to install and installs them and afterwards installs the library.

that tool is good. seriously. :smiley:

greetings
manarius