8000 add io bytes parser for python3 compatibility · Lamaf/pvlib-python@8f2af6e · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 8f2af6e

Browse files
committed
add io bytes parser for python3 compatibility
1 parent dd9a329 commit 8f2af6e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pvlib/pvsystem.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
pvl_logger = logging.getLogger('pvlib')
55

66
import os
7+
import io
78
try:
89
from urllib2 import urlopen
910
except ImportError:
@@ -541,7 +542,8 @@ def retrieve_sam(name=None, samfile=None):
541542
url = 'https://sam.nrel.gov/sites/sam.nrel.gov/files/sam-library-sandia-inverters-2014-1-14.csv'
542543

543544
if samfile is None:
544-
csvdata = urlopen(url)
545+
response = urlopen(url)
546+
csvdata = io.BytesIO(response.read())
545547
elif samfile == 'select':
546548
import Tkinter
547549
from tkFileDialog import askopenfilename

0 commit comments

Comments
 (0)
0