From 8038d3c3b059cf38f0574e9e5bb6d6b4b0bf92fe Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Thu, 6 Apr 2023 19:06:56 +1000
Subject: [PATCH] Fix #104510: X3D & BVH import error with Python 3.11

Remove unsupported 'rU' for file writing.
---
 io_anim_bvh/import_bvh.py  | 2 +-
 io_scene_x3d/import_x3d.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_anim_bvh/import_bvh.py b/io_anim_bvh/import_bvh.py
index 025d5bde6..c02ea9548 100644
--- a/io_anim_bvh/import_bvh.py
+++ b/io_anim_bvh/import_bvh.py
@@ -98,7 +98,7 @@ def sorted_nodes(bvh_nodes):
 def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
     # File loading stuff
     # Open the file for importing
-    file = open(file_path, 'rU')
+    file = open(file_path, 'r')
 
     # Separate into a list of lists, each line a list of words.
     file_lines = file.readlines()
diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index 480bb787a..784163950 100644
--- a/io_scene_x3d/import_x3d.py
+++ b/io_scene_x3d/import_x3d.py
@@ -1256,7 +1256,7 @@ def gzipOpen(path):
 
     if data is None:
         try:
-            filehandle = open(path, 'rU', encoding='utf-8', errors='surrogateescape')
+            filehandle = open(path, 'r', encoding='utf-8', errors='surrogateescape')
             data = filehandle.read()
             filehandle.close()
         except:
-- 
GitLab