Nov-24-2019, 09:40 AM
Thank you for your continued assistance. I see now that the whole issue is due to me stupidly editing the module. I commented out a section of the run() function in pdftitle.py as I could not otherwise work out how to pass a file name to it.
This was on a previous night while I was somewhat intoxicated...
Now however, if I go to the original pdftitle.py, I cannot determine how to pass the argument correctly?
This was on a previous night while I was somewhat intoxicated...
Now however, if I go to the original pdftitle.py, I cannot determine how to pass the argument correctly?
PdfTitle = pdftitle.run(pdf=FilePath)
def run(): try: parser = argparse.ArgumentParser( prog='pdftitle', description='Extracts the title of a PDF article', epilog='') parser.add_argument('-p', '--pdf', help='pdf file', required=True) parser.add_argument('--replace-missing-char', help='replace missing char with the one specified') parser.add_argument('-v', '--verbose', action='store_true', help='enable verbose logging') args = parser.parse_args() global VERBOSE, MISSING_CHAR VERBOSE = args.verbose MISSING_CHAR = args.replace_missing_char title = get_title_from_file(args.pdf) if title is None: return 1 else: print(title) return 0 except Exception as e: if VERBOSE: traceback.print_exc() return 1 if __name__ == '__main__': sys.exit(run())
Error:Traceback (most recent call last):
File "rename_post.py", line 40, in <module>
pdf_recurse(args.path)
File "rename_post.py", line 19, in pdf_recurse
PdfTitle = pdftitle.run(pdf=FilePath)
TypeError: run() got an unexpected keyword argument 'pdf'
Very sorry for the false path.