Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62236 > unrolled thread

PDFMiner install question

Started byJason Mellone <jason.mellone@gmail.com>
First post2013-12-17 12:06 -0800
Last post2013-12-20 10:00 +0100
Articles 10 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  PDFMiner install question Jason Mellone <jason.mellone@gmail.com> - 2013-12-17 12:06 -0800
    Re: PDFMiner install question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-17 20:27 +0000
    Re: PDFMiner install question MRAB <python@mrabarnett.plus.com> - 2013-12-17 20:32 +0000
      Re: PDFMiner install question Jason Mellone <jason.mellone@gmail.com> - 2013-12-17 12:53 -0800
        Re: PDFMiner install question Jason Mellone <jason.mellone@gmail.com> - 2013-12-17 12:59 -0800
          Re: PDFMiner install question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-17 22:03 +0000
          Re: PDFMiner install question MRAB <python@mrabarnett.plus.com> - 2013-12-17 23:30 +0000
            Re: PDFMiner install question Jason Mellone <jason.mellone@gmail.com> - 2013-12-19 11:36 -0800
              Re: PDFMiner install question MRAB <python@mrabarnett.plus.com> - 2013-12-19 21:18 +0000
              Re: PDFMiner install question Andreas Perstinger <andipersti@gmail.com> - 2013-12-20 10:00 +0100

#62236 — PDFMiner install question

FromJason Mellone <jason.mellone@gmail.com>
Date2013-12-17 12:06 -0800
SubjectPDFMiner install question
Message-ID<0322a155-42ba-459b-8cac-fded7c12ba60@googlegroups.com>
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:

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

i have no idea why, any input?

thanks!

[toc] | [next] | [standalone]


#62237

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-12-17 20:27 +0000
Message-ID<mailman.4309.1387312087.18130.python-list@python.org>
In reply to#62236
On 17/12/2013 20:06, Jason Mellone wrote:
> 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:
>
>>>> setup.py install
>    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.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#62238

FromMRAB <python@mrabarnett.plus.com>
Date2013-12-17 20:32 +0000
Message-ID<mailman.4310.1387312378.18130.python-list@python.org>
In reply to#62236
On 17/12/2013 20:06, Jason Mellone wrote:
> 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:
>
>>>> setup.py install
>    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

[toc] | [prev] | [next] | [standalone]


#62239

FromJason Mellone <jason.mellone@gmail.com>
Date2013-12-17 12:53 -0800
Message-ID<89e3b06c-90d7-4cc5-8367-03c916a4dfcb@googlegroups.com>
In reply to#62238
On Tuesday, December 17, 2013 3:32:56 PM UTC-5, MRAB wrote:
> On 17/12/2013 20:06, Jason Mellone wrote:
> 
> > 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:
> 
> >
> 
> >>>> setup.py install
> 
> >    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

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:\>


[toc] | [prev] | [next] | [standalone]


#62240

FromJason Mellone <jason.mellone@gmail.com>
Date2013-12-17 12:59 -0800
Message-ID<472d91fe-2ddb-4a78-8a44-6b171f436903@googlegroups.com>
In reply to#62239
On Tuesday, December 17, 2013 3:53:24 PM UTC-5, Jason Mellone wrote:
> On Tuesday, December 17, 2013 3:32:56 PM UTC-5, MRAB wrote:
> 
> > On 17/12/2013 20:06, Jason Mellone wrote:
> 
> > 
> 
> > > 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:
> 
> > 
> 
> > >
> 
> > 
> 
> > >>>> setup.py install
> 
> > 
> 
> > >    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
> 
> 
> 
> 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:\>

[toc] | [prev] | [next] | [standalone]


#62242

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-12-17 22:03 +0000
Message-ID<mailman.4312.1387317836.18130.python-list@python.org>
In reply to#62240
On 17/12/2013 20:59, Jason Mellone wrote:
> On Tuesday, December 17, 2013 3:53:24 PM UTC-5, Jason Mellone wrote:
>> On Tuesday, December 17, 2013 3:32:56 PM UTC-5, MRAB wrote:
>>
>>> On 17/12/2013 20:06, Jason Mellone wrote:
>>
>>>
>>
>>>> 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:
>>
>>>
>>
>>>>
>>
>>>
>>
>>>>>>> setup.py install
>>
>>>
>>
>>>>     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
>>
>>
>>
>> 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:\>
>

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.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#62244

FromMRAB <python@mrabarnett.plus.com>
Date2013-12-17 23:30 +0000
Message-ID<mailman.4313.1387323018.18130.python-list@python.org>
In reply to#62240
On 17/12/2013 20:59, Jason Mellone wrote:> On Tuesday, December 17, 2013 
3:53:24 PM UTC-5, Jason Mellone wrote:
 >> On Tuesday, December 17, 2013 3:32:56 PM UTC-5, MRAB wrote:
 >>> On 17/12/2013 20:06, Jason Mellone wrote:
 >>>> 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:
 >>>>
 >>>>>>> setup.py install
 >>>>     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
 >>
 >> 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:\>
 >
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

[toc] | [prev] | [next] | [standalone]


#62413

FromJason Mellone <jason.mellone@gmail.com>
Date2013-12-19 11:36 -0800
Message-ID<5460059c-c805-40e3-bd3c-ac2ca677f0f7@googlegroups.com>
In reply to#62244
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.

[toc] | [prev] | [next] | [standalone]


#62417

FromMRAB <python@mrabarnett.plus.com>
Date2013-12-19 21:18 +0000
Message-ID<mailman.4423.1387487928.18130.python-list@python.org>
In reply to#62413
On 19/12/2013 19:36, Jason Mellone wrote:
> 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! :-)

[toc] | [prev] | [next] | [standalone]


#62430

FromAndreas Perstinger <andipersti@gmail.com>
Date2013-12-20 10:00 +0100
Message-ID<mailman.4432.1387530057.18130.python-list@python.org>
In reply to#62413
Jason Mellone <jason.mellone@gmail.com> wrote:
>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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web