When I go to my environment directory and do “source name_Env/bin/activate” (without quotes ofcourse) it activates like normal and I can run script.py without getting configparser errors. But with doing that in bash it seems like it doesnt know the path to the activate file / the activate file
#! /bin/bash source name_Env/bin/activate # virtualenv is now active. # python script.py
When i try to run it with either “source bashScript.bash” or “bash bashScript.bash” I get the errors: source: No such file or directoryctivate bash: No such file or directory line 2: name_Env/bin/activate and the python configparser error.
The weird thing is that when i type the same thing manually everything works fine but in the bash file not. Is there something wrong in the bash file has it something to do with something else?
(the reason I am using bash file is because I think you cant open a virtualenv in a cronjob but you can link to a file that opens one and runs script)
/root /environments bashScript.bash script.py /random directories /name_Env /bin activate
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!