I have an Arduino connected with 2 DS18B20 temperature sensors. I am very (VERY) new to python. I am looking for a way to read sequential input and parse it in a sqlite database, but this is ahead of me. Why am I getting an error when trying to determine my serial port for a variable?
First things first sys.version
2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
My current one, just read the input from the serial connection program.
from serial import serial import time
Currently, I cannot compile it. Most of the results that I found for this error say to add from serial import serial , but in this case it did not work.
Error.
$ python ser.py Traceback (most recent call last): File "ser.py", line 1, in <module> from serial import serial File "/Users/frankwiebenga/serial.py", line 8, in <module> AttributeError: 'module' object has no attribute 'Serial'
Also, if I just use import serial , I get the same error
$ python ser.py Traceback (most recent call last): File "ser.py", line 1, in <module> import serial File "/Users/frankwiebenga/serial.py", line 8, in <module> AttributeError: 'module' object has no attribute 'Serial'
Also for the comment. Created a new file called something.py and still got the same error, regardless of using import serial or from serial import serial .
$ python something.py Traceback (most recent call last): File "something.py", line 1, in <module> from serial import serial ImportError: No module named serial
When I run my bash script, I get output that is valid, so I know that this is not Arduino code.
Output:
Requesting temperatures...DONE Device 0: 25.62 Device 1: 25.75 Requesting temperatures...DONE Device 0: 25.62 Device 1: 25.81
Bash:
while true # loop forever do inputline="" # clear input # Loop until we get a valid reading from AVR until inputline=$(echo $inputline | grep -e "^temp: ") do inputline=$(head -n 1 < /dev/tty.usbmodem621) done echo "$inputline" done