Parameter for script
See original GitHub issueIn a bash or python script I could have parameters when calling it. This seems to be impossible when using zxpy.
Example:
myscript /home
gives
Traceback (most recent call last):
File "/home/manfred/.local/bin/zxpy", line 8, in <module>
sys.exit(cli())
File "/home/manfred/.local/lib/python3.8/site-packages/zx.py", line 54, in cli
with open(filename) as file:
IsADirectoryError: [Errno 21] Is a directory: '/home'
Is there a way I just overlooked?
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Shell Script Parameters - javatpoint
Shell Script Parameters ; $0, Represent name of the script ; $∗, Represent all the arguments as a single string ; $@, Same...
Read more >Adding arguments and options to your Bash scripts - Red Hat
Bash uses a tool called positional parameters to provide a means of entering data into a Bash program when it is invoked from...
Read more >Shell Script Parameters | Examples & Advantages - eduCBA
Shell Spscript parameters are the entities that are used to store variables in Shell. Among these parameters, the named spaces are there in...
Read more >Script Parameters
The parameters required by a script are specified using comments in the header. These are similar in format to the JavaDoc comments used...
Read more >How to Use Command Line Arguments in a Bash Script
Arguments passed to a script are processed in the same order in which they're sent. The indexing of the arguments starts at one,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks good now. Thanks for you quick support.
So I actually found two issues in this:
zxpy myscript.py /home
was being treated as running two programs:zxpy myscript.py
andzxpy /home
. This is why it was crashing.The
__name__
value was actually wrong! That’s whyzxpy myscript.py
wasn’t doing anything. Otherwise it would’ve ran fine on the first command (assys.argv[1]
was still/home
), and then crashed when it tried to run the second time.Anyway, both issues have now been fixed in v1.4.1.
Try running
pip install -U zxpy
and try your script again, and let me know if it works 😃