Skip to content

python3 ValueError: can't have unbuffered text I/O #94

Closed

Description

@marev3

Hi,

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

How do I solve this problem?

Activity

  1. ddemidov commented on Nov 21, 2015

    @ddemidov
    Member

    Should be solved by #93.

  2. rhempel commented on Nov 21, 2015

    @rhempel
    Member

    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

  3. ildan95 commented on Dec 27, 2015

    @ildan95

    Is it solved now? I have this problem yet.

  4. ddemidov commented on Dec 27, 2015

    @ddemidov
    Member

    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.

  5. ildan95 commented on Dec 27, 2015

    @ildan95

    Thank you. It works now. But when I try to run the code in example:

    from ev3dev import ev3
    m = ev3.LargeMotor('outB')
    print(m.connected)
    m.run_timed(time_sp=3000, duty_cycle_sp=75)
    

    it always returns, that motor wasn't connected and returns this error:

    AttributeError: 'LargeMotor' object has no attribute '_path'

  6. ddemidov commented on Dec 27, 2015

    @ddemidov
    Member

    can you please show the output of the following shell command?

    $ cat /sys/class/tacho-motor/*/address

    EDIT: the latest kernel needs address instead of port_name

  7. ddemidov commented on Dec 27, 2015

    @ddemidov
    Member

    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

    uname -a
    

    on your ev3?

  8. ildan95 commented on Dec 27, 2015

    @ildan95
    uname -a
    

    Linux ev3dev 3.16.7-ckt16-7-ev3dev-ev3 #1 PREEMPT Sun Sep 6 22:59:18 CDT 2015 armv5tejl GNU/Linux

    $ cat /sys/class/tacho-motor/*/address
    

    don't work.

    $ cat /sys/class/tacho-motor/*/port_name
    

    outC
    outB

  9. ddemidov commented on Dec 28, 2015

    @ddemidov
    Member

    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-upgrade should do it.

  10. WasabiFan commented on Dec 28, 2015

    @WasabiFan
    Member

    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.

  11. pkshiu commented on Dec 28, 2015

    @pkshiu

    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')

  12. ddemidov commented on Dec 28, 2015

    @ddemidov
    Member

    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.

  13. rhempel commented on Jan 2, 2016

    @rhempel
    Member

    @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.

  14. marev3 commented on Jan 3, 2016

    @marev3
    Author

    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.

  15. reopened this on Jan 3, 2016
  16. marev3 commented on Jan 3, 2016

    @marev3
    Author

    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'

  17. ddemidov commented on Jan 3, 2016

    @ddemidov
    Member

    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/*/address
  18. marev3 commented on Jan 3, 2016

    @marev3
    Author

    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.

    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

    BTW I am using the latest build of ev3dev.

  19. ddemidov commented on Jan 3, 2016

    @ddemidov
    Member

    Looks like duplicate of #96

  20. dwalton76 commented on Sep 14, 2016

    @dwalton76
    Collaborator

    Closing since this is a dup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions