Skip to content

SyntaxWarning in ece_export_for_twinbuilder.py example #551

@james-packer

Description

@james-packer

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

In the ece_export_for_twinbuilder.py example, the '' character is used in quite a few places as a line continuation character while generating the SML output.

When building the documentation in newer versions of Python, this flags up that we are using unescaped '' characters in quite a few places:

There seem to be 7 locations where this is done:
:690: SyntaxWarning: invalid escape sequence '\ '
:693: SyntaxWarning: invalid escape sequence '\ '
:704: SyntaxWarning: invalid escape sequence '\ '
:713: SyntaxWarning: invalid escape sequence '\ '
:722: SyntaxWarning: invalid escape sequence '\ '
:730: SyntaxWarning: invalid escape sequence '\ '
:734: SyntaxWarning: invalid escape sequence '\ '
generating gallery for examples\links... [ 50%] ece_export_for_twinbuilder.py

If we had "\" as a string, this would give us a syntax error, but as we effectively have "\ " this just raises a SyntaxWarning, and the SML file seems to be generated as expected.

I think the fix is as simple as replacing the 7 instances of '\ ' with '\\ ' (see https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences).

📝 Steps to reproduce

Not relevant

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

Not relevant

🐍 Which Python version are you using?

3.9

📦 Installed packages

Not relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions