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

calling pyocd flash with file that does not exists causes unexpected exception #590

Closed
jupe opened this issue Mar 25, 2019 · 2 comments
Closed
Assignees
Labels

Comments

@jupe
Copy link

jupe commented Mar 25, 2019

In above case payload_NUCLEO_L073RZ.hex file does not exists in given folder so assuming cli API would return with proper error message. Now behaviour are totally unexpected because there is no any mention about missing file.

$ pyocd flash --pack ~/Downloads/Keil.STM32L0xx_DFP.2.0.1.pack -t stm32l073rz ../bin/payload_NUCLEO_L073RZ.hex
0000707:INFO:pack_target:Loading CMSIS-Pack: /Users/jusvat01/Downloads/Keil.STM32L0xx_DFP.2.0.1.pack
0000969:ERROR:__main__:uncaught exception: local variable 'file_obj' referenced before assignment
Traceback (most recent call last):
  File /lib/python2.7/site-packages/pyocd/__main__.py", line 304, in run
    self._commands[self._args.cmd]()
  File "/lib/python2.7/site-packages/pyocd/__main__.py", line 379, in do_flash
    file_format=self._args.format)
  File "/lib/python2.7/site-packages/pyocd/flash/loader.py", line 138, in program
    file_obj.close()
UnboundLocalError: local variable 'file_obj' referenced before assignment
@jupe jupe added the bug label Mar 25, 2019
@flit flit added the to do label Mar 25, 2019
@flit
Copy link
Member

flit commented Mar 25, 2019

Thanks for the bug report. Will get to it quickly.

@flit
Copy link
Member

flit commented Mar 25, 2019

Depends on #587 being merged. Otherwise you just get a NameError for missing ArgumentError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants