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

Fix pyocd flash error for invalid file #591

Merged
merged 1 commit into from
Mar 25, 2019

Conversation

flit
Copy link
Member

@flit flit commented Mar 25, 2019

When calling pyocd flash with an invalid path you'd get a less than helpful exception about file_obj not being defined. This PR reworks FileProgrammer error checking so FileNotFoundError is raised if the given path is invalid. A couple other issues are also addressed, including the cause of the file_obj exception.

Closes #590

- Initial check if the file path is valid. If not, FileNotFoundError is
  raised.
- Explicit check for no file extension if file_format is not set.
- Defined file_obj local var prior to try/finally and check that it's
  not None before closing it.
- Added FileNotFoundError class for Py2 to pyocd.utility.compatibilty.
@flit
Copy link
Member Author

flit commented Mar 25, 2019

/morph test

@flit flit merged commit e8bd2ff into pyocd:master Mar 25, 2019
@flit flit removed the in progress label Mar 25, 2019
@flit flit deleted the bugfix/flash_invalid_file branch March 25, 2019 20:31
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

Successfully merging this pull request may close these issues.

1 participant