I have created a function configure_propeties() in configure.py that I'm trying to call in a bash script using the following command:
python3.6 -c "import configure; print configure.configure_properties()"
After executing the the bash script I get the following warning:
Both the script and configure.py are in the same directory. Not sure what's happening it doesn't seem to fail on the import. Has anyone seen this issue before?
-
I feel like this must be a duplicate questionuser11553043– user115530432020年05月21日 22:22:03 +00:00Commented May 21, 2020 at 22:22
-
Don't put text in images. Post its text.Cyrus– Cyrus2020年05月21日 22:23:52 +00:00Commented May 21, 2020 at 22:23
2 Answers 2
print "blabla" its only available in python 2, with python 3 you have to use parentheses print("blabla"), it would be better to set your python script inside .py file, just make sure the python executable is in your PATH environment variable then add in your script
python3 path/to/the/python_script.py
In the bash script file bashFile.sh, put this :
#!/bin/bash
python3 path/to/the/python_script.py
then you can execute your bash file bashFile.sh :
bash path/to/bashFile.sh
Comments
Use parentheses for print, as is necessary for Python 3