Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not running on Ubuntu18 #1

Open
xmarti6 opened this issue Jan 23, 2020 · 0 comments
Open

Not running on Ubuntu18 #1

xmarti6 opened this issue Jan 23, 2020 · 0 comments

Comments

@xmarti6
Copy link

xmarti6 commented Jan 23, 2020

Waw thanks a lot! it saved me a lot of time. In my case, using a large PDF, did not work at first attempt:

I had this error output:

Error: /undefinedfilename in (page_1.pdf)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:974/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.26: Unrecoverable error, exit code 1

However, I could make the code work by changing these lines:

for file in onlyfiles:
    if file.startswith('page_') :
        pg = file.split('_')[1]
        #print(pg, type(pg), int(pg[:2]) < 10, pg[:2]) #debug
        c = 'mv -f '+file+' page_'+pg.strip("0")
        #print(c) #debug
        subprocess.call(c, shell=True, cwd=temp_dir) #debug . commented

For the installation I ran the commands like this in Ubuntu:

sudo apt-get install python-pip
./pdftk_installer      #seee: https://askubuntu.com/questions/1028522/how-can-i-install-pdftk-in-ubuntu-18-04-and-later
sudo apt-get install ghostscript
pip install pypdftk
pip install natsort
#Calling the program: 
python main.py

Hope this helps others in a similar context.
Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant