You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python3 ValueError: can't have unbuffered text I/O #94
I am a beginner in programming with python.
I installed ev3dev-lang-python for python3. When I try to run "motors = [LargeMotor(port) for port in (OUTPUT_B, OUTPUT_C)]" from autodrive.py in demo-folder I get:
ValueError: can't have unbuffered text I/O
Note that upgrading will make your EV3 incompatible with the current documentation (it has not been updated yet). If you do upgrade, make sure that you understand that other software which uses EV3 motors, sensors, etc. and was written before the new kernel was released will no longer function due to breaking changes. If you don't think you are experienced enough to diverge from the docs for now, wait until we release an image and update the docs.
You can try to get around it by specifying the port_name argument in kwargs. instead of using LargeMotor('outB'), use LargeMotor(port_name='outB')
That's a nice idea! Another option could be checking out this commit: ec8b643. It has python3 fix merged in, but still uses port_name instead of address.
The original problem described above has been solved as it seems.
But I can't test the whole autodrive.py from the demo folder because at this moment I am working on another robot.
Okay, I did the following an got an error. I quit with Ctrl + D
robot@ev3dev:~$ python3
Python 3.4.2 (default, Oct 8 2014, 14:47:30)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
from ev3dev.auto import *
motors = [LargeMotor(address) for address in (OUTPUT_B, OUTPUT_C)]
Exception ignored in: <bound method LargeMotor.del of <ev3dev.core.LargeMotor object at 0xb6943650>>
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 281, in del
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 730, in stop
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 295, in command
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 216, in set_attr_string
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 204, in _set_attribute
AttributeError: 'LargeMotor' object has no attribute '_path'
Exception ignored in: <bound method LargeMotor.del of <ev3dev.core.LargeMotor object at 0xb6943b30>>
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 281, in del
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 730, in stop
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 295, in command
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 216, in set_attr_string
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 204, in _set_attribute
AttributeError: 'LargeMotor' object has no attribute '_path'
The error message than quitting python3 with Ctrl + D changed slightly:
robot@ev3dev:~$ python3
Python 3.4.2 (default, Oct 8 2014, 14:47:30)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
from ev3dev.auto import *
motors = [LargeMotor(address) for address in (OUTPUT_B, OUTPUT_C)]
Exception ignored in: <bound method LargeMotor.del of <ev3dev.core.LargeMotor object at 0xb69c4650>>
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 281, in del
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 730, in stop
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 295, in command
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 216, in set_attr_string
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 204, in _set_attribute
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 88, in write
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 74, in file_handle
NameError: name 'open' is not defined
Exception ignored in: <bound method LargeMotor.del of <ev3dev.core.LargeMotor object at 0xb69c4ad0>>
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 281, in del
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 730, in stop
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 295, in command
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 216, in set_attr_string
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 204, in _set_attribute
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 88, in write
File "/usr/local/lib/python3.4/dist-packages/python_ev3dev-0.6.0.post6-py3.4.egg/ev3dev/core.py", line 74, in file_handle
NameError: name 'open' is not defined
Activity
ddemidov commentedon Nov 21, 2015
Should be solved by #93.
rhempel commentedon Nov 21, 2015
Which I have not pulled or released yet - please grab the latest from @ddemidov's repo for now - I will be out for the rest of the day
ildan95 commentedon Dec 27, 2015
Is it solved now? I have this problem yet.
ddemidov commentedon Dec 27, 2015
The fix has been committed to the master branch, but has not been tagged and released yet. So you should use the git version for now.
ildan95 commentedon Dec 27, 2015
Thank you. It works now. But when I try to run the code in example:
it always returns, that motor wasn't connected and returns this error:
ddemidov commentedon Dec 27, 2015
can you please show the output of the following shell command?
$ cat /sys/class/tacho-motor/*/addressEDIT: the latest kernel needs
addressinstead ofport_nameddemidov commentedon Dec 27, 2015
While I was making the above edit, I realized that the problem could be that you have outdated kernel. So what is the output of
on your ev3?
ildan95 commentedon Dec 27, 2015
don't work.
ddemidov commentedon Dec 28, 2015
You need to upgrade your kernel (http://www.ev3dev.org/news/2015/12/15/Kernel-Release-Cycle-9/)
apt-get update && apt-get upgrade && apt-get dist-upgradeshould do it.WasabiFan commentedon Dec 28, 2015
Note that upgrading will make your EV3 incompatible with the current documentation (it has not been updated yet). If you do upgrade, make sure that you understand that other software which uses EV3 motors, sensors, etc. and was written before the new kernel was released will no longer function due to breaking changes. If you don't think you are experienced enough to diverge from the docs for now, wait until we release an image and update the docs.
pkshiu commentedon Dec 28, 2015
You can try to get around it by specifying the port_name argument in kwargs. instead of using LargeMotor('outB'), use LargeMotor(port_name='outB')
ddemidov commentedon Dec 28, 2015
That's a nice idea! Another option could be checking out this commit: ec8b643. It has python3 fix merged in, but still uses
port_nameinstead of address.rhempel commentedon Jan 2, 2016
@marev3 - please review the status of this defect. If it's solved by upgrading to the new kernel then close.
Also, please consider reviewing the latest README.rst page here to see if this helps you get ev3dev-lang-python working under Python3.
marev3 commentedon Jan 3, 2016
The original problem described above has been solved as it seems.
But I can't test the whole autodrive.py from the demo folder because at this moment I am working on another robot.
marev3 commentedon Jan 3, 2016
Okay, I did the following an got an error. I quit with Ctrl + D
robot@ev3dev:~$ python3
Python 3.4.2 (default, Oct 8 2014, 14:47:30)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
ddemidov commentedon Jan 3, 2016
Do you actually have two large motors connected to ports B and C? What does the following shell command give you?
$ cat /sys/class/tacho-motor/*/addressmarev3 commentedon Jan 3, 2016
robot@ev3dev:~$ cat /sys/class/tacho-motor/*/address
outC
outB
outA
The error message than quitting python3 with Ctrl + D changed slightly:
robot@ev3dev:~$ python3
Python 3.4.2 (default, Oct 8 2014, 14:47:30)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
BTW I am using the latest build of ev3dev.
ddemidov commentedon Jan 3, 2016
Looks like duplicate of #96
dwalton76 commentedon Sep 14, 2016
Closing since this is a dup