Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 04-06-2020, 04:02 AM   #1
halloleo
Groupie
halloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
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?
halloleo is offline   Reply With Quote
Old 04-06-2020, 05:02 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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
kovidgoyal is offline   Reply With Quote
Advert
Old 04-06-2020, 07:19 AM   #3
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
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?
PeterT is offline   Reply With Quote
Old 04-06-2020, 08:29 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Old 04-06-2020, 08:52 AM   #5
halloleo
Groupie
halloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
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__
Then I call

Code:
calibre-debug script.py
and get an error:

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
But a Python3 script like

Code:
import calibre
print(calibre.__version__)
works fine. Why's that?
halloleo is offline   Reply With Quote
Advert
Old 04-06-2020, 10:38 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Because calibre uses from __future__ import print_function
kovidgoyal is offline   Reply With Quote
Old 04-06-2020, 06:00 PM   #7
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,670
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Because calibre uses from __future__ import print_function
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
BetterRed is offline   Reply With Quote
Old 04-06-2020, 10:40 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by BetterRed View Post
Wish we could, from __future__ import a coronavirus vaccine.

BR
BCG seems promising.
kovidgoyal is offline   Reply With Quote
Old 04-07-2020, 01:54 AM   #9
halloleo
Groupie
halloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 156
Karma: 12649
Join Date: Feb 2020
Device: iPad
Quote:
Originally Posted by kovidgoyal View Post
Because calibre uses from __future__ import print_function
Of course! That's it. Thanks.
halloleo is offline   Reply With Quote
Old 04-07-2020, 02:08 AM   #10
halloleo
Groupie
halloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterhalloleo can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 156
Karma: 12649
Join Date: Feb 2020
Device: iPad
Quote:
Originally Posted by kovidgoyal View Post
BCG seems promising.
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.
halloleo is offline   Reply With Quote
Old 04-07-2020, 02:17 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by halloleo View Post
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.
That should be enough to transfrm this into a relatively minor thing along the lines of regular influenza.

Quote:
I'm hoping that individual immunity after recovery brings in the mid-to-long run herd immunity.
I doubt individual immunity will last very long. These types of viruses tend to mutate a lot. But would be awesome if it does ofc.
kovidgoyal is offline   Reply With Quote
Old 04-07-2020, 03:47 AM   #12
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,670
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by kovidgoyal View Post
BCG seems promising.
I read that as Boston Consulting Group

BR
BetterRed is offline   Reply With Quote
Reply

Tags
calibre, python 2, python3


Forum Jump

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


All times are GMT -4. The time now is 03:24 PM.


MobileRead.com is a privately owned, operated and funded community.