Posts: 9
Joined: Sun Sep 03, 2017 1:21 pm

[b]Help Needed with PiClock[/b]

Sun Sep 03, 2017 1:33 pm

Hi All

Although I've been playing around with the Raspberry Pi since version 2 B+, Mostly for media centre work. I've now set myself a project of building a clock with weather forecast, later I will hopefully add a 7 inch screen and have in permenantly mounted in my office.

Anyway. The reason Im posting is after following Kevin Nobel's Project which looks ideal for what I need, Ive run into a few problems and chant find anything to resolve the issues

Here is the log file that Ive created
Traceback (most recent call last):
File "PyQtPiClock.py", line 712, in <module>
Config = __import__(configname)
File "/home/pi/PiClock/Clock/Config.py", line 12, in <module>
primary_location = LatLng(53.871567[0],-1.695773 [1])
TypeError: 'float' object has no attribute '__getitem__'
I've looked everywhere that I can think of, but don't know how to rectify the issues, Can anybody help?

User avatar
Posts: 5888
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: [b]Help Needed with PiClock[/b]

Mon Sep 04, 2017 1:25 pm

My limited knowledge of Python suggest that writing 53.871567[0] looks like your trying to access item 0 in an array but a (float) number is not an array.
This explains : "TypeError: 'float' object has no attribute '__getitem__' "

But why you get this if you just have copied someone elses code that is beyond me, difference version of Python maybe ?

Posts: 9961
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: [b]Help Needed with PiClock[/b]

Mon Sep 04, 2017 5:39 pm

topguy wrote:
Mon Sep 04, 2017 1:25 pm
But why you get this if you just have copied someone elses code that is beyond me, difference version of Python maybe ?
Probably entered something wrong in a config file.
One of the examples is https://github.com/n0bel/PiClock/blob/m ... Example.py

To OP: can you post the file config.py (using code tags; see viewtopic.php?f=32&t=84477 )
It looks like you entered the coordinates on line 12. They should be entered in line 8.

User avatar
Posts: 36308
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Help Needed with PiClock

Mon Sep 04, 2017 5:54 pm

What's in ~/PiClock/Clock/PyQtPiClock.*.log
My config looks like ~/PiClock/Clock/Config-Example-London.py but with my local co-ordinates.

Remember it runs with python2 not python3.

Lines 5 onwards in Config.py need to look like

Code: Select all

# Further radar configuration (zoom, marker location) can be
# completed under the RADAR section
primary_coordinates = 53.871567,-1.695773  # Change to your Lat/Lon

wuprefix = 'http://api.wunderground.com/api/'
wulocation = LatLng(primary_coordinates[0], primary_coordinates[1])
primary_location = LatLng(primary_coordinates[0], primary_coordinates[1])
noaastream = '???'
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Troubleshooting”