Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 10-29-2012, 10:30 PM   #151
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: 25,949
Karma: 5036099
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Create a simple one line script to lauch sigil that sets the env var and use that script in open with

#!/bin/sh
LC_ALL=whatever /whatever/Sigil
kovidgoyal is offline   Reply With Quote
Old 10-30-2012, 05:07 PM   #152
snarkophilus
Wannabe Connoisseur
snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.
 
Posts: 241
Karma: 1009530
Join Date: Apr 2011
Location: Geelong, Australia
Device: Sony PRS-T1, Sony PRS-350, Palm TX
Another thing to try is to use the "env" command:

env LC_ALL=en_GB.utf8 sigil

The LC_ALL=en_GB.utf8 thing is usually interpreted by your shell which wouldn't happen with Calibre. "env" is a program that sets environment variables and then executes the command after those environment variable settings.

Cheers,
Simon.
snarkophilus is offline   Reply With Quote
Old 11-02-2012, 08:50 AM   #153
weedfreak
Addict
weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.
 
weedfreak's Avatar
 
Posts: 302
Karma: 185297
Join Date: Sep 2009
Location: Ankh Morpork
Device: calibre
Quote:
Originally Posted by kovidgoyal View Post
Create a simple one line script to lauch sigil that sets the env var and use that script in open with

#!/bin/sh
LC_ALL=whatever /whatever/Sigil
That is similar to what I had done. I created a local copy of sigil desktop and changed
Exec=sigil to Exec=bash -c "LC_ALL=en_GB.utf8 sigil" which works OK to start Sigil but of course not with open with in Calibre.
I tried your script and and can use it to start Sigil inside and outside Calibre the only problem is that starting it via open with opens an empty Sigil file not the one I need to edit.
weedfreak is offline   Reply With Quote
Old 11-02-2012, 09:15 AM   #154
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: 25,949
Karma: 5036099
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
#!/bin/sh
LC_ALL=whatever /whatever/Sigil $@
kovidgoyal is offline   Reply With Quote
Old 11-02-2012, 06:26 PM   #155
weedfreak
Addict
weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.
 
weedfreak's Avatar
 
Posts: 302
Karma: 185297
Join Date: Sep 2009
Location: Ankh Morpork
Device: calibre
Quote:
Originally Posted by kovidgoyal View Post
#!/bin/sh
LC_ALL=whatever /whatever/Sigil $@
That gives the error message Cannot read file [path to authors first name]:
No such file or directory.
weedfreak is offline   Reply With Quote
Old 11-02-2012, 10:00 PM   #156
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
Posts: 1,678
Karma: 509671
Join Date: Dec 2011
Location: Midwest USA
Device: Nook STR w/Glowlight, Kindle 3g, Droid
It needs to be quoted.

Try:

#!/bin/sh
LC_ALL=whatever /whatever/Sigil "$@"
JimmXinu is offline   Reply With Quote
Old 11-03-2012, 07:12 AM   #157
weedfreak
Addict
weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.weedfreak can program the VCR without an owner's manual.
 
weedfreak's Avatar
 
Posts: 302
Karma: 185297
Join Date: Sep 2009
Location: Ankh Morpork
Device: calibre
Yes that was it thank you all.
weedfreak is offline   Reply With Quote
Old 12-01-2012, 01:02 PM   #158
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
v1.5.6 Released

Changes in this release:
  • When switching libraries, ensure keyboard shortcuts are reactivated
  • Prevent Open With being used in Device View or on Device View context menu
kiwidude is offline   Reply With Quote
Old 12-09-2012, 10:10 AM   #159
french imp
Member
french imp began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jul 2012
Device: kobo
Open with won't open Sigil

Hi,

Open with no longer works with Sigil, here's the error message I get :

Traceback (most recent call last):
File "calibre_plugins.open_with.action", line 178, in open_with
File "calibre_plugins.open_with.action", line 212, in launch_app
File "subprocess.py", line 679, in __init__
File "subprocess.py", line 855, in _execute_child
File "subprocess.py", line 615, in list2cmdline
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 0: unexpected end of data

Some time back I had a similar problem, and Kiwidude solved it (in less than no time!). But it no longer works. Apart from updating Calibre regularly I'm not aware of any significant change on my system (windows 7 64 bits, but running calibre 32 bits). I uninstalled and re-installed Open with to no avail.

The problem occurs even with English books (no strange characters involved I guess).

Thanks for any help and sorry if this has been pointed out already (I didn't find it).
french imp is offline   Reply With Quote
Old 12-09-2012, 10:27 AM   #160
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
@french imp - there is nothing I can think to do about it, its a choice between two evils. The problem is non UTF8 characters in your path (your library must include them somewhere in its path, even if you are using english books). The change I made in the past was to to change the way Open With works and use a different API call to launch the external process which could cope with non UTF8.

However in Sigil 0.6 user_none made changes to his build/release process which have upset subsets of both Mac *and* Windows users. The problem for Windows users is that using his release builds of Sigil it has a conflict with the C runtime dlls between what is used in Sigil and what is used by calibre. The only way I managed to hack this as a workaround was to hard-code a special exemption for sigil.exe inside this plugin to use the *old* way of launching Sigil, which solves this issue.

However as you have found, that reintroduces the problem some foreign language users have where the path contains non utf8 characters...
kiwidude is offline   Reply With Quote
Old 12-09-2012, 12:19 PM   #161
PeterT
Taking a break; Fed up
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: 6,785
Karma: 43933000
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
I wonder if one could use a batch file; have that launched by the plugin, and then have that launch sigil?
PeterT is offline   Reply With Quote
Old 12-09-2012, 12:23 PM   #162
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,646
Karma: 5629001
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by PeterT View Post
I wonder if one could use a batch file; have that launched by the plugin, and then have that launch sigil?
You have to pass a parameter (the book path) to the batch.

Other than that, I don't see why a batch would not work as long as the path to the batch does not have the non UTF8 problem.
theducks is online now   Reply With Quote
Old 12-09-2012, 01:36 PM   #163
french imp
Member
french imp began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jul 2012
Device: kobo
Thank you very much Kiwidude for the explanations. I understand that the problem is hard and you can't be blamed for the infamous user_none's mischief.

I have found an imperfect solution: I have moved my libraries to directories without uncouth characters. A lesser of two evils solution...

Thanks for all the suggestions, I tried the batch approach but failed to make it work. I can live with my libraries in the wrong place...

Cheers
french imp is offline   Reply With Quote
Old 12-09-2012, 08:46 PM   #164
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: 25,949
Karma: 5036099
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@kiwidude: Interesting. Why does the CRT mismatch affect sigil when launched using CreateProcess? Is Sigil trying to use the calibre dlls? And if so, why only with CreateProcess? Try setting the cwd to the sigil installation directory in your createprocess call.
kovidgoyal is offline   Reply With Quote
Old 12-10-2012, 05:51 AM   #165
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
@kovid - user_none wasn't able to figure out quite "why" it was going wrong. And yes the problem seems to be that for some unknown reason it does try to launch Sigil using the calibre dlls when using CreateProcess. Building Sigil on my own machine I never had the issue so it was specific to his build environment.

I tried setting the working directory using os.chdir(path) prior to the CreateProcess call but it makes no difference.

To add to the confusion, it seems it is only a problem with Sigil 0.6.0 (and the 0.5.9 betas that preceded it). As I just tried with Sigil 0.6.1 and 0.6.2 and they don't have the CRT conflict issue. So obviously user_none must have tweaked his build environment at some point since then and unknowingly fixed it .

I am attaching a version of the Open With plugin that has my Sigil hack removed, which will work for any Sigil version *except* Sigil 0.6.0. So users wanting to launch Sigil with non UTF8 path characters have an option without renaming their books or moving their library.

Once Sigil 0.6.3 gets released I will officially release this version of the plugin, there should be no excuses not to upgrade Sigil when that comes out.
Attached Files
File Type: zip Open With.zip (177.3 KB, 95 views)

Last edited by kiwidude; 12-10-2012 at 05:58 AM.
kiwidude is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Search the Internet kiwidude Plugins 205 08-11-2014 02:22 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM
Gui confusements. brewt Calibre 8 12-30-2008 12:16 PM
Reference Open eBook Forum: Open eBook Publication Structure. IMP. V1.0.1 14 September 2007 DaleDe IMP Books 0 09-14-2007 05:06 PM
iLiad GUI for the iLiad tribble iRex Developer's Corner 1 06-01-2007 02:29 PM


All times are GMT -4. The time now is 10:20 PM.


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