Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-10-2010, 03:02 PM   #1
BrianG
Member
BrianG began at the beginning.
 
Posts: 23
Karma: 22
Join Date: Dec 2009
Device: Kindle DX
BasicNewsRecipe interactive?

Hi. It would be helpful for me to test some new recipe ideas if I could call the methods of BasicNewsRecipe interactively.

I oversimplified things by assuming that I could just call the methods from CALIBRE-DEBUG. I'm missing an important step somewhere.

Can someone help me run something like the example below from an interactive command line?



soup = self.index_to_soup('http://www.xxxxx.com')


thanks,
Brian
BrianG is offline   Reply With Quote
Old 01-10-2010, 05:44 PM   #2
GRiker
Comparer of the Ephemeris
GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.
 
Posts: 1,496
Karma: 424697
Join Date: Mar 2009
Device: iPad
Just add a print statement in your recipe:
print soup.prettify()
'soup' is an instance of BeautifulSoup, which has a pretty print method prettify().
Debugging python with print statements is quick and intuitive.

G
GRiker is offline   Reply With Quote
Advert
Old 01-11-2010, 02:20 PM   #3
BrianG
Member
BrianG began at the beginning.
 
Posts: 23
Karma: 22
Join Date: Dec 2009
Device: Kindle DX
This makes sense, thanks.

However, I'm new to Python, so I'd like the opportunity to play with various functions and methods interactively. It's a lot easier if I can do this interactively as opposed to with PRINT statements in a program.

Can the CALIBRE-DEBUG program be used to interactively run the methods of BasicNewsRecipe?
BrianG is offline   Reply With Quote
Old 01-11-2010, 02:24 PM   #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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You stick

from calibre import ipython
ipython(user_ns=locals())

into any point in your code to have an interactive prompt at that point.
kovidgoyal is offline   Reply With Quote
Old 01-11-2010, 04:32 PM   #5
GRiker
Comparer of the Ephemeris
GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.GRiker ought to be getting tired of karma fortunes by now.
 
Posts: 1,496
Karma: 424697
Join Date: Mar 2009
Device: iPad
Nice, I didn't know about that.

G
GRiker is offline   Reply With Quote
Advert
Old 01-11-2010, 05:40 PM   #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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah it's a good way to explore when you're new to calibre/python.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-600 Interactive Interpreter luma Sony Reader Dev Corner 1 07-24-2010 12:19 PM
BasicNewsRecipe tag handling nickredding Calibre 3 12-22-2009 02:19 PM
Interactive Fiction... how likely is this? el.astrologo Sony Reader 22 12-02-2009 01:27 PM
Interactive ebooks Alan Pearce Introduce Yourself 0 07-01-2009 11:32 AM
Interactive story spooky69 Lounge 6 06-26-2008 02:13 AM


All times are GMT -4. The time now is 11:04 AM.


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