Ampy failure

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
flyingbits
Posts: 2
Joined: Fri Nov 25, 2016 1:57 pm

Ampy failure

Post by flyingbits » Fri Nov 25, 2016 2:13 pm

Hello I am a newbie
I am trying to get ampy to work with a feather huzzah. The serial connection is working(Putty terminal connects). I installed rshell as well but that did not work either. Any suggestions on where I am going wrong or another suitable path? You help is greatly appreciated.

Window 7
Python 2.7.12
feather Huzzah esp3286


C:\Python27>pip install adafruit-ampy
Collecting adafruit-ampy
Using cached adafruit_ampy-0.6.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): pyserial in c:\python2
7\lib\site-packages (from adafruit-ampy)
Collecting click (from adafruit-ampy)
Using cached click-6.6-py2.py3-none-any.whl
Installing collected packages: click, adafruit-ampy
Successfully installed adafruit-ampy-0.6.2 click-6.6
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.


C:\Python27>ampy --help
Usage: ampy [OPTIONS] COMMAND [ARGS]...

ampy - Adafruit MicroPython Tool

Ampy is a tool to control MicroPython boards over a serial connection.
Using ampy you can manipulate files on the board's internal filesystem
and even run scripts.

Options:
-p, --port PORT Name of serial port for connected board. Can optionally
specify with AMPY_PORT environemnt variable. [required]
-b, --baud BAUD Baud rate for the serial connection (default 115200). Can
optionally specify with AMPY_BAUD environment variable.
--version Show the version and exit.
--help Show this message and exit.

Commands:
get Retrieve a file from the board.
ls List contents of a directory on the board.
mkdir Create a directory on the board.
put Put a file on the board.
reset Perform soft reset/reboot of the board.
rm Remove a file from the board.
run Run a script and print its output.



C:\Python27>ampy --port com5 put test.py
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\ampy.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\click\core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "c:\python27\lib\site-packages\click\core.py", line 696, in main
rv = self.invoke(ctx)
File "c:\python27\lib\site-packages\click\core.py", line 1057, in invoke
Command.invoke(self, ctx)
File "c:\python27\lib\site-packages\click\core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python27\lib\site-packages\click\core.py", line 534, in invoke
return callback(*args, **kwargs)
File "c:\python27\lib\site-packages\ampy\cli.py", line 50, in cli
_board = pyboard.Pyboard(port, baudrate=baud)
File "c:\python27\lib\site-packages\ampy\pyboard.py", line 143, in __init__
raise PyboardError('failed to access ' + device)
ampy.pyboard.PyboardError: failed to access com5

C:\Python27>ampy --port com5 run test.py
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\ampy.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\click\core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "c:\python27\lib\site-packages\click\core.py", line 696, in main
rv = self.invoke(ctx)
File "c:\python27\lib\site-packages\click\core.py", line 1057, in invoke
Command.invoke(self, ctx)
File "c:\python27\lib\site-packages\click\core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python27\lib\site-packages\click\core.py", line 534, in invoke
return callback(*args, **kwargs)
File "c:\python27\lib\site-packages\ampy\cli.py", line 50, in cli
_board = pyboard.Pyboard(port, baudrate=baud)
File "c:\python27\lib\site-packages\ampy\pyboard.py", line 143, in __init__
raise PyboardError('failed to access ' + device)
ampy.pyboard.PyboardError: failed to access com5

C:\Python27>

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Ampy failure

Post by platforma » Fri Nov 25, 2016 4:42 pm

I think you will find that little users here use ampy tool. So perhaps it's best to ask in the adafruit community?

bitninja
Posts: 116
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: Ampy failure

Post by bitninja » Fri Nov 25, 2016 5:01 pm

I use ampy all the time for my Wemos D1 Minis and Witty Cloud boards.

I am running Windows 10 with Python 3 though.

Are you disconnecting puTTY before you attempt the ampy commands? Ampy does not work if the comm port is already open.

User avatar
Roberthh
Posts: 1740
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Ampy failure

Post by Roberthh » Fri Nov 25, 2016 5:06 pm

Did you install pyserial too?

Code: Select all

pip install pyserial

flyingbits
Posts: 2
Joined: Fri Nov 25, 2016 1:57 pm

Re: Ampy failure

Post by flyingbits » Fri Nov 25, 2016 9:23 pm

Bitninja - I appreciate you help, I closed putty and it worked. Thanks for saving a lot of time and frustration.

Platforma - what method would you suggest for moving files instead of ampy?

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Ampy failure

Post by platforma » Mon Nov 28, 2016 9:29 am

Glad to hear you got it to work!

There's a tool made by Wendlers: https://github.com/wendlers/mpfshell
And of course Dave's rshell: https://github.com/dhylands/rshell

Probably the two popular choices at the moment.

Post Reply