From db61a1b25a8d1c4097de54dda588ae45f64e9cf5 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Fri, 30 Jun 2017 11:27:08 +1000
Subject: [PATCH] Fix version check for PLY

Some programs wrote extra trailing zeros.
Alternate fix to D2692.
---
 io_mesh_ply/import_ply.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py
index 76e5ff1e0..eb097ba92 100644
--- a/io_mesh_ply/import_ply.py
+++ b/io_mesh_ply/import_ply.py
@@ -185,9 +185,15 @@ def read(filepath):
                 if tokens[1] not in format_specs:
                     print('Unknown format', tokens[1])
                     return invalid_ply
-                if tokens[2] != version:
+                try:
+                    version_test = float(tokens[2])
+                except Exception as ex:
+                    print('Unknown version', ex)
+                    version_test = None
+                if version_test != float(version):
                     print('Unknown version', tokens[2])
                     return invalid_ply
+                del version_test
                 format = tokens[1]
             elif tokens[0] == b'element':
                 if len(tokens) < 3:
-- 
GitLab