Forum Archive

Pythonista and Opening Files in Other Apps

RainmanNoodles

So I have a complex script that takes a web page and turns it into a .epub file. Unfortunately, I can't figure out how to move the .epub file to iBooks.

First, I figured Pythonista would have the ability to present an Open In popover using one of its custom modules. That's not the case. (Feature request!) ;)

So barring that option, I tried opening the file in the browser. Unfortunately, I get the following error:

Error
An error occurred while loading the page: Frame load interrupted

Normally, if a .epub file is opened in Safari, it presents the option to open it in iBooks or another app. This is the functionality I want. Ideally, Pythonista could present the Open In popover, but until that happens, is there a way to open files like this?

The code I'm using is:

fullpath = os.path.join(os.getcwd(),"test.epub")
webbrowser.open("file://"+fullpath)

Does anyone know how to do this?

stophlong

Have you looked at url schemes?

http://handleopenurl.com/scheme/ibooks

I use pythonista to launch things in googlechrome://

webbrowser.open('googlechrome://omz-forums.appspot.com/pythonista')

Might also try http:// instead of file to see if launching safari helps...

Stoph

RainmanNoodles

iBooks' URL scheme accepts iTunes store links, but I'm trying to pass in my own generated ePub. Different job.

Also, you can't just open a link to a file in an external web browser. Launching Safari isn't going to help at all.