Git Product home page Git Product logo

Comments (11)

Fing086 avatar Fing086 commented on September 20, 2024 1

To get the error I just cd to the dir and type python store_data.py
I cant show any output as all I get is the error.

I SSH from Mac terminal as well if that changes anything.

from pi-eco-indicator.

Fing086 avatar Fing086 commented on September 20, 2024 1

Ah, I was only running through python to export (>>) to the text file.
However, ive just tried it again and now get

Working in Octopus Agile import mode.
Agile version set: £1 cap, new-new formula (current)
Selected region G
Connected to database...
API request successful, status 200.
100 prices were inserted, ending at 22:00 on Saturday 17 Jun.
1 unneeded data points from the past were deleted.

As said earlier, it does seem to be working now so not sure why the graph messed up previously.

I assume that even with this change, the crontab script will still auto run the software when needed?

from pi-eco-indicator.

Fing086 avatar Fing086 commented on September 20, 2024 1

Ill try and get the time to have a look, always difficult looking at someone elses code but ill certainly see what I can do :)

from pi-eco-indicator.

jerbzz avatar jerbzz commented on September 20, 2024

Hello. It sounds very much like your installation isn't updating its database, for whatever reason.

Please could you show me the output of ./store_data.py and crontab -l as well as the contents of eco_indicator.log?

Please surround any text you paste in backticks ` so that it formats clearly :)

from pi-eco-indicator.

Fing086 avatar Fing086 commented on September 20, 2024

I left it going all day today and then at some point the graph returned and has been there ever since with no issues.

crontab -l gives me:

@reboot /bin/sleep 40; /usr/bin/python3 /home/pi/pi-eco-indicator/update_display.py > /home/pi/pi-eco-indicator/eco_indicator.log 2>&1
*/30 * * * * /bin/sleep 5; /usr/bin/python3 /home/pi/pi-eco-indicator/update_display.py > /home/pi/pi-eco-indicator/eco_indicator.log 2>&1
57 16 * * * /usr/bin/python3 /home/pi/pi-eco-indicator/store_data.py > /home/pi/pi-eco-indicator/eco_indicator.log 2>&1
57 18 * * * /usr/bin/python3 /home/pi/pi-eco-indicator/store_data.py > /home/pi/pi-eco-indicator/eco_indicator.log 2>&1
57 20 * * * /usr/bin/python3 /home/pi/pi-eco-indicator/store_data.py > /home/pi/pi-eco-indicator/eco_indicator.log 2>&1

Also just tried to run store_data.py manually to export output to a text file and I got the following in terminal:

  File "/home/pi/pi-eco-indicator/store_data.py", line 215, in <module>
    os.chdir(os.path.dirname(sys.argv[0]))
FileNotFoundError: [Errno 2] No such file or directory: ''

However when I reboot the pi, it auto runs and runs fine :)
Hope that all helps in some way

from pi-eco-indicator.

jerbzz avatar jerbzz commented on September 20, 2024

You need the backtick, the one to the left of the number 1 key, below Esc :) I've edited your post to fix that.

OK so we definitely have an error when running store_data.py...

Can you show me the entire sequence - the command you run as well as the output?

from pi-eco-indicator.

jerbzz avatar jerbzz commented on September 20, 2024

Ah, I see! I (and the instructions) invoke it via ./store_data.py as the script is marked as executable.

However it is entirely legit to invoke it as python store_data.py.

Can you edit store_data.py for me, changing line 215 from

os.chdir(os.path.dirname(sys.argv[0]))

to

os.chdir(sys.path[0])

and see if that fixes your issue? :)

from pi-eco-indicator.

jerbzz avatar jerbzz commented on September 20, 2024

Hmm, why do you need to export to a text file? Is that a useful feature for you?

Did you try it again with or without python?

Did you have a go at implementing my change? I'm testing it here to check it doesn't mess with the cron job, but I don't see any reason why it would.

When it is playing silly buggers, eco_indicator.log should be helpful.

The graph didn't mess up, it ran out of data, because store_data.py was failing. If the time at the top of the screen is correct (well, correct for the last 30 mins) then update_display.py is working fine. It's designed to be tolerant of missing data so it'll just display less and less until it runs out. Perhaps I should add a message on there that says "oops, no data!"

(triple backticks on the lines above and below your paste snippet will preserve the line breaks!)

from pi-eco-indicator.

Fing086 avatar Fing086 commented on September 20, 2024

Hmm, why do you need to export to a text file? Is that a useful feature for you?
Its just the way I have always grabbed output!

Tried it again with or without python?
Tried it with both and seems fine

Did you have a go at implementing my change? I'm testing it here to check it doesn't mess with the cron job, but I don't see any reason why it would.
Yes, and so far all seems great, the pi is resetting every 30 mins

The graph didn't mess up, it ran out of data, because store_data.py was failing. If the time at the top of the screen is correct (well, correct for the last 30 mins) then update_display.py is working fine. It's designed to be tolerant of missing data so it'll just display less and less until it runs out. Perhaps I should add a message on there that says "oops, no data!"

Possibly a good idea that as will stop it looking 'broken' and rather like its trying but not finding the data it needs.

(triple backticks on the lines above and below your paste snippet will preserve the line breaks!)
As you have probably guessed, quite new to all this GitHub stuff, but thankful for people like yourself who post on here with some great programs :)

from pi-eco-indicator.

jerbzz avatar jerbzz commented on September 20, 2024

Interesting, I just copy and paste straight from the terminal! Sounds like we have a fix for at least a partial issue, so I'll implement that now... do you fancy having a go at a "no data" message? 🤔

from pi-eco-indicator.

jerbzz avatar jerbzz commented on September 20, 2024

Fixed in 5335f1d

from pi-eco-indicator.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.