PDFMiner install question

J

Jason Mellone

Hello,

I have python up and running using the exact setup as recommended by http://learnpythonthehardway.org/

I am now trying to use pdfminer.

I have python here:
C:\USERS\Python27

using "import os", i am able to cwd to C:\users\python where i have C:\users\python\pdfminer-master\.

when i navigate to the child directory and run "setup.py install" i get the following issue:
File "<stdin>", line 1
setup.py install
^

i have no idea why, any input?

thanks!
 
M

Mark Lawrence

Hello,

I have python up and running using the exact setup as recommended by http://learnpythonthehardway.org/

I am now trying to use pdfminer.

I have python here:
C:\USERS\Python27

using "import os", i am able to cwd to C:\users\python where i have C:\users\python\pdfminer-master\.

when i navigate to the child directory and run "setup.py install" i get the following issue:

File "<stdin>", line 1
setup.py install
^

i have no idea why, any input?

thanks!

The "import os" tells me that you're running setup.py from a Python
prompt, you should be running it from a Windows command prompt.
 
M

MRAB

Hello,

I have python up and running using the exact setup as recommended by http://learnpythonthehardway.org/

I am now trying to use pdfminer.

I have python here:
C:\USERS\Python27

using "import os", i am able to cwd to C:\users\python where i have C:\users\python\pdfminer-master\.

when i navigate to the child directory and run "setup.py install" i get the following issue:

File "<stdin>", line 1
setup.py install
^

i have no idea why, any input?

thanks!
Do you really have the ">>>" prompt? If yes, then you're asking Python
to run a console (OS) command.

You should be running "setup.py install" in a console ("Command
Prompt") window, something like:

cd C:\users\python\pdfminer-master
C:\USERS\Python27\python.exe \setup.py install
 
J

Jason Mellone

Do you really have the ">>>" prompt? If yes, then you're asking Python

to run a console (OS) command.



You should be running "setup.py install" in a console ("Command

Prompt") window, something like:



cd C:\users\python\pdfminer-master

C:\USERS\Python27\python.exe \setup.py install

ok makes sense.

i am running now from command line and get the following:

P:\>C:\USERS\Python27\python.exe C:\users\Python27\pdfminer-master\setup.py inst
all
running install
running build
running build_py
error: package directory 'pdfminer' does not exist

P:\>
 
J

Jason Mellone

ok makes sense.



i am running now from command line and get the following:



P:\>C:\USERS\Python27\python.exe C:\users\Python27\pdfminer-master\setup.py inst

all

running install

running build

running build_py

error: package directory 'pdfminer' does not exist



P:\>

also this is my dir:
P:\>dir C:\users\python27\pdfminer-master
Volume in drive C has no label.
Volume Serial Number is B825-02BA

Directory of C:\users\python27\pdfminer-master

17/12/2013 02:55 PM <DIR> .
17/12/2013 02:55 PM <DIR> ..
17/12/2013 02:48 PM <DIR> cmaprsrc
17/12/2013 02:48 PM <DIR> docs
26/11/2013 04:35 AM 1,723 Makefile
26/11/2013 04:35 AM 111 MANIFEST.in
17/12/2013 03:49 PM <DIR> pdfminer
26/11/2013 04:35 AM 5,311 README.md
17/12/2013 02:48 PM <DIR> samples
26/11/2013 04:35 AM 1,384 setup.py
17/12/2013 02:48 PM <DIR> tools
4 File(s) 8,529 bytes
7 Dir(s) 26,006,282,240 bytes free

P:\>
 
M

Mark Lawrence

also this is my dir:
P:\>dir C:\users\python27\pdfminer-master
Volume in drive C has no label.
Volume Serial Number is B825-02BA

Directory of C:\users\python27\pdfminer-master

17/12/2013 02:55 PM <DIR> .
17/12/2013 02:55 PM <DIR> ..
17/12/2013 02:48 PM <DIR> cmaprsrc
17/12/2013 02:48 PM <DIR> docs
26/11/2013 04:35 AM 1,723 Makefile
26/11/2013 04:35 AM 111 MANIFEST.in
17/12/2013 03:49 PM <DIR> pdfminer
26/11/2013 04:35 AM 5,311 README.md
17/12/2013 02:48 PM <DIR> samples
26/11/2013 04:35 AM 1,384 setup.py
17/12/2013 02:48 PM <DIR> tools
4 File(s) 8,529 bytes
7 Dir(s) 26,006,282,240 bytes free

P:\>

Hi, glad to see you're making some progress :) You're likely to get
more offers of assistance if you read and action this
https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the
double line spacing above, thanks.
 
M

MRAB

On 17/12/2013 20:59, Jason Mellone wrote:> On Tuesday, December 17, 2013
also this is my dir:
P:\>dir C:\users\python27\pdfminer-master
Volume in drive C has no label.
Volume Serial Number is B825-02BA

Directory of C:\users\python27\pdfminer-master

17/12/2013 02:55 PM <DIR> .
17/12/2013 02:55 PM <DIR> ..
17/12/2013 02:48 PM <DIR> cmaprsrc
17/12/2013 02:48 PM <DIR> docs
26/11/2013 04:35 AM 1,723 Makefile
26/11/2013 04:35 AM 111 MANIFEST.in
17/12/2013 03:49 PM <DIR> pdfminer
26/11/2013 04:35 AM 5,311 README.md
17/12/2013 02:48 PM <DIR> samples
26/11/2013 04:35 AM 1,384 setup.py
17/12/2013 02:48 PM <DIR> tools
4 File(s) 8,529 bytes
7 Dir(s) 26,006,282,240 bytes free

P:\>
The prompt shows that the current directory is P:\.

On Windows, each drive has its own current directory, so you have to
set the default drive too.

I think this should do it:

C:
cd C:\users\Python27\pdfminer-master
C:\USERS\Python27\python.exe setup.py inst
 
J

Jason Mellone

MRAB: Thank you your exact solution worked perfectly.

Now I am trying to run some code from (http://www.unixuser.org/~euske/python/pdfminer/programming.html) under basic usage.

If I try to run
<code>
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfdevice import PDFDevice

# Open a PDF file.
fp = open('C:\\USERS\\Python27\\samples\\test.pdf', 'rb')
# Create a PDF parser object associated with the file object.
parser = PDFParser(fp)
# Create a PDF document object that stores the document structure.
document = PDFDocument(parser)

print "done"
</code>


I get the following error:
PS C:\USERS\Python27> .\python.exe .\MyTest.py
Traceback (most recent call last):
File ".\MyTest.py", line 4, in <module>
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
ImportError: cannot import name PDFTextExtractionNotAllowed


If I run commenting out the import of "PDFTextExtractionNotAllowed" it runs without a problem. Quite odd.
 
M

MRAB

MRAB: Thank you your exact solution worked perfectly.

Now I am trying to run some code from (http://www.unixuser.org/~euske/python/pdfminer/programming.html) under basic usage.

If I try to run
<code>
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfdevice import PDFDevice

# Open a PDF file.
fp = open('C:\\USERS\\Python27\\samples\\test.pdf', 'rb')
# Create a PDF parser object associated with the file object.
parser = PDFParser(fp)
# Create a PDF document object that stores the document structure.
document = PDFDocument(parser)

print "done"
</code>


I get the following error:
PS C:\USERS\Python27> .\python.exe .\MyTest.py
Traceback (most recent call last):
File ".\MyTest.py", line 4, in <module>
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
ImportError: cannot import name PDFTextExtractionNotAllowed


If I run commenting out the import of "PDFTextExtractionNotAllowed" it runs without a problem. Quite odd.
A quick Google tokk me here:

http://css.dzone.com/articles/pdf-reading

Its example contains:

from pdfminer.pdfinterp import PDFResourceManager,
PDFPageInterpreter, PDFTextExtractionNotAllowed

Note how it's importing PDFTextExtractionNotAllowed from a different
place.

Perhaps the author of the code you're looking at didn't test it. It
happens! :)
 
A

Andreas Perstinger

Jason Mellone said:
I get the following error:
PS C:\USERS\Python27> .\python.exe .\MyTest.py
Traceback (most recent call last):
File ".\MyTest.py", line 4, in <module>
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
ImportError: cannot import name PDFTextExtractionNotAllowed


If I run commenting out the import of "PDFTextExtractionNotAllowed" it
runs without a problem. Quite odd.

According to the latest version on Github,
"PDFTextExtractionNotAllowed" was moved into the "PDFPage" class, but
the sample code in the docs was obviously not updated.

https://github.com/euske/pdfminer/blob/master/pdfminer/pdfpage.py

So just leave out that line and if you need that exception use
"PDFPage.PDFTextExtractionNotAllowed" instead of
"PDFTextExtractionNotAllowed".

Bye, Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,351
Latest member
RoxiePulli

Latest Threads

Top