question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parameter for script

See original GitHub issue

In 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:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
manfredlotzcommented, Jul 10, 2021

Looks good now. Thanks for you quick support.

0reactions
tusharsadhwanicommented, Jul 10, 2021

So I actually found two issues in this:

  • zxpy myscript.py /home was being treated as running two programs: zxpy myscript.py and zxpy /home. This is why it was crashing.

  • The __name__ value was actually wrong! That’s why zxpy myscript.py wasn’t doing anything. Otherwise it would’ve ran fine on the first command (as sys.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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found