I want my autorun python script to write information into a text file.
This works fine when the python file is run from the Cloud9 interface, but
does not run properly when the beagleboard restarted.
The command that is failing is:
with open("/home/debian/logs/testlog.txt",'a',encoding = 'utf-8') as f:
f.write("bbb autorun test\n")
I am running Buster IoT Image 2020-04-06 on a beagle board black.
I have tried using chmod 666, chmod 755 etc, on the target file and
enclosing directory with no success.
I see a number of older threads about using chron, but these don't seem
applicable in light of having autorun.
Any idea what is preventing this script from writing to a file when it is
autorun? Is this a permissions issue and how would I change that?
Here's the whole file if it helps. Again, this runs in its entirety from
Cloud9. When it is in the autostart folder and the BBB is restarted, it
goes no further than turning on relay3.
Thanks in advance,
-Steve Lentz
#!/usr/bin/python3
#//////////////////////////////////////
#
# autorun test
#
#//////////////////////////////////////
#
#
import Adafruit_BBIO.GPIO as GPIO
import time
relay3 = "P9_30"
relay4 = "P9_27"
GPIO.setup(relay3, GPIO.OUT)
GPIO.setup(relay4, GPIO.OUT)
GPIO.output(relay3, GPIO.HIGH)
with open("/home/debian/logs/testlog.txt",'a',encoding = 'utf-8') as f:
f.write("bbb autorun test\n")
GPIO.output(relay4, GPIO.HIGH)
time.sleep(30)
GPIO.output(relay4, GPIO.LOW)
time.sleep(1)
GPIO.output(relay3, GPIO.LOW)
exit()
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/9d67ea91-542d-46fc-b961-cbb9bd736a5dn%40googlegroups.com.