Closed boada closed 7 years ago
This is amazing, thank you very much for doing this!
Unfortunately, I run into an error under Python2 (Python3 works perfectly fine):
Traceback (most recent call last):
File "/home/mommermi/nau/software/photometrypipeline/pp_run", line 390, in <module>
fixed_aprad, source_tolerance)
File "/home/mommermi/nau/software/photometrypipeline/pp_run", line 245, in run_the_pipeline
diagnostics=True)
File "/home/mommermi/nau/software/photometrypipeline/pp_photometry.py", line 368, in photometry
diagnostics=diagnostics)
File "/home/mommermi/nau/software/photometrypipeline/pp_photometry.py", line 134, in curve_of_growth_analysis
n = eph.get_ephemerides(str(obsparam['observatory_code']))
File "/home/mommermi/nau/software/callhorizons/callhorizons/callhorizons.py", line 515, in get_ephemerides
src = urllib.urlopen(url).readlines()
File "/home/mommermi/software/anaconda2/lib/python2.7/site-packages/future/backports/http/client.py", line 516, in read
return bytes(super(HTTPResponse, self).read(amt))
File "/home/mommermi/software/anaconda2/lib/python2.7/site-packages/future/backports/http/client.py", line 545, in readinto
return self._readinto_chunked(b)
File "/home/mommermi/software/anaconda2/lib/python2.7/site-packages/future/backports/http/client.py", line 644, in _readinto_chunked
n = self._safe_readinto(mvb)
File "/home/mommermi/software/anaconda2/lib/python2.7/site-packages/future/backports/http/client.py", line 701, in _safe_readinto
n = self.fp.readinto(mvb)
AttributeError: '_fileobject' object has no attribute 'readinto'
I think there is a collision between urllib
imported in callhorizons
and the future
imports. Any ideas on what is going on?
Concerning the pypi version of callhorizons
, I will upload the latest version later today. Note that callhorizons
will soon be replaced by and astroquery
module.
Thanks, M
I will have a look to see if I can reproduce your error. Really, all new code should be written in python3. It'd be ok with me (and even get my vote) to migrate the entire thing to python3 only.
A second try on another computer of mine doesn't reproduce your problem? How are you calling the functions? I'm using python2 ../../pp_run.py *.fits
in the example data directory. I doubt that is the problem but it is something we can rule out.
I guess I should also say that I am just downloading the zip of callhorizons
from the git page, and then using setup.py
to install it into my local user directory.
Ok, I figured it out and created a new pull request that fixes the problems I have had.
You're right, this should have been in Python3 from the very beginning. I take the blame for this. Unfortunately, people are now using this under Python2, so I have to provide some compatibility.
Thanks again for your help! M
Added Python3 support. It maintains Python2 support.
pp_run completes all routines without error using the example data. The resulting zero-points are the same when using either Python2 or Python3. In order to maintain legacy support for Python2, the future module is now required.
pip install future
should take care of everything.Should also note, that the version of
callhorizons
on pypi is not Python3 friendly. I also had to install the development version from the github repo.