sunpy: AttributeError: 'str' object has no attribute 'decode'

Hello! so am attempting to query Helioviewer.org with SunPy and i get this AttributeError randomly (sometime i get it and sometimes i dont when using the same exact parameters).

i.e. required_date_time = ‘2002/05/06 00:30:00’ file = hv.download_png(required_date_time , 2.4, ‘[1,1,100]’, x0=0, y0=0, width=1024, height=1024)

The error message am getting is: Traceback (most recent call last): File "C:\Users\User\Desktop\accessing_SOHO_data\accessing_EIT_using_SunPy\get_corrospnding_EIT_using_SunPy.py", line 55, in <module> file = hv.download_png(corrosponding_EIT_name, 2.4, '[1,1,100]', x0=0, y0=0, width=1024, height=1024)

File "C:\Python35\lib\site-packages\sunpy\net\helioviewer.py", line 221, in download_png return self._get_file(params, directory, overwrite=overwrite)

File "C:\Python35\lib\site-packages\sunpy\net\helioviewer.py", line 248, in _get_file filepath = download_fileobj(response, directory, overwrite=overwrite)

File "C:\Python35\lib\site-packages\sunpy\util\net.py", line 119, in download_fileobj filename = get_system_filename(opn, url, default)

File "C:\Python35\lib\site-packages\sunpy\util\net.py", line 88, in get_system_filename name = default.decode("ascii", "ignore") AttributeError: 'str' object has no attribute 'decode'

this is a very strange behaviour and i tried to understand whats causing it but i couldnt figure it out. any help in this regard is very much appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

I think I have a fix locally, I will see about pushing up and getting a review and hopefully a bug fix release this week.

@MjdMahasneh I don’t think the helioviewer API allows us to download the fits file but we should add support for getting the header. I will open a separate issue (if i can’t find one).

If I am honest, I am unsure how up to date this client is.