Page 1 of 1

use of pyboard.py tools module with idle3

Posted: Thu Jun 08, 2017 3:31 am
by katesfb
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.

Re: use of pyboard.py tools module with idle3

Posted: Sun Jun 18, 2017 10:33 pm
by katesfb
anybody?

Re: use of pyboard.py tools module with idle3

Posted: Mon Jun 19, 2017 6:43 am
by pythoncoder
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.