0

I'm trying to debug a program with the following command

os.system('ocrmypdf -l por --force-ocr --pages 1 \"' + dirname + '/' + pdf_name + '\" \"' + ocr_dir + str(index) + '.pdf\"')

When I run the code it works, but in the debugger it displays the error:

ModuleNotFoundError: No module named 'ocrmypdf.__main__'; 'ocrmypdf' is not a package

And the command doesn't work. As the program runs normally when not on the debug mode I think it is some Pycharm configuration, but I don't know how to solve it.

  • 1
    If you are using pycharm and also calling `os.system`, I'd recommend rethinking your approach. Using pycharm suggests you are developing more than a simple script. `os.system` really doesn't belong anywhere besides quick and dirty utility scripts. – Z4-tier May 22 '22 at 00:03
  • Thank you for your answer. I tried replacing ```os.system``` by ```subprocess.run```, but it error is the same. Do you have any other suggestion? – Luiz Felipe de Barros Jordao C May 22 '22 at 18:33

0 Answers0