Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-10-2011, 04:20 AM   #1
Cybertinus
Junior Member
Cybertinus began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2011
Device: none
Folder not valid

Hello everybody,

I'm trying to build a simple tool in PHP to automatically convert eBooks from PDF to HTMLZ (I need to do some processing afterwards, so I need HTMLZ). But I get the following error from ebook-convert.exe:
Code:
Python function terminated unexpectedly
  Folder not valid (Error Code: 1)
Traceback (most recent call last):
  File "site.py", line 103, in main
  File "site.py", line 84, in run_entry_point
  File "site-packages\calibre\__init__.py", line 15, in <module>
  File "site-packages\calibre\constants.py", line 126, in <module>
ValueError: Folder not valid
What can cause this? I run the following command:
Code:
"C:\Program Files (x86)\Calibre2\ebook-convert.exe" C:\inetpub\wwwroot\epubgenerator\work\Pink_Cover039.pdf C:\inetpub\wwwroot\epubgenerator\work\Pink_Cover039.htmlz > error 2>&1
The error above is the complete content of the error file.

When I copy the command to the cli, it works perfectly .

Does anybody what can be wrong? I've checked the permissions on the file Pink_cover039.pdf and Everyone has all permissions, so that can't be the problem.
Cybertinus is offline   Reply With Quote
Old 06-10-2011, 05:11 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
It is probably the backslashes. Backslash is the escape character in PHP (as it is in most languages). PHP is trying to convert \e and the like to their escaped equivalents.

Either double the backslashes (so they escape themselves) or convert them to front slashes.
chaley is offline   Reply With Quote
Old 06-10-2011, 06:19 AM   #3
Cybertinus
Junior Member
Cybertinus began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2011
Device: none
Hi Chaley,

I've tried changing the \ to /, but it had no effect. The same error popped up .
Cybertinus is offline   Reply With Quote
Old 06-10-2011, 06:33 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Looking at the python code throwing the error, it has to do with finding your calibre configuration directory. I have no idea how php interacts with windows concerning environment vars and the like.

Second-to-last suggestion: write your script in python instead of PHP.

Last suggestion: put your command into a .bat file and have your PHP code exec the bat file. That gives you something to debug, as you can see and set environment variables before calling ebook-convert.exe.

Good luck!
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EPub is not valid samuel17 ePub 10 01-30-2011 07:55 PM
Valid ePub, but not valid enough for iBooks MichaelGray ePub 46 01-14-2011 08:22 AM
sub-folder support for documents folder? sark666 Kobo Reader 5 08-31-2010 05:35 AM
With a valid CC and U.S. Address..... clobber Sony Reader 2 12-05-2008 10:04 AM
This book is not valid! James Bryant Bookeen 8 06-20-2008 11:09 PM


All times are GMT -4. The time now is 10:30 AM.


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