I really tried to find an answer to my problem but couldn't find one, so I hope I didn't double post.
I am running a raspberry pi using debian and python27. After boot up I run a script which determines some general variables I will need for other scripts. I need this variables in different scripts because they are running during different times using crontab. Normally after the boot up the script is done and I have all my necessary variables in a text file. I can access from all different other scripts to this text file. But know I try to avoid to corrupt my SD card of my raspberry and I want to use the read-only mode. Is there an opportunity to use variables which are created/changed by a python script without using a text file? I could also run a script with an infinite loop, but I try to avoid this.
Any other suggestions? Is it possible to use environmental variables?
Thanks for every answer!
Max
Edit1: Thanks for the suggestion the answer from adrianX, but I tried this small example and it doesn't work:
script1:
import os
os.environ["variable1"] = "value1"
After executing the script1, I run the second script.
script2:
import os
print os.environ.get["variable1"]
But this doesn't work? Maybe my question wasn't clear enough?
非python特定的解决方案是: http : //www.domoticz.com/wiki/Setting_up_a_RAM_drive_on_Raspberry_Pi并将文件写入/ var / tmp,该文件当然会在重启后消失。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.