-
Notifications
You must be signed in to change notification settings - Fork 373
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
__main__.hy doesn't work like __main__.py #1466
Labels
Comments
Huh, I didn't even know this Python feature existed. #459 might be related. Thanks for reporting. |
Kodiologist
changed the title
Running a directory with __main__ from hy cmdline
__main__.hy doesn't work like __main__.py
Dec 16, 2017
This was referenced Feb 18, 2018
Closed
Merged
brandonwillard
added a commit
to brandonwillard/hy
that referenced
this issue
Aug 22, 2018
brandonwillard
added a commit
to brandonwillard/hy
that referenced
this issue
Aug 24, 2018
brandonwillard
added a commit
to brandonwillard/hy
that referenced
this issue
Aug 24, 2018
brandonwillard
added a commit
to brandonwillard/hy
that referenced
this issue
Aug 25, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(All snippets below tested with hy master and python 3.6.3)
When running a directory with a
__main__
file, hy fails while python succeeds:Same applies to egg files, but that may be its own independent problem.
Passing the
-m
flag does execute the__main__
, unlike python:Fixing the first block is relatively simple: In
cmdline
,run_module
already does the correct thing when running a directory/file according to the respective function in cpython.However, making the 2nd block fail is a breaking change, as
run_module
does not do the same thing as the respective function in cpython (wrapsrunpy._run_module_as_main
)In the end, the question may be is this worth fixing on a lower level? Does hy want to copy the behaviour of
run_file
andrun_module
as implemented in cpython, or is it good enough to be able to run a directory/zip/whatever with a__main__
?The text was updated successfully, but these errors were encountered: