program called twice from the command line [on hold]
up vote
1
down vote
favorite
Let's say I have a (Python3) script of my own named myscript; for various reasons, myscript (not myscript.py) is stored in a sub-directory named bin :
mydir/
mydir/bin/
mydir/bin/myscript -rwxr-xr-x
myscript begins with the usual shebang line, namely :
#!/usr/bin/env python3
When I'm in mydir/, I call my script this way:
$ ./bin/myscript
The result is tantalizing (to me !), myscript being called twice ! I get something like:
sh: 1: myscript: not found
*** specific message defined in myscript ***
The first line is clearly a sign that the shell tries to find a command named myscript. The second line is what I wrote in myscript.
Why is my script called twice ?
shell command-line python command
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as unclear what you're asking by Rui F Ribeiro, glenn jackman, Jeff Schaller, Michael Homer, msp9011 yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
1
down vote
favorite
Let's say I have a (Python3) script of my own named myscript; for various reasons, myscript (not myscript.py) is stored in a sub-directory named bin :
mydir/
mydir/bin/
mydir/bin/myscript -rwxr-xr-x
myscript begins with the usual shebang line, namely :
#!/usr/bin/env python3
When I'm in mydir/, I call my script this way:
$ ./bin/myscript
The result is tantalizing (to me !), myscript being called twice ! I get something like:
sh: 1: myscript: not found
*** specific message defined in myscript ***
The first line is clearly a sign that the shell tries to find a command named myscript. The second line is what I wrote in myscript.
Why is my script called twice ?
shell command-line python command
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as unclear what you're asking by Rui F Ribeiro, glenn jackman, Jeff Schaller, Michael Homer, msp9011 yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
I'm assuming something inside the script is trying to execute something calledmyscriptusingsystem()(or whatever other similar facility Python has), but fails.
– Kusalananda
2 days ago
1
Could you provide a Minimal Working Example (MWE)?
– cryptarch
2 days ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Let's say I have a (Python3) script of my own named myscript; for various reasons, myscript (not myscript.py) is stored in a sub-directory named bin :
mydir/
mydir/bin/
mydir/bin/myscript -rwxr-xr-x
myscript begins with the usual shebang line, namely :
#!/usr/bin/env python3
When I'm in mydir/, I call my script this way:
$ ./bin/myscript
The result is tantalizing (to me !), myscript being called twice ! I get something like:
sh: 1: myscript: not found
*** specific message defined in myscript ***
The first line is clearly a sign that the shell tries to find a command named myscript. The second line is what I wrote in myscript.
Why is my script called twice ?
shell command-line python command
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Let's say I have a (Python3) script of my own named myscript; for various reasons, myscript (not myscript.py) is stored in a sub-directory named bin :
mydir/
mydir/bin/
mydir/bin/myscript -rwxr-xr-x
myscript begins with the usual shebang line, namely :
#!/usr/bin/env python3
When I'm in mydir/, I call my script this way:
$ ./bin/myscript
The result is tantalizing (to me !), myscript being called twice ! I get something like:
sh: 1: myscript: not found
*** specific message defined in myscript ***
The first line is clearly a sign that the shell tries to find a command named myscript. The second line is what I wrote in myscript.
Why is my script called twice ?
shell command-line python command
shell command-line python command
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 2 days ago
Rui F Ribeiro
38.6k1479128
38.6k1479128
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 days ago
suizokukan
1084
1084
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
suizokukan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as unclear what you're asking by Rui F Ribeiro, glenn jackman, Jeff Schaller, Michael Homer, msp9011 yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by Rui F Ribeiro, glenn jackman, Jeff Schaller, Michael Homer, msp9011 yesterday
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
I'm assuming something inside the script is trying to execute something calledmyscriptusingsystem()(or whatever other similar facility Python has), but fails.
– Kusalananda
2 days ago
1
Could you provide a Minimal Working Example (MWE)?
– cryptarch
2 days ago
add a comment |
1
I'm assuming something inside the script is trying to execute something calledmyscriptusingsystem()(or whatever other similar facility Python has), but fails.
– Kusalananda
2 days ago
1
Could you provide a Minimal Working Example (MWE)?
– cryptarch
2 days ago
1
1
I'm assuming something inside the script is trying to execute something called
myscript using system() (or whatever other similar facility Python has), but fails.– Kusalananda
2 days ago
I'm assuming something inside the script is trying to execute something called
myscript using system() (or whatever other similar facility Python has), but fails.– Kusalananda
2 days ago
1
1
Could you provide a Minimal Working Example (MWE)?
– cryptarch
2 days ago
Could you provide a Minimal Working Example (MWE)?
– cryptarch
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
@Kusalananda mentioned that it's possible your script is calling myscript using system(). When you call with system I would guess the containing directory of myscript is not in the $PATH variable of the shell at that point, so you would need to pass the full path of myscript, not the relative path.
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
You're 100% right... My script checks if it's already installed by calling...os.system(myscript --version)...
– suizokukan
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
@Kusalananda mentioned that it's possible your script is calling myscript using system(). When you call with system I would guess the containing directory of myscript is not in the $PATH variable of the shell at that point, so you would need to pass the full path of myscript, not the relative path.
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
You're 100% right... My script checks if it's already installed by calling...os.system(myscript --version)...
– suizokukan
yesterday
add a comment |
up vote
1
down vote
accepted
@Kusalananda mentioned that it's possible your script is calling myscript using system(). When you call with system I would guess the containing directory of myscript is not in the $PATH variable of the shell at that point, so you would need to pass the full path of myscript, not the relative path.
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
You're 100% right... My script checks if it's already installed by calling...os.system(myscript --version)...
– suizokukan
yesterday
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
@Kusalananda mentioned that it's possible your script is calling myscript using system(). When you call with system I would guess the containing directory of myscript is not in the $PATH variable of the shell at that point, so you would need to pass the full path of myscript, not the relative path.
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
@Kusalananda mentioned that it's possible your script is calling myscript using system(). When you call with system I would guess the containing directory of myscript is not in the $PATH variable of the shell at that point, so you would need to pass the full path of myscript, not the relative path.
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 2 days ago
Addison Grant
313
313
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Addison Grant is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
You're 100% right... My script checks if it's already installed by calling...os.system(myscript --version)...
– suizokukan
yesterday
add a comment |
1
You're 100% right... My script checks if it's already installed by calling...os.system(myscript --version)...
– suizokukan
yesterday
1
1
You're 100% right... My script checks if it's already installed by calling...
os.system(myscript --version)...– suizokukan
yesterday
You're 100% right... My script checks if it's already installed by calling...
os.system(myscript --version)...– suizokukan
yesterday
add a comment |
1
I'm assuming something inside the script is trying to execute something called
myscriptusingsystem()(or whatever other similar facility Python has), but fails.– Kusalananda
2 days ago
1
Could you provide a Minimal Working Example (MWE)?
– cryptarch
2 days ago