Closed sk286102 closed 2 months ago
Hi @sk286102 when you say red cross error you mean these errors?:
If that is the case, those are just messages from the code analysis package that Spyder uses (which does a static code analysis). Since seems like you are able to run your code without issue my guess is those errors/warnings are false positives and you can ignore them (probably running one of the early imports you have in your code makes the mentioned definitions available somehow at runtime).
If the above makes sense, to make Spyder ignore specific lines and prevent specific errors/warning messages to appear in that section of the editor you can write a # noqa
comment at the end of the specific line you want to be ignored. With that in mind, that last part of your code could end up looking something like:
# %%
# Configure graphics for image export
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ExtAPI.Graphics.Camera.SetSpecificViewOrientation(ViewOrientationType.Iso) # noqa
ExtAPI.Graphics.Camera.SetFit() # noqa
image_export_format = GraphicsImageExportFormat.PNG # noqa
settings_720p = Ansys.Mechanical.Graphics.GraphicsImageExportSettings() # noqa
settings_720p.Resolution = GraphicsResolutionType.EnhancedResolution # noqa
settings_720p.Background = GraphicsBackgroundType.White # noqa
settings_720p.Width = 1280
settings_720p.Height = 720
settings_720p.CurrentGraphicsDisplay = False
And with that no errors should appear:
For more info about the static code analysis tools that Spyder uses you can check the Spyder docs page: https://docs.spyder-ide.org/current/panes/editor.html?#linting-and-code-style
Let us know if the info above helps!
Closing due to lack of response
I am running the above program for the first time in spyder 3.10. This program gives the correct output but in the workspace on the left hand side it shows red cross error and stating that Undefined name for the line which contains ExtAPI,ViewOrientationType,Ansys,GraphicsResolutionType,GraphicsBackgroundType.
Is there any module that I need to import in my code?