0

This is a python script where I want to run start.py but it is not running. Can anyone help?

import numpy as np
import os

os.system("source ~/.bash_profile; python3 $XSPEGLIB/start.py")
AKU
  • 11
  • 2
  • Does this answer your question? [How do I execute a program or call a system command?](https://stackoverflow.com/questions/89228/how-do-i-execute-a-program-or-call-a-system-command) – Collin Matz Aug 22 '22 at 19:38
  • You can import the other python file then call the function directly https://stackoverflow.com/questions/67631/how-do-i-import-a-module-given-the-full-path – Patrick Aug 22 '22 at 19:38
  • usually the os.system command does the job (just tried it now on a personal script), can you show us the .bash profile and your python code in start.py ? – mrCopiCat Aug 22 '22 at 19:43
  • @CollinMatz , I tried but since it has source bash_profile. It is not working in a usual way. – AKU Aug 22 '22 at 19:43
  • @mrCopiCat , these two are different command. so if you want to run it in a terminal you simply give first source ~/.bash_profile , enter and then $XSPEGLIB/start.py. But I made this new script file where I want to run start.py by using os.system. – AKU Aug 22 '22 at 19:47
  • I guess you didn't understand my question, I know that these are two different commands, and i know what os.system does, im asking you to show us your code to fetch where the problem is :) – mrCopiCat Aug 22 '22 at 20:05
  • @mrCopiCat okay. that problem has been solved . os.system("bash xspeg") working fine but now I have one more problem that, when I directly run python3 start.py from the terminal, I see the output but with script that I don't see it. – AKU Aug 22 '22 at 20:18

0 Answers0