×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

meteostationWEB no longer working due to python 3.8 on Ubuntu 20.04

  • Posts: 180
  • Thank you received: 30
Not sure, but Queue (the first one in Queue.Queue) could be a module name (check in imports). In py3 module names should be always in lowercase.
So wherever you see
import Queue

change it for:
import queue

and then:
self.receive_event_queue = queue.Queue()

If this does not work, I would need to give a look at the code. I need at least the module giving the error (indi client.py) or the url to the code.
Last edit: 3 years 6 months ago by Joaquin. Reason: Complete info
3 years 6 months ago #59900

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223
I've done as you said, now moving on to the next error...

<indiclient.indiclient object at 0xb6caeb80>
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 1254, in run
self.function(*self.args, **self.kwargs)
File "/home/heidenrod/meteostationWEB/indiclient.py", line 2138, in _receiver
self._receive()
File "/home/heidenrod/meteostationWEB/indiclient.py", line 2463, in _receive
self.expat.Parse( self.data,0)
File "../Modules/pyexpat.c", line 407, in StartElement
File "/home/heidenrod/meteostationWEB/indiclient.py", line 2532, in _start_element
obj=self._factory.create(name,attrs)
File "/home/heidenrod/meteostationWEB/indiclient.py", line 550, in create
return self.vectorclasses(attrs,inditag)
File "/home/heidenrod/meteostationWEB/indiclient.py", line 1213, in __init__
if attrs.has_key('message'):
AttributeError: 'dict' object has no attribute 'has_key'
Timeout MeteoStation DEVICE_PORT
Timeout MeteoStation DEVICE_PORT
Timeout MeteoStation DEVICE_PORT
Timeout MeteoStation DEVICE_PORT
Timeout MeteoStation DEVICE_PORT
Timeout MeteoStation DEVICE_PORT
Timeout MeteoStation DEVICE_PORT


the "Timeout MeteoStation DEVICE_PORT" is now scrolling quite fast...
3 years 6 months ago #59906

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223
If someone wants to have a go, the code is on my github repo github.com/Trigger-broom-289/indi-meteostation
3 years 6 months ago #59908

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223
Potentially solved !!!!
heidenrod@heidenrod-obs:~/meteostationWEB$ indi_weather: no process found
2020-09-14T08:03:29: startup: indi_weather -f /tmp/indi_weatherFIFO -p 7625 
2020-09-14T08:03:29: Driver indi_duino: Indiduino driver start...
2020-09-14T08:03:29: Driver indi_duino: Building from /usr/share/indi/meteostation_sk.xml skeleton
2020-09-14T08:03:29: Driver indi_duino: Using INDISKEL /usr/share/indi/meteostation_sk.xml
2020-09-14T08:03:29: Driver indi_duino: No ISwitch 'ENABLED' in MeteoStation.DEVICE_AUTO_SEARCH
2020-09-14T08:03:29: Driver indi_duino: No ISwitch 'ENABLED' in MeteoStation.DEVICE_AUTO_SEARCH
Starting internet data downloader
Retriving SKEW-T diagrams from: 10548
2020 09 1400
Fail to retrive internet data
Starting GRAPHER
Starting MinMax
('HR', 'Thr', 'IR', 'Tir', 'P', 'Tp', 'Dew', 'Light', 'T', 'clouds', 'skyT', 'cloudFlag', 'dewFlag', 'frezzingFlag')
(None, None, None, None, None, None, None, None, None, None, None, None, None, None)
MinMax FAIL
Starting UPDATER
Altitude= 310
Indi port= 7625
Indi server= localhost
<indiclient.indiclient object at 0xb6c0cb80>
CONNECT INDI Server host:localhost port:7625 device:MeteoStation
Generating 3 hours graph
Generating day graph
Generating weekly graph
Generating monthly graph
('HR', 'Thr', 'IR', 'Tir', 'P', 'Tp', 'Dew', 'Light', 'T', 'clouds', 'skyT', 'cloudFlag', 'dewFlag', 'frezzingFlag')
(None, None, None, None, None, None, None, None, None, None, None, None, None, None)
MinMax FAIL



Don't pay attention to the following lines as I had added them a long time ago for debugging

('HR', 'Thr', 'IR', 'Tir', 'P', 'Tp', 'Dew', 'Light', 'T', 'clouds', 'skyT', 'cloudFlag', 'dewFlag', 'frezzingFlag')
(None, None, None, None, None, None, None, None, None, None, None, None, None, None)
3 years 6 months ago #59910

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223
I need to find out what's going on with "Fail to retrive internet data" as I cannot get the new satellite image.
3 years 6 months ago #59911

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223
I am going to say that it's now working on Python 3.x
Will sort out the "Fail to retrive internet data" later on as it's not essential right now.
3 years 6 months ago #59914

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 30
if attrs.has_key('message'):

In Python 3, dictionaries changed a lot. Now is easier, change the line above to:

if 'message' in attrs:
3 years 6 months ago #59917

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 30
I got your code and had a look at it.
The code is not excellent and has some design and gramatical problems.
Anyway, the "Fail to retrieve internet data" comes from sounding.py.
First, urllib library has changed a lot. You had to modify the imports to this:

<code>#import tidy
import datetime
import time
import locale
from string import *
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import urlopen, urlretrieve, Request </code>

and then substitute in the code correspondingly.

There are also some problems when opening the URLs. For example the uwyoClass class method get_sounding_skewt should read:

<code>def get_sounding_skewt(self):
data = {"region": "europe", "TYPE": "GIF:SKEWT", "YEAR": self.YEAR,
"MONTH": self.MONTH, "FROM": self.FROM, "TO": self.FROM, "STNM": SOUNDINGSTATION}

params = urlencode(data)
req = Request(url='weather.uwyo.edu/cgi-bin/sounding?%s' % params)
s = urlopen(req)
o = s.read()
s.close()
document = o
urlretrieve("weather.uwyo.edu/upperair/images/" + self.YEAR +
self.MONTH + self.FROM + ".08221.skewt.gif", CHARTPATH + "skewt.gif")</code>


Then, here there is another problem I has stopped on because I have to go for launch :)
The problem is that the URL build to retrieve the weather picture (for example "weather.uwyo.edu/upperair/images/2020091412.08221.skewt.gif") points to a document that simply doesn't exists...
So the URL must be changed, but now I am not sure what the program is looking for. I need some time to learn about the objective of this section of the code.
Due to other duties (like going to work) I can not continue reviewing the code right now but I could do it in two days if you can wait for so long.
I like to review python code, so I do it willingly.
The following user(s) said Thank You: Gonzothegreat
Last edit: 3 years 6 months ago by Joaquin. Reason: Typos
3 years 6 months ago #59934

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 30
I forgot:
I commented the tidy import because I do not have the tidy lib in my system, so I also nodified for example:

document = tidy.parseString(o)

to

document = o

This should be reverted in the code
3 years 6 months ago #59935

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223
I've found out that the following python scripts do die after a while... and I do not know why, so it's not quite yet fully solved.

26718 ? S 0:01 /usr/bin/python ./meteoRRD_updater.py &>/dev/null
26720 ? S 0:05 /usr/bin/python ./meteoRRD_graph.py &>/dev/null
26721 ? S 0:00 /usr/bin/python ./sounding.py &>/dev/null
26722 ? S 0:00 /usr/bin/python ./meteoRRD_MaxMinAvg.py &>/dev/null
26725 ? S 0:00 indi_weather -f /tmp/indi_weatherFIFO -p 7625
26726 ? S 0:00 \_ indi_duino
Last edit: 3 years 6 months ago by Gonzothegreat.
3 years 6 months ago #59947

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223

I was able to get that working with:
def get_sounding_skewt(self):
        data = urllib.parse.urlencode({"region": "europe", "TYPE": "GIF:SKEWT", "YEAR": self.YEAR,
                                       "MONTH": self.MONTH, "FROM": self.FROM, "TO": self.FROM, "STNM": SOUNDINGSTATION}).encode("utf-8")
 
        # print data
        print("data A=", data)
        s = urllib.request.urlopen(
            "http://weather.uwyo.edu/cgi-bin/sounding?", data)
        o = s.read()
        s.close()
        document = tidy.parseString(o)
        print("document A=", document)
        urllib.request.urlretrieve("http://weather.uwyo.edu/upperair/images/"+self.YEAR +
                                   self.MONTH+self.FROM+".08221.skewt.gif", CHARTPATH+"skewt.gif")
        # print document


check out the two extra "print()" to show the following:

data A= b'region=europe&TYPE=GIF%3ASKEWT&YEAR=2020&MONTH=09&FROM=1500&TO=1500&STNM=10548'


and:
document A= <!DOCTYPE html>
<html>
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.6.0">
<title>10548 Meiningen Sounding</title>
</head>
<body bgcolor="white">
<center><img src=
"/upperair/images/2020091500.10548.skewt.parc.gif">
<p>Description of the <a href="/upperair/indices.html">sounding
indices</a>.</p>
<form><input class="button" type="button" value=
" Close this window " onclick="window.close();"> <input class=
"button" type="button" value=" Select another map " onclick=
"window.blur();"></form>
<hr size="1">
<i>Interested in graduate studies in atmospheric science? Check out
our program at the <a href="http://www.uwyo.edu/atsc/howtoapply/"
target="_top">University of Wyoming</a></i>
<hr size="1">
<font size="-1">Questions about the weather data provided by this
site can be addressed to <a href="mailto:ldoolman@uwyo.edu">Larry
Oolman (ldoolman@uwyo.edu)</a></font>
<hr size="1">
<script type="text/javascript">
<!--
window.focus();
// -->
</script></center>
</body>
</html>
 
3 years 6 months ago #59987

Please Log in or Create an account to join the conversation.

  • Posts: 2247
  • Thank you received: 223
Time to create page: 0.950 seconds