Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New compatibility for Salome 9, with python 2+3 support #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meritzio
Copy link
Contributor

@meritzio meritzio commented May 3, 2019

The new major version of Salome 9 has now adopted the use of python3 for its scripting. Old python 2 methodology such as the print function being used without calling brackets has now been removed and meant that the script would no longer run in Salome 9. I have implemented python 2/3 compatibility to handle such issues.

  • print has been applied for both python 2 and 3 to feature calling brackets. print 'hello' -> print('hello')
  • The deprecation of xrange in python3 has been replaced with range in python3. This does not affect performance.
  • Salome 9 no longer accepts arguments in updating the object browser. salome.sg.updateObjBrowser(1) -> salome.sg.updateObjBrowser()

I have tested the script on Salome major versions 8 and 9 and seen no issue with the script.

Additionally I have made the source code more pythonic and added a reference to the source code repository within the polyMesh headers so that users can easily check for script updates.

@meritzio
Copy link
Contributor Author

meritzio commented May 3, 2019

I hope you are doing well Nicolas!

One thing I might look at soon with this script, given that python 3 has better support for binary data, is adding an option to export binary polyMeshes. I think this would improve writing speed somewhat and reduce polyMesh file sizes significantly.

@meritzio meritzio mentioned this pull request Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants