Welcome, Guest
Username: Password: Remember me

TOPIC: python2.7 to python3.8.3

python2.7 to python3.8.3 4 years 4 months ago #36223

  • Gareth
  • Gareth's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 46
Hello!

I have exchanged the old version of python2.7.5 to Python3.8.3 (winpython) for V8P1.Then,an error occurred while running a case:

File "C:\opentelemac-mascaret\V8P1\scripts\python3\execution\telemac_cas.py", line 82, in _parse_cas
for line in f.readlines():
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 1178: illegal multibyte sequence.

I modified line 81 in "telemac_cas.py" (C:\opentelemac mascaret\V8P1\scripts\python3\execution).
"with open(self.file_name, 'r') as f:" To
"with open(self.file_name, 'r',encoding='utf-8') as f:"
After that,Telemac worked well, and the calculation results are the same as before (for python2.7.5).

I'm a rookie in code. Although it has been verified, I would like to ask if this change will affect the calculation.

Best Regards
Gareth
Attachments:
The administrator has disabled public write access.

python2.7 to python3.8.3 4 years 4 months ago #36261

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Hi,

Thanks for finding this bug.
I will fix that for the next release.

This should not affect your results.
It just means that there was a non utf8 character in your steering file. If it is in a comment it should be okay.
If it is in the name of a variable it can be problematic.

If you post your steering file I could tell you.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.
The following user(s) said Thank You: Gareth

python2.7 to python3.8.3 4 years 4 months ago #36272

  • Gareth
  • Gareth's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 46
Hello yugi. Thanks for your reply.

Here is my steering file (telemac2d+sisyphe).

Actually, I returned to the version of V8P0R0 for Telemac.Because I met other errors while testing the previous telemac2d and telemac3d cases which could word well in V8P0R0 and python3. I'm sorry I forgot to save the error messages.

Maybe the errors caused by some updates of v8p1.

Best regards
Gareth
Attachments:
The administrator has disabled public write access.

python2.7 to python3.8.3 4 years 4 months ago #36273

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
It is indeed from the comment so it is ok.

I would suggest trying again on v8p1. If you have the time.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.
The following user(s) said Thank You: Gareth

python2.7 to python3.8.3 4 years 4 months ago #36274

  • Gareth
  • Gareth's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 46
Hello yugi

I will try again on v8p1 after finishing the current work.

Best regards

Gareth
The administrator has disabled public write access.
Moderators: borisb

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.