Closed jehturner closed 2 years ago
Eg. if the initial cache was created under 3.8/3.9, it fails to start under 3.7 like so:
> pyraf
Traceback (most recent call last):
File "/home/jturner/anaconda3_2019.10/envs/test/bin/pyraf", line 10, in <module>
sys.exit(main())
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/__main__.py", line 130, in main
iraf.Init(**initkw)
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/iraffunctions.py", line 208, in Init
clProcedure(Stdin='hlib$zzsetenv.def')
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/iraffunctions.py", line 2748, in clProcedure
newtask = _iraftask.IrafCLTask('', filename, '', stdin, '', '')
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/iraftask.py", line 1383, in __init__
self.initTask(filehandle=fh)
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/iraftask.py", line 1448, in initTask
parfile=self._defaultParpath)
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/cl2py.py", line 100, in cl2py
source=clInput)
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/clcache.py", line 163, in get
pycode = cache[index]
File "/home/jturner/anaconda3_2019.10/envs/test/lib/python3.7/site-packages/pyraf/sqliteshelve.py", line 108, in __getitem__
return pickle.loads(result[0])
ValueError: unsupported pickle protocol: 5
If pyraf
has been used previously under 3.7 but gemini
hasn't, the interpreter just fails to load the package:
PyRAF 2.2.1
Python/CL command line wrapper
.help describes executive commands
--> gemini
Traceback (innermost last):
File "<CL script CL1>", line 1, in <module>
ValueError: unsupported pickle protocol: 5
-->
PS. This isn't a disaster, since we can tell users to delete their cache and by the time they update to 2.2.2, their Python version is more likely to go forward than backward, but doing something more user friendly might save a few confused questions, also next time the protocol changes? Anyway, I'm sure you have a clearer idea of the options than I have.
From reading the docs about the different protocols, I think that the simplest solution would be to fix the protocol version to version 4 (or 3): 4 is supported from Python 3.4, and it seems that anyway versions are supported forever.
The HIGHEST_PROTOCOL
slipped in from the original devnull255/sqlite-shelve.
Hi Ole. Related to #132, I notice that if I test
pyraf
under Python 3.8-3.9 and then go back to running it (in the same directory) from a Python 3.7 environment, I am greeted with the following error when trying to load certain packages, or even when startingpyraf
itself (depending on which Python was used first for loading which packages):According to the documentation, although protocol version 5 was introduced in 3.8, the latter uses version 4 by default, which I think should be compatible with any Python that people might use with
2.2.1
. But it looks that yoursqliteshelve.py
module explicitly specifiesHIGHEST_PROTOCOL
. Perhaps if there's a compelling reason to prefer v5 then either it would be better to trap this error, ignore the unsupported cache entry and make a duplicate one (so it "just works"?) or at least to add a less cryptic error saying "delete yourpyraf/
cache", so people know what to do about it? Thanks.