3
votes

I have a Windows 10 x64 based PC. I am trying to get this PDF-DIFF Python tool here: https://github.com/JoshData/pdf-diff to run and it hits this error when it is running a line from Python Lib file called 'subprocess.py' file.

I posted this issue with full screenshots of the error and still waiting for response: https://github.com/JoshData/pdf-diff/issues/30

Just to note that before installation of this github tool I : 1) installed Python 3.6 (tried both 32 bit and 64) and currently have 32 bit

2) installed Microsoft Visual Studio 14.0 Build tools (C++ build tools)

3) in command prompt ran command: pip install lxml so that I could have the xml libraries downloaded and satisfy the tool's requirements

4) additionally have checked other stackoverflow threads suggesting that 'file not found' error is due to 'COMSPEC' variable being set differently in regedit vs. Python's subprocess.py.

In windows key registry, 'ComSpec' key set to: %SystemRoot%\system32\cmd.exe;

In python subprocess call is being made as such (last line is 997):

     if shell:
            startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
            startupinfo.wShowWindow = _winapi.SW_HIDE
            comspec = os.environ.get("COMSPEC", "cmd.exe")
            args = '{} /c "{}"'.format (comspec, args)

        #Start the process
        try:
            hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                                     # no special security
                                     None, None,
                                     int(not close_fds),
                                     creationflags,
                                     env,
                                     os.fspath(cwd) if cwd is not None else 
  None,
                                     startupinfo)

I'm out of ideas, and feel the program requirements are satisfied. So, when I run the command in the prompt to get my two PDF files compared and output comparison spit out:

C:\Python36\Scripts\pdf_diff>pdf-diff 683000.pdf 17368000.pdf > comparison_output.png

*I immediately get error shown below:

  Traceback (most recent call last):

File "C:\Python36\Scripts\pdf_diff\pdf-diff-script.py", line 11, in load_entry_point('pdf-diff==0.9.0', 'console_scripts', 'pdf-diff')() File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 496, in main changes = compute_changes(args.files[0], args.files[1], top_margin=float(args.top_margin), bottom_margin=float(args.bottom_margin)) File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 14, in compute_changes docs = [serialize_pdf(0, pdf_fn_1, top_margin, bottom_margin), serialize_pdf(1, pdf_fn_2, top_margin, bottom_margin)] File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 29, in serialize_pdf for run in box_generator: File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 102, in mark_eol_hyphens for next_box in boxes: File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 64, in pdf_to_bboxes xml = subprocess.check_output(["pdftotext", "-bbox", fn, "/dev/stdout"]) File "C:\Python36\lib\subprocess.py", line 336, in check_output **kwargs).stdout File "C:\Python36\lib\subprocess.py", line 403, in run with Popen(*popenargs, **kwargs) as process: File "C:\Python36\lib\subprocess.py", line 709, in init restore_signals, start_new_session) File "C:\Python36\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

1

1 Answers

2
votes

I believe I found out the problem here. In the process of installing different versions of Python, namely 2.7 and 3.6 I broke something. I believe it could be the importing of different modules for the PDF-diff program. The PDF-DIFF program, according to manual is coded for Python 3. So, I believe the issue above was a versioning issue. I have for now removed Python 3.6 from my machine as I need 2.7 for other projects.