On 01/03/13 10:51, Dave Higgins wrote:
> Jim - after a few days of part time setting up I've managed to get pywws
> talking to my Maplin weather station and populating a Weatherbyyou
> website (with assistance from Paul on the Pi forum) and you. The last
> thing I'm trying to do is set up the Zambretti forecasting.
> Currently the website just displays the PHP code instead of a forecast.
That sounds like a web (server? client?) error not executing php when it
should.
> I've tried to run Forecast.py and I get the following error
>
> pi@raspberrypi ~/weather/code/pywws $ python Forecast.py ~/weather/data
> Traceback (most recent call last):
> File "Forecast.py", line 24, in <module>
> from . import DataStore
> ValueError: Attempted relative import in non-package
>
> Is this the correct thing to do - I am assuming I need to run this from
> cron - hourly? to generate the parameter for the website to display the
> correct icon - or is this wrong. I've looked for details of how to set
> this up but I have no experience of PHP or HTML so I'm not finding it
> easy to understand.
No, Forecast.py provides a function (called Zambretti) that's used in
templates to generate a forecast as required, e.g.:
https://github.com/jim-easterbrook/pywws/blob/master/code/example_templates/forecast_9am.txt
Like other pywws modules it can be run directly ('RunModule.py Forecast
data_dir') but this is just for test purposes.
--
Jim Easterbrook <
http://www.jim-easterbrook.me.uk/>