texadactyl / rpi_clock

Raspberry Pi Clock & Weather display
GNU General Public License v3.0
13 stars 8 forks source link

'Path' has no attribute 'home' #8

Closed tpzahm closed 5 years ago

tpzahm commented 5 years ago

Here's the problem (from the command line): pi@raspberrypi:~/rpi_clock/bin $ python3 rpi_clock.py rpi_clock.cfg Traceback (most recent call last): File "rpi_clock.py", line 15, in parms = RpiClockParameters() File "/home/pi/rpi_clock/bin/rpi_clock_parameters.py", line 64, in init home = str(Path.home()) AttributeError: type object 'Path' has no attribute 'home'

I'm at Python 3.4. I tried pointing the symlink 'python' in usr/bin to 'python3', but that didn't help.

The project looks great. I hope to use it.

texadactyl commented 5 years ago

The the symlink 'python' in usr/bin has nothing to do with this issue. I would strongly advise you to put it back the way it was.

Path.home() has been introduced in Python 3.5. It looks like your Raspbian is slightly behind. I would suggest upgrading your Python3 to latest version e.g. sudo apt -y update; sudo apt -y dist-upgrade; sudo apt -y autoremove

That should get you to Python 3.5.something. If, for some reason, it does not, then reinstall your RPi with the latest Raspbian as indicated in the docs/preparation_notes.txt instructions or (not recommended) you could hard-code the home directory to /home/pi in /home/pi/rpi_clock/bin/rpi_clock_parameters.py, line 64.

Thank you for raising this issue. Let me know how this works out for you.

texadactyl commented 5 years ago

I just updated rpi_clock/bin/rpi_clock_parameters.py to avoid this error so a 3rd option is to get a fresh copy.

tpzahm commented 5 years ago

Thanks.

I’ve got a couple of little problems still, (including that the highest version of Python available is 3.4), but I’m much closer.

BTW, one of the little hiccups I’ve worked through is that most of the variables that the instructions say to set needed to be surrounded by single quotes. For Example, LOCATION = 'zip=75248,us’

On Jun 13, 2019, at 7:42 AM, Richard Elkins notifications@github.com wrote:

I just updated rpi_clock/bin/rpi_clock_parameters.py to avoid this error so a 3rd option is to get a fresh copy.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

texadactyl commented 5 years ago

The surround by quotes should cause a semantic error at the server: 400 Nothing to geocode

I am using LOCATION = zip=75248,us and not having any errors.
Also works: LOCATION = q=London What is your LOCATION statement?

When I perform the apt operations that I recommended earlier, my Python3 version is upgraded to 3.5.3. Did you try this? Are you using Raspbian?

tpzahm commented 5 years ago

Noobie me!

I didn’t have to quote the parameters — I just had to put them in the right file. BTW, I’d suggest you change the file reference in you otherwise wonderful preparation_notes

With head hanging, Tom Zahm

Begin forwarded message:

From: Thomas Zahm tpzahm@yahoo.com Subject: Re: [texadactyl/rpi_clock] 'Path' has no attribute 'home' (#8) Date: June 15, 2019 at 9:33:09 PM PDT To: texadactyl/rpi_clock reply@reply.github.com

Thanks.

I’ve got a couple of little problems still, (including that the highest version of Python available is 3.4), but I’m much closer.

BTW, one of the little hiccups I’ve worked through is that most of the variables that the instructions say to set needed to be surrounded by single quotes. For Example, LOCATION = 'zip=75248,us’

On Jun 13, 2019, at 7:42 AM, Richard Elkins notifications@github.com wrote:

I just updated rpi_clock/bin/rpi_clock_parameters.py to avoid this error so a 3rd option is to get a fresh copy.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

texadactyl commented 5 years ago

No need apologize.

Periodically, do this so that your RPi stays up-to-date: sudo apt -y update; sudo apt -y dist-upgrade; sudo apt -y autoremove You could put it into a Bash script.

Which "file reference" are you talking about? Something broken or misleading?

tpzahm commented 5 years ago

In “preparation_notes.txt” you write:

Edit $HOME/rpi_clock/bin/rpi_clock.py:

    LOCATION = your location
        # I live in USA zip code 75248 so my specification was this:
        # LOCATION = zip=75248,us
        ...

In fact, those lines need to be added to "$HOME/rpi_clock/bin/rpi_clock_parameters.py”

On Jun 17, 2019, at 5:13 AM, Richard Elkins notifications@github.com wrote:

No need apologize. Which "file reference" are you talking about?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

texadactyl commented 5 years ago

Thank you. I missed a spot in the preparation notes after I externalized all of the configuration parameters out of rpi_clock.py and into a new file, rpi_clock.cfg.

The file rpi_clock_parameters.py is a class defining the parameters so they can be accessed by rpi_clock.py. This file should not be edited. Edit rpi_clock.cfg.

tpzahm commented 5 years ago

I did and it’s working great. Thanks again.

On Jun 20, 2019, at 5:44 AM, Richard Elkins notifications@github.com wrote:

Thank you. I missed a spot in the preparation notes after I externalized all of the configuration parameters out of rpi_clock.py and into a new file, rpi_clock.cfg.

The file rpi_clock_parameters.py is a class defining the parameters so they can be accessed by rpi_clock.py. It should not be edited. Edit rpi_clock.cfg.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.