ArjenR49 / UPS-Plus

Scripts for a 52Pi UPS plus v.5
14 stars 2 forks source link

Throws error when UPS+ directory doesn't exist #3

Closed suhajda3 closed 2 years ago

suhajda3 commented 3 years ago

Scripts UPS_report.py and upsPlus.py throws an error when UPS+ directory doesn't exist:

Traceback (most recent call last):
  File "UPS_report.py", line 58, in <module>
    f = open(PATH+'PowerOffLimit.txt','rt')
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/UPS+/PowerOffLimit.txt' 

I suggest updating them to create the directory if it doesn't exist.

Great and very useful work. Thanks! 🙏

ArjenR49 commented 3 years ago

Sorry, but i usually create directories etc. manually and don't bother to write code for things done only once. It's obvious from the error that a directory needs to be created.

Also while I manage to upload files to GitHub just fine, i haven't really studied the fancy & complex ways it's supposed to be used. Pull requests, forking, project directories on my own laptop etc. I have an idea what it means, but not quite my cup of tea. To me GitHub is free storage in the web to upload some files that I don't mind sharing for others to use. I don't have my own web server to do that.

One day you find something on the web, like instructions, next day they're gone, so I usually copy essentials, which I have used myself, in some form or shape to my own laptop and keep backups.

Arjen (On The Road)

Op za 23 okt. 2021 15:27 schreef suhajda3 @.***>:

Scripts UPS_report.py and upsPlus.py throws an error when UPS+ directory doesn't exist:

Traceback (most recent call last):

File "UPS_report.py", line 58, in

f = open(PATH+'PowerOffLimit.txt','rt')

FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/UPS+/PowerOffLimit.txt'

I suggest updating them to create the directory if it doesn't exist.

Great and very useful work. Thanks! 🙏

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ArjenR49/UPS-Plus/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANCBKNTCLT5EIUPN4L7CLNTUIKZ37ANCNFSM5GSI5TWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

hellresistor commented 2 years ago

@ArjenR49 friend, i think that file not exists on repository PowerOffLimit.txt

root@FIFUrpi:~/UPS-Plus# python3 UPS_report.py
*** Data from INA219 at 0x40:
Raspberry Pi supply voltage:                         4.900 V
Raspberry Pi current consumption:                    2.280 A
Raspberry Pi power consumption:                     11.100 W

*** Data from INA219 at 0x45:
Battery voltage:                                     4.190 V
Battery current (charging):                          0.010 A
Power supplied to the batteries:                     0.039 W

Traceback (most recent call last):
  File "/root/UPS-Plus/UPS_report.py", line 58, in <module>
    f = open(PATH+'PowerOffLimit.txt','rt')
FileNotFoundError: [Errno 2] No such file or directory: '/root/UPS-Plus/PowerOffLimit.txt'