Issue to run script - Raspberry Pi Forums


hello,
create python script check if website alive.
program in 2 file:
(a) configuratio file.ini --> global_config.ini
(b) configuratio python script --> status-site.py

first python script load configuration file use "configparser" , execute rest of program.

configuration file in same folder of python script
give 2 file rood right
-rwxrwxrwx 1 root root 572 feb 16 09:56 global_config.ini
-rwxrwxrwx 1 root root 11744 feb 16 11:23 status-site.py


issue:
if run file outside of folder contain script :

root@raspberrypi:~# python3 /home/pi/myscript/status-site/status-site.py
script not running, tis erroro:

file "/home/pi/myscript/status-site/status-site.py", line 306, in <module>
runall()
file "/home/pi/myscript/status-site/status-site.py", line 232, in runall
inizializza() # prima funzione ad essere richimata
file "/home/pi/myscript/status-site/status-site.py", line 44, in inizializza
g_t_passato = float(config.get("global", "g_t_passato"))
file "/usr/lib/python3.4/configparser.py", line 754, in get
d = self._unify_values(section, vars)
file "/usr/lib/python3.4/configparser.py", line 1119, in _unify_values
raise nosectionerror(section)
configparser.nosectionerror: no section: 'global'

-------------------------------------------------
if run script inside script directory ir runs ok
root@raspberrypi:/home/pi/myscript/status-site# python3 status-site.py
-------------------------------------------------
yes working --> root@raspberrypi:/home/pi/myscript/status-site# python3 status-site.py
no not working --> root@raspberrypi:~# python3 /home/pi/myscript/status-site/status-site.py

im doing wrong ?
thanks

how passing path global_config.ini in status-site.py?

can post code?


raspberrypi



Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code