01-09-2012, 03:25 AM | #1 |
Junior Member
Posts: 6
Karma: 10
Join Date: Jan 2012
Location: Albany, NY
Device: none
|
Calibre in a Python 3.2 world, attn: Kovid
The unix world is rapidly getting dragged into Python 3.x and our OS is just another one in that situation. We're planning to provide calibre with our upcoming release, but with other Python 3.x code, it has hopelessly broken calibre. It was so much of a showstopper for us that we had to consider removing calibre as we really need the other stuff. Tried correcting some syntax errors vis-a-vis 3.x but saw that was hopeless.
I wanted to keep calibre so much, stumbled onto a solution that should be able to be integrated into the next calibre release. 3.x versions of python set themselves up in environment as "python" and when the calibre in /usr/(local/)bin calls calibre there, at the top is "#!/usr/bin/env python" which will call 3.x by default. We also ship PY27, and a simple edit of that top line in "calibre" to "#!/usr/bin/env python2.7" in our case solved it and has calibre calling the older Python. Kovid ... might want to consider coding up your call to ensure that the older Python is called here rather than the default of whatever is set as "python" in the environment. In our KNOS (BSD-based) OS, just changing that one line fixed it all. I can be contacted at knosproject.com if you need more ... |
01-09-2012, 04:02 AM | #2 |
Junior Member
Posts: 6
Karma: 10
Join Date: Jan 2012
Location: Albany, NY
Device: none
|
In further going through the various calls, looks like there's a bunch of them that need this treatment, but in each case, the solution described above makes them work again. Just wanted to note that all of the calls I've touched so far, this is bringing each of them back to life. All that's needed is substitution of that correct python call instead of the generic "python" and that should allow calibre to be compatible with newer python installations on other OS' ... I'm currently rummaging through the source file to identify how many others I need to fix. I'm also turning off the update feature for now to prevent this solution from getting sullied by updates that revert back to generic python calls.
|
Advert | |
|
01-09-2012, 04:10 AM | #3 |
creator of calibre
Posts: 44,558
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre uses
#!/usr/bin/env python2 It has for a long time. How did you get a version that uses bare python? |
01-09-2012, 04:14 AM | #4 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Jan 2012
Location: Albany, NY
Device: none
|
Quote:
FreeBSD package. There is no "python2" in BSD, it's "python2.7" ... used to be "python2.5" a while back. BSD allows multiple versions to run side by side *if* the version is specified, otherwise it defaults to whatever "wins." But the FreeBSD distro of the package for 9 version has your top script saying "#!/usr/bin/env python" ... have it here on my screen. FYI: Maintainer of the port for FreeBSD is Rusty Nejdl <rnejdl@ringofsaturn.com> Edit again: Just CONFIRMED that with "python2" up there, fails on BSD. It NEEDS 2.7 in order to match the existing versions available. Any chance of hunting for the version and slapping it in there for BSD? I have no problem doing it for our own stuff once I establish all of the modules that need the edit, but I think I know why they stripped the "2" off your source now. Last edited by Kevin McAleavey; 01-09-2012 at 04:28 AM. |
|
01-09-2012, 04:30 AM | #5 |
creator of calibre
Posts: 44,558
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I'm afraid I don't maintain the BSD calibre packages, you should contact Rusty. I will say that having a python2 symlink pointing to the latest python2 binary is good practice and should be encouraged. See http://www.python.org/dev/peps/pep-0394/
|
Advert | |
|
01-09-2012, 04:51 AM | #6 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Jan 2012
Location: Albany, NY
Device: none
|
Quote:
Was not aware of what you were doing for other OS' and so thought this might help. I'll beat up on my own then. Heh. Meanwhile, another tedious night on our end because we're kinda fond of things working properly here. Dunno why the python2 call you did disappeared, but I'll rub Rusty's nose in it for ya. |
|
01-09-2012, 07:55 AM | #7 |
Junior Member
Posts: 6
Karma: 10
Join Date: Jan 2012
Location: Albany, NY
Device: none
|
|
01-09-2012, 10:57 AM | #8 |
Evangelist
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
The FreeBSD 'port' already has patches for the python2 -> python. You can just remove this for your local tree (/usr/local/ports/deskutils/calibre/files/ iirc), tho it would be fair to suggest that the correct python dependency is added if it is not there already - since python 2 is still the recommended version.
|
01-09-2012, 06:49 PM | #9 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Jan 2012
Location: Albany, NY
Device: none
|
Quote:
Still waiting to hear back from the maintainer ... |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Thank You Kovid & the Entire Calibre Team | pghaworth | Calibre | 17 | 01-31-2011 01:16 PM |
Help Kovid 7.31 still getting python error | sadievan | Calibre | 10 | 11-28-2010 07:27 PM |
Thank you Kovid and Calibre crew! | pshrynk | Calibre | 16 | 04-13-2009 09:56 PM |
calibre: most desired feature, pony up for Kovid | astrodad | Calibre | 96 | 07-17-2008 07:53 PM |