adasilva / journal2ebook

optimize academic pdfs for e-readers
Other
107 stars 12 forks source link

getting up and running... #28

Closed asllearner closed 9 years ago

asllearner commented 10 years ago
  1. I can't seem to get the program to work on os x 10.6.8. I know i have imagemagick, gs, and k2pdfopt installed and working. I have "python launcher" installed. I don't know how to see if I have PIL. (I installed Pillow instead of PIL)
  2. When I run from terminal I get: File "/usr/local/bin/journal2ebook", line 69 self.configVars={line.split(':')[0].replace(' ',''):line.split(':')[1].lstrip().rstrip('\n') for line in f} #dictionary of configuration variables SyntaxError: invalid syntax

There seems to be a caret under the word "for"

I am only a beginner at linux, so I need somewhat explicit directions.

  1. If I fail to get it to work, I wonder how i go about uninstalling it. Nonetheless, I look forward to being able to try it out.
  2. Also, running tesseract I get the following: Error opening data file ...TessOCR-1.08.-5074127fdf195/TessOCR-1.08/tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages! Could not initialize tesseract.

I do have a tessdata folder, /Applications/VietOCR3 App/tesseract-ocr/tessdata (But I havent been able to get vietocr3 to work. another story) How do I set the tessdata_prefix??

thx

asllearner commented 10 years ago

I commented out the offending line, and also changed the first few lines to account for PIL/Pillow: Beginning of file now reads:

#!/usr/bin/env python
# import ImageTk
#replaced with 
from PIL import ImageTk
import PIL.Image

I got the following errors. Out of my league. No idea what it means:

cd '/Users/me/Downloads/journal2ebook-master/journal2ebook/' && '/usr/bin/pythonw'  '/Users/me/Downloads/journal2ebook-master/journal2ebook/journal2ebook2.py'  && echo Exit status: $? && exit 1
2014-05-30 12:35:17.264 Python[58489:d07] Error loading /Library/ScriptingAdditions/Satimage.osax/Contents/MacOS/Satimage:  dlopen(/Library/ScriptingAdditions/Satimage.osax/Contents/MacOS/Satimage, 262): no suitable image found.  Did find:
    /Library/ScriptingAdditions/Satimage.osax/Contents/MacOS/Satimage: no matching architecture in universal wrapper
pythonw: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Satimage.osax" declares no loadable handlers.
Traceback (most recent call last):
  File "/Users/me/Downloads/journal2ebook-master/journal2ebook/journal2ebook2.py", line 479, in <module>
    myapp=Journal2ebook(root,filename)
  File "/Users/me/Downloads/journal2ebook-master/journal2ebook/journal2ebook2.py", line 96, in __init__
    self.setup()
  File "/Users/me/Downloads/journal2ebook-master/journal2ebook/journal2ebook2.py", line 104, in setup
    self.prepImage()
  File "/Users/me/Downloads/journal2ebook-master/journal2ebook/journal2ebook2.py", line 260, in prepImage
    self.img = PIL.Image.open(imFile)
  File "build/bdist.macosx-10.6-universal/egg/PIL/Image.py", line 2099, in open
  File "build/bdist.macosx-10.6-universal/egg/PIL/Image.py", line 343, in preinit
  File "build/bdist.macosx-10.6-universal/egg/PIL/PpmImagePlugin.py", line 35, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0x85 in position 6: ordinal not in range(128)

I fixed the problem with Tesseract. I had deleted the folder by mistake.

adasilva commented 10 years ago

Sorry - I didn't see this sooner. I'm not a mac user, but I'll try to help if I can and if you are still having the issue (and interested). Which version of python are you using?

adasilva commented 10 years ago

Changed label to wontfix because this has not been reproduced.

monkeypuzzler commented 9 years ago

I don't know if OP is returning, but I thought I'd let others know that using python 2.6 reproduces error.

adasilva commented 9 years ago

@monkeypuzzler Thanks for letting me know. For now I'll put python 2.7 as a requirement, but the fix might not be too difficult. Let me know if you get any more information or if you are able to fix it yourself.

monkeypuzzler commented 9 years ago

Thanks for providing the motivation to create my first fork and pull request! It turned out to be an easy fix - python 2.6 doesn't support dictionary comprehensions. I changed the dictionary comprehension into a list comprehension which produced a list of (key,value)-tuples, and fed that list into dict() to produce the required dictionary.

adasilva commented 9 years ago

now should work with python 2.6 (pull request #31)

adasilva commented 9 years ago

Thanks @monkeypuzzler for figuring this out, and congrats on your first pull request! I agree that this should not break any other versions of python.