use of pyboard.py tools module with idle3

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
katesfb
Posts: 22
Joined: Sun Dec 18, 2016 8:09 pm

use of pyboard.py tools module with idle3

Post by katesfb » Thu Jun 08, 2017 3:31 am

Hi,
I am trying to use the tools module pyboard.py with idle3 and it does seem to work but with a couple of weird things going on. See interactive session below:

Code: Select all

Python 3.4.3 (default, Nov 17 2016, 01:11:57) 
[GCC 4.8.4] on linux
Type "copyright", "credits" or "license()" for more information.
>>> import sys
>>> sys.path.append('/home/richard/Dev/Micropython/micropython-master/tools')
>>> sys.path.append('/home/richard/Dev/Micropython/micropython-master/tests/pyb')
>>> import pyboard
>>> pyboard.execfile('led.py')
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    pyboard.execfile('led.py')
  File "/home/richard/pyboard.py", line 354, in execfile
    pyb = Pyboard(device, baudrate, user, password)
  File "/home/richard/pyboard.py", line 229, in __init__
    raise PyboardError('failed to access ' + device)
pyboard.PyboardError: failed to access /dev/ttyACM0
>>> pyboard.execfile('led.py')
b'LED(1)\r\nLED(2)\r\nLED(3)\r\nLED(4)\r\n'
>>> 
The first weird thing is that the text output that occurs only occurs after the program has completed running (testing the leds) whereas it should appear first and does so if i run the command "python pyboard.py led.py" from the command line.
The 2nd weird thing is that the error related to failing to access /dev/ttyACM0 only occurs if i havent previously run the program from the command line.

Any ideas.

My reason for doing this is to write a small very simple tkinter GUI that will run a pyboard script from idle.

Any help is much appreciated.

Cheers.

katesfb
Posts: 22
Joined: Sun Dec 18, 2016 8:09 pm

Re: use of pyboard.py tools module with idle3

Post by katesfb » Sun Jun 18, 2017 10:33 pm

anybody?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: use of pyboard.py tools module with idle3

Post by pythoncoder » Mon Jun 19, 2017 6:43 am

pyboard.execfile buffers text from the running script and only outputs it on completion.

Regarding the serial port issue I can't replicate this under Linux. I have no means of testing under Windows but my guess is that it's a Windows issue. Perhaps a user will elaborate.
Peter Hinch
Index to my micropython libraries.

Post Reply