Nothing happens when you run pdf2txt.py at a command prompt.

Asked 2 years ago, Updated 2 years ago, 16 views

I'm following the instructions in the book, but nothing happens.Why is this?I can't find any similar problems when I look at the information on the Internet. python 3.6 anaconda
I am using Windows 10.Is there any oversight?

The module is pdfminer3k.

pdf2txt.py-o output.txt22.pdf

This is what you see when you run it.

usage: C:\ProgramData\Anaconda3\Scripts\pdf2txt.py [-d][-pagenos][-maxpages][-Password][-o output][-C][-n][-A][-V][-Mchar_margin][-Line_margin][-Word_margin][-out_Fox][-out_Flow][-line_Fox][-out_Flow][-line_Fox][-out_Flow]

Solution

As BLUEPIXY pointed out, adding python to the command solved the problem.

python

2022-09-30 16:55

2 Answers

Windows, not limited to python, requires configuration such as associating extensions and how arguments are deployed when running scripts.
(The executable extension also requires that setting.)
For the status of the question, the setting (deploying arguments) may be incorrect or incomplete.

I don't use Windows 10, so I can't give you any details about such a method in Windows 10, but
You might want to use a batch if you are not particular about running with the extension .py in such a persistent command.

Examples below (replace appropriately for your environment):
First, prepare your own command folder in the appropriate location.
Example:
c:\my_command
And pass through this folder.
Copy the script to this folder or specify a full path in the batch.
Create a batch file in the same folder.
Example:
Batch file name:
pdf2txt.bat

Content (Examples of specifying script files in the full path (enclosed with " if the path contains spaces).)):

python C:\ProgramData\Anaconda3\Scripts\pdf2txt.py%*

Example Execution:

pdf2txt-o output.txt22.pdf

(If the my_command folder (or execution path) does not have a .exe or .com file of the same name, you can omit .bat in pdf2txt.bat.)


2022-09-30 16:55

Either option is incorrect, so you will see how to use it.

Try leaving the output at standard output instead of file specification, or
Try to specify the full path of the PDF file or

Current folder, such as "C:\Work", etc. You can run it without Japanese or spaces in the middle folder name.
Try it.

These pages may be helpful.
English vocabulary book creation ~ 1~
http://kuroyagi.hatenablog.com/entry/2017/10/04/201409
pdf2txt.py not executing command
https://stackoverflow.com/questions/31574629/pdf2txt-py-not-executing-command


2022-09-30 16:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.