Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_getregion returns byte string on Py3 #319

Closed
olaurino opened this issue Nov 22, 2016 · 2 comments
Closed

image_getregion returns byte string on Py3 #319

olaurino opened this issue Nov 22, 2016 · 2 comments

Comments

@olaurino
Copy link
Member

Originally reported by @nplee on sherpadev.

from the Python 3 build of CIAOX, when "image_getregion" is invoked in Sherpa, a byte string is returned:

sherpa-3> image_getregion()
          b''
sherpa-4> image_getregion().decode()

I didn't have time to reproduce the issue, but I am opening a ticket so it does not fall through the cracks again.

@olaurino olaurino changed the title image_getregion returns byte string image_getregion returns byte string on Py3 Nov 22, 2016
@DougBurke
Copy link
Contributor

This also happens (unsurprisingly) for image_xpaget:

sherpa-1> image_open()
sherpa-2> image_xpaget('version')
          b'sherpa 7.5\n'

@DougBurke
Copy link
Contributor

This does cause problems - e.g. from a session using Python 3.6 where I had added a region to an image, the notice2d_image command fails as shown below (ui is sherpa.astro.ui here):

In [10]: ui.image_getregion()
Out[10]: b'circle(58.716049,55.822531,30.764058);'

In [11]: ui.notice2d_image()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-aa5314fa3698> in <module>()
----> 1 ui.notice2d_image()

<string> in notice2d_image(ids)

/lagado.real/sherpa/sherpa-warnings/sherpa/astro/ui/utils.py in notice2d_image(self, ids)
   6490             if (coord == 'world'):
   6491                 coord = 'wcs'
-> 6492             regions = self.image_getregion(coord).replace(';', '')
   6493             self.notice2d_id(id, regions)
   6494 

TypeError: a bytes-like object is required, not 'str'

DougBurke added a commit to DougBurke/sherpa that referenced this issue Aug 29, 2017
The test is expected to fail (three times) when run on Python, but should
pass on Python 2.7.
DougBurke added a commit to DougBurke/sherpa that referenced this issue Aug 29, 2017
The test is expected to fail (three times) when run on Python, but should
pass on Python 2.7.
@olaurino olaurino added this to the 4.10 milestone Aug 30, 2017
olaurino pushed a commit to DougBurke/sherpa that referenced this issue Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants