Skip to content

Conversation

@Bobronium
Copy link

Current version:

~
$ pyp "'pyp is running on ' + sys.executable" --explain > explained.py

~
$ perl explained.py
Traceback (most recent call last):
  File "/Users/bobronium/explained.py", line 3, in <module>
    from pyp import pypprint
ModuleNotFoundError: No module named 'pyp'

~
$ cat explained.py
#!/usr/bin/env python3
import sys
from pyp import pypprint
assert sys.stdin.isatty() or not sys.stdin.read(), "The command doesn't process input, but input is present"
output = 'pyp is running on ' + sys.executable
if output is not None:
    pypprint(output)

With these changes:

~
$ pyp "'pyp is running on ' + sys.executable" --explain > explained.py

~
$ perl explained.py
pyp is running on /Users/bobronium/.local/pipx/venvs/pypyp/bin/python

~
$ cat explained.py
#!/Users/bobronium/.local/pipx/venvs/pypyp/bin/python
import sys
from pyp import pypprint
assert sys.stdin.isatty() or not sys.stdin.read(), "The command doesn't process input, but input is present"
output = 'pyp is running on ' + sys.executable
if output is not None:
    pypprint(output)

@Bobronium Bobronium marked this pull request as draft July 20, 2022 22:26
@Bobronium
Copy link
Author

Sorry, I've been too lazy to clone it and test it properly. Just patched my installation to check that it's working as intended.

I'll update the tests soon and will request review when it'll be ready for one, in the meanwhile this should be a draft really.

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.

2 participants