Forums

bash file only run from home directory?

Is bash file only can run from the home directory? no problem for a bash to run form home but it has issue when run from /home/user/abc

python: can't open file 'ya_panda_nasdaq.py': [Errno 2] No such file or directory

Also, the same problem found when I a bash from home directory which in the script I call another bash file from /home/user/abc/run.sh as [Errno 2] No such file or directory shown

You can run any script from anywhere, but you do need to specify the full path -- to run /home/username/yourscript.py from inside /home/username/abc/ you can't just do python yourscript.py, you have to do python /home/username/yourscript.py.

Similarly, if you're running a bash script in /home/username that does python yourscript.py inside it, and you're not running it from /home/username then you'll need to change the bash script to explicitly specify that you want to run python /home/username/yourscript.py.

If that doesn't help, perhaps you could give some more details about what you're trying to do and what happens?