Enag2000 added a comment.
In T346417#9389468 <https://phabricator.wikimedia.org/T346417#9389468>, @Xqt wrote: > In T346417#9389162 <https://phabricator.wikimedia.org/T346417#9389162>, @Enag2000 wrote: > >> In T346417#9387794 <https://phabricator.wikimedia.org/T346417#9387794>, @Xqt wrote: >> >>> @Enag2000: Could you please provide a command line wich produces this exception above for CR >> >> Yes. Running the following on English Wikipedia will produce the exception seen above. This assumes that the directory "InvalidDirectory" does not exist. >> >> pwb.py -v category_graph -from Equations -to InvalidDirectory\Equations > > But your patch does not solve that: > > D:\pwb\GIT\core>pwb.py -simulate category_graph -from Equations -to InvalidDirectory\Equations > Scanning 'Equations' > Saving results > InvalidDirectory\Equations.gv > Traceback (most recent call last): > File "D:\pwb\GIT\core\pwb.py", line 39, in <module> > sys.exit(main()) > ^^^^^^ > File "D:\pwb\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 "D:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 515, in <module> > main() > File "D:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 499, in main > if not execute(): > ^^^^^^^^^ > File "D:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 486, in execute > run_python_file(filename, script_args, module) > File "D:\pwb\GIT\core\pywikibot\scripts\wrapper.py", line 147, in run_python_file > exec(compile(source, filename, 'exec', dont_inherit=True), > File "D:\pwb\GIT\core\scripts\category_graph.py", line 230, in <module> > bot.run() > File "D:\pwb\GIT\core\scripts\category_graph.py", line 184, in run > self.dot.write(self.to + '.gv', encoding='utf-8') > File "C:\Python311\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: 'InvalidDirectory\\Equations.gv' > CRITICAL: Exiting due to uncaught exception FileNotFoundError: [Errno 2] No such file or directory: 'InvalidDirectory\\Equations.gv' Interesting. I just realized that I provided a path with '\' instead of '/' in my comment. The original exception in the issue body uses '/' and the solution was coded for ONLY '/', which is why the exception occurs with the command I sent. Running `pwb.py -v category_graph -from Equations -to InvalidDirectory\Equations` will not produce the exception. Given that file paths with either slash direction are valid, I can revise the solution to account for either scenario? I missed this when originally looking at the issue. Good catch and thanks for taking the time to review. TASK DETAIL https://phabricator.wikimedia.org/T346417 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Enag2000 Cc: Xqt, Aklapper, pywikibot-bugs-list, Enag2000, mevo, Isabelladantes1983, Themindcoder, Adamm71, Jersione, Hellket777, LisafBia6531, 786, Biggs657, PotsdamLamb, Jyoo1011, JohnsonLee01, Juan90264, SHEKH, Dijkstra, Alter-paule, Beast1978, Un1tY, Khutuck, Zkhalido, Hook696, Kent7301, joker88john, Viztor, CucyNoiD, Wenyi, Gaboe420, Giuliamocci, Cpaulf30, Af420, Bsandipan, Tbscho, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, Dvorapa, Altostratus, Neuronton, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________ pywikibot-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected]
