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

Outputting to a directory instead of an existing file raises an exception #691

Closed
emeryberger opened this issue Sep 9, 2023 · 0 comments · Fixed by #800
Closed

Outputting to a directory instead of an existing file raises an exception #691

emeryberger opened this issue Sep 9, 2023 · 0 comments · Fixed by #800

Comments

@emeryberger
Copy link
Member

Describe the bug
Using an existing directory as the argument for --outfile (this was unintentional) led to an internal exception.

To Reproduce
Steps to reproduce the behavior:

  1. Create a directory foo
  2. Run Scalene as follows on any sufficiently long-lived Python program: scalene --cli --outfile foo prog.py
  3. See error, which will end with something like this:
IsADirectoryError: [Errno 21] Is a directory: '/Users/XXX/tmp/foo'

Minimum working example:
prog.py:

x = 1
for i in range(1_000_000):
    x += 1
print("Hello world")

Expected behavior
A more graceful exit. It might also be reasonable to check to make sure there is not an existing directory when the command is first launched.

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 a pull request may close this issue.

1 participant