[python-win32] file name contains brackets got converted to %5B and %5D

Christoph J. Dorner christoph.dorner at gmx.de
Sat Apr 9 05:52:11 EDT 2022


Hi,

I am not sure If I gto the context, it is hard to understand what you
have done witht he limited description.

But I guess you passed a filename to a COM object ?
Try to escape the brackets.
And check for problems arising a) from the different notation
conventions for pathnames and b) differences in unicode treatment in
Python an COM.

Regards
Christoph



Am 08.04.2022 um 04:11 schrieb Jeffery Liao (廖弈全):
>
> Hi,
>
> My docx file name contains brackets ([ and ]) and those brackets were
> changed to %5B and %5D after I convert the docx to pdf.
>
> e.g.
>
> before: name_[project_id]_date.docx
>
> after: name_%5Bproject_id%5D_date.pdf
>
> I've searched Document.ExportAsFixedFormat
> <https://docs.microsoft.com/en-us/office/vba/api/word.document.exportasfixedformat>
> method (Word) and didn't find any option to change this behavior.
>
> Is there any way to keep the brackets in file name?
>
> Version of Python and pywin32:
>
> Python v3.8.10, pywin32 v300
>
> Best regards
> Jeffery
>
>
> This message contains confidential information and is intended only
> for the individual(s) addressed in the message. If you aren't the
> named addressee, you should not disseminate, distribute, or copy this
> e-mail. If you aren't the intended recipient, you are notified that
> disclosing, distributing, or copying this e-mail is strictly prohibited.
>
> ACT Genomics Holdings Co. Ltd. and its subsidiaries
> <https://www.actgenomics.com/en>
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20220409/141fb278/attachment.html>


More information about the python-win32 mailing list