From: Günter M. <mi...@us...> - 2021-11-15 18:12:19
|
- **status**: open --> open-fixed - **Comment**: Thank you for the report and patch proposal. An updated variant of your proposal is applied in r8888 and should fix the issue. --- ** [bugs:#350] odf_odt Writer prints "The system cannot find the path specified" on Windows** **Status:** open-fixed **Created:** Mon Aug 20, 2018 01:43 PM UTC by Ovidiu Ciule **Last Updated:** Tue Mar 03, 2020 09:41 PM UTC **Owner:** nobody Hi there, The odf_odt Writer currently prints an error message on Windows that cannot be captured with the usual stdout/stderr capture techniques, since it originates in a popen. To reproduce, it's enough to call "rst2odt.py some_valid_source.rst whatever.odt" I found the bug on Python 3.6.5 and Docutils 0.14, but the faulty popen call is present in latest docutils The output odt file is created as expected, but we see "The system cannot find the path specified" printed in the terminal. Worse, any application code using odf_odt Writer will print this error message. The message is not capturable AFAIK with the usual stdout/stderr techniques (contextlib.redirect_stdout or similar) since it originates in a popen call. The faulty popen call is in http://svn.code.sf.net/p/docutils/code/trunk/docutils/docutils/writers/odf_odt/__init__.py class ODFTranslator, method setup_paper: fin = os.popen("paperconf -s 2> /dev/null") On Windows, the "/dev/null" path does not exist (except specific cases such as the Windows 10 WSL Linux subsystem. The shell thus prints the error. I propose this patch which seems compatible with both Python > 2.4 and 3: fin = subprocess.check_output("paperconf -s", stderr=subprocess.DEVNULL) This is tested and works on windows with python 3. It should work fine on Linux and MacOS. --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |