Using pyserial with rhinopython


#1

Using pyserial with rhinopython.

I am trying to import serial but I am getting an error: No module named serial

Is there a way to using python libraries with rhinopython


(Steve Baer) #2

I’ve never used pySerial before. I’m assuming it is this project
http://pyserial.sourceforge.net/
Looks like it should work with rhinopython. Make sure the library can be found on the path. Go to options in the “EditPythonScript” dialog to see the paths (or add more)


#3

Yeah that is the library I am using.

I am trying it on rhinoMac which does not have the editpythonscript command

when I import should I include the full path of where the library is?

thanks


(Steve Baer) #4

In that case I would try appending the path to pyserial like in the sample given here
http://www.johnny-lin.com/cdat_tips/tips_pylang/path.html


#5

Hi,
have you solved the problem with pyserial?
Becouse i?m trying to use pyserial but not work, I still have the Message: No module named serial…
any help will be precious
thanks


#6

This is the code that I try to use:

import serial
import time
import sys

sys.path.append(“C:\Python27\Lib\site-packages”)

ser = serial.Serial(’/dev/tty.usbmodem411’, 9600)
counter = 1000

c = []

i=0
while True:
if i<counter:

      stri = ser.readline()
      #stri = "50,60,30"
      c = stri.split(",")

      for i in range(0,3):
           c[i] = int(c[i])
      print c
      
 else:
      break
 counter +=1

(Steve Baer) #7

I haven’t tested, but you will definitely need to append to the path before you attempt to import serial.