sodri126 / netcdf4-python

Automatically exported from code.google.com/p/netcdf4-python
Other
0 stars 0 forks source link

0-dim str variable #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Hi,

I have a similar problem as Issue 117 but with a 0-length variable:

    sta_name = nc.createVariable('station_name',str,())
    sta_name.cf_role = "timeseries_id"
    sta_name.long_name = "station name"

    print sta_name[0]   # <-- this fails
    sta_name[0] = station['name'] # <-- this fails too

the print line gives:
AttributeError: 'str' object has no attribute 'shape'

the assignement lien gives:
IndexError: single element VLEN slices must be specified by integers only

I have the latest stable release

Original issue reported on code.google.com by ghislain...@yahoo.fr on 13 Sep 2012 at 1:37

GoogleCodeExporter commented 9 years ago
I've put a fix for this in SVN, could you give it a try?

Original comment by whitaker.jeffrey@gmail.com on 13 Sep 2012 at 11:08

GoogleCodeExporter commented 9 years ago

Original comment by whitaker.jeffrey@gmail.com on 7 Mar 2013 at 11:46