Closed
Description
Things have been quiet for a while. Hope the fall is going well for all of you so far!
The following code
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from pvlib.location import Location
tz = -10
str_tz = 'Etc/GMT+' + str(-1*int(tz))
my_loc = Location(20.0, -155.9, str_tz, 105.0, "my_place")
gives the following exception:
Traceback (most recent call last):
File "/Users/lucas/Documents/Code/sim/pv.py", line 52, in <module>
my_loc = Location(20.0, -155.9, str_tz, 105.0, "my_place")
File "/usr/local/lib/python2.7/site-packages/pvlib/location.py", line 76, in __init__
raise TypeError('Invalid tz specification')
TypeError: Invalid tz specification
The most straightforward fix is, in location.py, to check isinstance(tz, basestring) instead of str on line 66. This makes it compatible across python 2 and 3.