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

Strange behavior if script is in a subdirectory #50

Closed
mwichmann opened this issue Apr 27, 2020 · 3 comments
Closed

Strange behavior if script is in a subdirectory #50

mwichmann opened this issue Apr 27, 2020 · 3 comments

Comments

@mwichmann
Copy link

mwichmann commented Apr 27, 2020

Trying this on a project which has a runner script which tries to find an "engine" (essentially a module) in various different places to support both running from an installed location and from inside the source tree for development. scalene is doing something odd behind the scenes which breaks this project's logic. Quick example to illustrate:

scripts/foo.py:

import os

print(__file__)
print(os.path.realpath(__file__))

Results:

$ python3 scripts/foo.py
scripts/foo.py
/tmp/scripts/foo.py   # <- as expected
$ python3 -m scalene scripts/foo.py
scripts/foo.py
/tmp/scripts/scripts/foo.py  # <- the extra /scripts is problematic
@emeryberger
Copy link
Member

Thanks for the report! Just committed a fix - please pull again (or pip install scalene -U) to confirm that this fixes it.

@mwichmann
Copy link
Author

It does fix the example described, thanks! (I still can't run it on my project though, so there's something else going on, will investigate later)

@emeryberger
Copy link
Member

Ok, sounds good - please let me know if you track down the issue or narrow it down to something I can test.

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

2 participants