False false returns

This one has me scratching my head. I have the following code in a script in a Raspberry Pi 4:
hologram = HologramCloud(credentials, network=‘cellular’)
result = hologram.network.connect(timeout=10)
if result == False:
print(‘Failed to connect to cell network’)
errlog=open("/home/pi/Prime/ErrLog.txt",“a+”)
errlog.write(‘Failed to connect to cell network: ’ + time.strftime("%c") +’||’)
errlog.close()
else:
print(‘Connected to Cell Network’)

If I run it from the command line no problem.
I also added it to the rc.local file to run on bootup.
When it runs that way it acts like it’s getting a “false” result but actually connects fine.
Same for this:
sent = hologram.sendMessage(messageD,topics=[“Digital”])
if sent == 48:
print(‘Digital sent to cloud’)
else:
errlog=open("/home/pi/Prime/ErrLog.txt",“a+”)
errlog.write("Error trying to send Digital. || ")
errlog.close()
The message gets sent fine, but logs as an error that it didn’t.
Any ideas on what might be happening?

Can you format the code, im assuming the tab delimiter is accurate in your code but I don’t want to rule it out.

the connect call should return either True or False, can you try logging the output of the result? The code looks fine assuming its formatted properly but its hard to tell whats going on from only the code.

btw, the 48 is a bug that is fixed in the next version we will be releasing as it will be a 0 as it was supposed to be.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.