opennem / nemweb

python package to directly download and process AEMO files from http://www.nemweb.com.au/
MIT License
32 stars 19 forks source link

Quickstart error #6

Open suminss opened 5 years ago

suminss commented 5 years ago

Hi,

I've installed the nemweb package as per directions and am trying to run the suggested quickstart code in jupyter.

Am getting the following error:

from nemweb import nemweb_current nemweb_current.update_datasets([dispatch_scada])


NameError Traceback (most recent call last)

in () 1 ----> 2 nemweb_current.update_datasets([dispatch_scada]) NameError: name 'dispatch_scada' is not defined Is this a problem with my installation? Have tried once using pip, then un and reinstalling using setup.py. Or, do I need to initialise dispatch_scada before downloading? Many thanks!
dylanjmcconnell commented 5 years ago

Hey - sorry for not getting back to you sooner.. Did you have dispatch_scada as a string (as in, "dispatch_scada")?

Cheers, Dylan

jufemaiz commented 5 years ago
from nemweb import nemweb_current

nemweb_current.update_datasets(['dispatch_scada'])

As per @dylanjmcconnell above.

Though it may still be blocked at https://github.com/opennem/nemweb/issues/14

suminss commented 5 years ago

Thanks, sorry for late reply I tried to input as string but am still getting error - 'no such table'

---------------------------------------------------------------------------OperationalError Traceback (most recent call last)~/anaconda3/lib/python3.6/site-packages/nemweb/nemweb_sqlite.py in start_from(table_name, db_name, timestamp_col, start_date) 50 date = table_latest_record(---> 51 table_name, db_name=db_name, timestamp_col=timestamp_col 52 ) ~/anaconda3/lib/python3.6/site-packages/nemweb/nemweb_sqlite.py in table_latest_record(table_name, db_name, timestamp_col) 31 result = conn.execute(---> 32 "SELECT MAX({0}) FROM {1}".format(timestamp_col, table_name) 33 ) OperationalError: no such table: DISPATCH_UNIT_SCADA

During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) in ()----> 1 nemweb_current.update_datasets(['dispatch_scada']) ~/anaconda3/lib/python3.6/site-packages/nemweb/nemweb_current.py in update_datasets(datasets, print_progress) 153 filehandler = CurrentFileHandler() 154 for dataset_name in datasets:--> 155 filehandler.update_data(DATASETS[dataset_name], print_progress=print_progress) ~/anaconda3/lib/python3.6/site-packages/nemweb/nemweb_current.py in update_data(self, dataset, print_progress, start_date, end_date, db_name) 61 timestamp_col=dataset.datetime_column, 62 start_date=start_date,---> 63 db_name=db_name 64 ) 65 ~/anaconda3/lib/python3.6/site-packages/nemweb/nemweb_sqlite.py in start_from(table_name, db_name, timestamp_col, start_date) 57

date_str = input("{0} doesn't exist. Enter start date

[YYYYMMDD]: ".format(msg[1])) 58 # date = datetime.datetime.strptime(date_str, "%Y%m%d")---> 59 date = datetime.datetime.strptime(start_date, "%Y%m%d") 60 61 return date TypeError: strptime() argument 1 must be str, not None

On Tue, 8 Jan 2019 at 14:29, Joel Courtney notifications@github.com wrote:

from nemweb import nemweb_current

nemweb_current.update_datasets(['dispatch_scada'])

As per @dylanjmcconnell https://github.com/dylanjmcconnell above

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/opennem/nemweb/issues/6#issuecomment-452163094, or mute the thread https://github.com/notifications/unsubscribe-auth/AcaQ8tkW896Z0Y4YXYiAWjOw6ztQ9-f2ks5vBBClgaJpZM4Yx1zq .

jufemaiz commented 5 years ago

For the record I was seeing this in a docker container where we didn’t have SQLite installed.

Edit: got rid of the email crap. Sorry

dylanjmcconnell commented 5 years ago

Hey @suminss - just looking at the traceback, looks like @jufemaiz was also right right re: #14 .. I've had go at fixing that in the dev branch (If you checkout the dev branch the and run the setup script it should hopefully be fixed - if you do try, let me know how you go).

(...and perhaps make sure sqlite3 is installed, as per @jufemaiz last comment).