04-06-2020, 04:02 AM | #1 |
Groupie
Posts: 156
Karma: 12649
Join Date: Feb 2020
Device: iPad
|
Is the environment Python 2 or Python 3?
I start playing around with calibre-debug. When I drop into its Python REPL it looks like Python 3, but the doco indicates Python 2. Is the doco just a bit outdated or do I understand things wrongly?
|
04-06-2020, 05:02 AM | #2 |
creator of calibre
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The default calibre builds use python 2, see https://www.mobileread.com/forums/sh...d.php?t=325721
|
Advert | |
|
04-06-2020, 07:19 AM | #3 |
Grand Sorcerer
Posts: 12,256
Karma: 74007256
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Does it depend on where you've obtained calibre; official web site vs repository?
|
04-06-2020, 08:29 AM | #4 |
creator of calibre
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
All official calibre releases are python 2. Once calibre 5 is released all official releases will be python 3. If you currently want a python 3 calibre, use the betas linked to in that plugin porting thread I linked to earlier.
|
04-06-2020, 08:52 AM | #5 |
Groupie
Posts: 156
Karma: 12649
Join Date: Feb 2020
Device: iPad
|
Thanks for all the responses!
I just downloaded 4.13 from the website. So ok, it's Python 2. Fair enough. But I get a strange error which feels like a Python 3 error: Say, I write the following script: Code:
import calibre print calibre.__version__ Code:
calibre-debug script.py Code:
Python function terminated unexpectedly: invalid syntax (script.py, line 2) Traceback (most recent call last): File "/Applications/Optional/calibre.app/Contents/Resources/Python/lib/python2.7/site.py", line 187, in main return run_entry_point() File "/Applications/Optional/calibre.app/Contents/Resources/Python/lib/python2.7/site.py", line 121, in run_entry_point return getattr(pmod, func)() File "site-packages/calibre/debug.py", line 348, in main File "site-packages/calibre/debug.py", line 260, in run_script File "/Users/toki/devel/calibre/play/script.py", line 3 print calibre.__version__ ^ SyntaxError: invalid syntax Code:
import calibre print(calibre.__version__) |
Advert | |
|
04-06-2020, 10:38 AM | #6 |
creator of calibre
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Because calibre uses from __future__ import print_function
|
04-06-2020, 06:00 PM | #7 |
null operator (he/him)
Posts: 20,670
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Wish we could, from __future__ import a coronavirus vaccine.
Ah well, back to the past. In 1665/6 London had the bubonic plague and then the Great Fire, down here we had the Great Fires and then the coronavirus plague. Stay safe BR |
04-06-2020, 10:40 PM | #8 |
creator of calibre
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
04-07-2020, 01:54 AM | #9 |
Groupie
Posts: 156
Karma: 12649
Join Date: Feb 2020
Device: iPad
|
|
04-07-2020, 02:08 AM | #10 |
Groupie
Posts: 156
Karma: 12649
Join Date: Feb 2020
Device: iPad
|
Well, let's not get our hopes up too much: BCG can at best help to ease (and shorten!) the infectious stage. but it is certainly not a full vaccine.
I'm hoping that individual immunity after recovery brings in the mid-to-long run herd immunity. |
04-07-2020, 02:17 AM | #11 | ||
creator of calibre
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
Quote:
|
||
04-07-2020, 03:47 AM | #12 |
null operator (he/him)
Posts: 20,670
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
Tags |
calibre, python 2, python3 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Python 2 to Python 3, Polyglot & Plugins | DaltonST | Calibre | 18 | 04-24-2019 12:10 AM |
How to setup Python debug environment for Calibre Recipes | huang5307 | Recipes | 9 | 03-03-2016 02:35 PM |
Python | KyBunnies | Lounge | 8 | 01-06-2016 03:25 PM |
OSX Python environment | DiapDealer | Development | 1 | 08-03-2014 11:10 PM |
Python help please | AndyW1691 | Library Management | 3 | 02-08-2012 09:51 AM |