Currently, invalid file paths passed in via the -to argument result in an unhandled FileNotFoundError exception. This exception only occurs after all of the subcategories have been added to the graph object, which could take a considerable amount of time on large categories.
Full Traceback:
Traceback (most recent call last):
File "C:\git\core\pwb.py", line 39, in <module>
sys.exit(main())
^^^^^^
File "C:\git\core\pwb.py", line 35, in main
runpy.run_path(str(path), run_name='__main__')
File "<frozen runpy>", line 291, in run_path
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "C:\git\core\pywikibot\scripts\wrapper.py", line 513, in <module>
main()
File "C:\git\core\pywikibot\scripts\wrapper.py", line 497, in main
if not execute():
^^^^^^^^^
File "C:\git\core\pywikibot\scripts\wrapper.py", line 484, in execute
run_python_file(filename, script_args, module)
File "C:\git\core\pywikibot\scripts\wrapper.py", line 147, in run_python_file
exec(compile(source, filename, 'exec', dont_inherit=True),
File "C:\git\core\scripts\category_graph.py", line 209, in <module>
bot.run()
File "C:\git\core\scripts\category_graph.py", line 179, in run
self.dot.write(self.to + '.gv', encoding='utf-8')
File "C:\python\Lib\site-packages\pydot.py", line 1825, in write
with io.open(path, mode='wt', encoding=encoding) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent_directory/equations.gv'
Dropped throttle(s).
Closing network session.
Traceback (most recent call last):
File "C:\git\core\pwb.py", line 39, in <module>
sys.exit(main())
^^^^^^
File "C:\git\core\pwb.py", line 35, in main
runpy.run_path(str(path), run_name='__main__')
File "<frozen runpy>", line 291, in run_path
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "C:\git\core\pywikibot\scripts\wrapper.py", line 513, in <module>
main()
File "C:\git\core\pywikibot\scripts\wrapper.py", line 497, in main
if not execute():
^^^^^^^^^
File "C:\git\core\pywikibot\scripts\wrapper.py", line 484, in execute
run_python_file(filename, script_args, module)
File "C:\git\core\pywikibot\scripts\wrapper.py", line 147, in run_python_file
exec(compile(source, filename, 'exec', dont_inherit=True),
File "C:\git\core\scripts\category_graph.py", line 209, in <module>
bot.run()
File "C:\git\core\scripts\category_graph.py", line 179, in run
self.dot.write(self.to + '.gv', encoding='utf-8')
File "C:\python\Lib\site-packages\pydot.py", line 1825, in write
with io.open(path, mode='wt', encoding=encoding) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent_directory/equations.gv'
CRITICAL: Exiting due to uncaught exception FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent_directory/equations.gv'This input should be either checked at the beginning of program execution and rejected gracefully if invalid, or the program should create the directories necessary for the file path if they do not exist.