Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampy cannot execute some commands due to various errors #104

Open
eantropix opened this issue Jun 14, 2021 · 0 comments
Open

Ampy cannot execute some commands due to various errors #104

eantropix opened this issue Jun 14, 2021 · 0 comments

Comments

@eantropix
Copy link


I'm using an EVK_NINA_B1 board and can connect to it using picocom or Pymakr just fine, however Ampy has a few problems interacting with the board, for reasons I'm not sure. Due to the amount of faulty commands I am getting, I believe it could be some installation issue, but I find it unlikely given how easy it is to install Ampy, and that I've done it twice already.

Some Ampy commands do not work, giving out different errors.

Ampy commands that work: put, reset
Ampy commands that do not work: ls, get, mkdir, rm, run
Ampy commands that I could not test: rmdir (due to the fact that I could not get mkdir to run)

Contents of .ampy:

AMPY_PORT=/dev/ttyACM0
AMPY_BAUD=115200
AMPY_DELAY=2.0

What bothers me more are the SyntaxError's that I get, as if something is wrong with the main.py or the command I'm executing. I have tested that the main.py file works by using ampy put to insert the file in the board (which, for some reason, works) without any issues.

Errors:

ampy ls
Traceback (most recent call last):
  File "/home/aviana/.local/bin/ampy", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/cli.py", line 194, in ls
    for f in board_files.ls(directory, long_format=long_format, recursive=recursive):
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 176, in ls
    raise ex
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 169, in ls
    out = self._pyboard.exec_(textwrap.dedent(command))
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/pyboard.py", line 279, in exec_
    raise PyboardError('exception', ret, ret_err)
ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>"\r\nSyntaxError: invalid syntax\r\n')
ampy mkdir testdir
Traceback (most recent call last):
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 197, in mkdir
    out = self._pyboard.exec_(textwrap.dedent(command))
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/pyboard.py", line 279, in exec_
    raise PyboardError('exception', ret, ret_err)
ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>", in <module>\r\nNameError: name \'USBS\xd8\' isn\'t defined\r\n')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aviana/.local/bin/ampy", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/cli.py", line 156, in mkdir
    board_files.mkdir(directory, exists_okay=exists_okay)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 200, in mkdir
    if ex.args[2].decode("utf-8").find("OSError: [Errno 17] EEXIST") != -1:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 88: invalid continuation byte
ampy get main.py
Traceback (most recent call last):
  File "/home/aviana/.local/bin/ampy", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/cli.py", line 126, in get
    contents = board_files.get(remote_file)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 82, in get
    raise ex
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 74, in get
    out = self._pyboard.exec_(textwrap.dedent(command))
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/pyboard.py", line 279, in exec_
    raise PyboardError('exception', ret, ret_err)
ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>"\r\nSyntaxError: invalid syntax\r\n')
ampy rm sub.py 
Traceback (most recent call last):
  File "/home/aviana/.local/bin/ampy", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/cli.py", line 283, in rm
    board_files.rm(remote_file)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 251, in rm
    raise ex
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 240, in rm
    out = self._pyboard.exec_(textwrap.dedent(command))
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/pyboard.py", line 279, in exec_
    raise PyboardError('exception', ret, ret_err)
ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>"\r\nSyntaxError: invalid syntax\r\n')
ampy run sub.py
Traceback (most recent call last):
  File "/home/aviana/.local/bin/ampy", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/cli.py", line 338, in run
    output = board_files.run(local_file, not no_output, not no_output)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/files.py", line 309, in run
    self._pyboard.execfile(filename, stream_output=True)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/pyboard.py", line 285, in execfile
    return self.exec_(pyfile, stream_output=stream_output)
  File "/home/aviana/.local/lib/python3.8/site-packages/ampy/pyboard.py", line 279, in exec_
    raise PyboardError('exception', ret, ret_err)
ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>", in <module>\r\nNameError: name \'le\' isn\'t defined\r\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant