opened
ptosco
username_0
- Small change to enable timings to be collected on Windows with Python 3
Timings on Windows with Python 3
issue
created
greglandrum
username_1
@username_0 what about doing it this way instead?
```(py27_rdkit) glandrum@Otter:/scratch/RDKit_git/Regress/Scripts$ git diff
diff --git a/Regress/Scripts/timings.py b/Regress/Scripts/timings.py
index 88e42cf..5dfc486 100644
--- a/Regress/Scripts/timings.py
+++ b/Regress/Scripts/timings.py
@@ -15,7 +15,7 @@ if len(sys.argv)>1:
         tests[x] = 1
 ts = []
 
-sdData = gzip.open('../Data/mols.1000.sdf.gz','rt').read()
+sdData = gzip.open('../Data/mols.1000.sdf.gz').read()
 logger.info('mols from sdf')
 suppl = Chem.SDMolSupplier()
 suppl.SetData(sdData)
@@ -34,13 +34,13 @@ logger.info('Results1: %.2f seconds, %d passed, %d failed'%(t2-t1,nMols,nBad))
 ts.append(t2-t1)
 
 if tests[2]:
-    lines = gzip.open('../Data/mols.1000.txt.gz','rt').readlines()
+    lines = gzip.open('../Data/mols.1000.txt.gz').readlines()
     logger.info('mols from smiles')
     nMols=0
     nBad=0
     t1=time.time()
     for line in lines:
-        line = line.strip().split(' ')
+        line = line.decode().strip().split(' ')
         m = Chem.MolFromSmiles(line[1])
         if m:
             nMols+=1
@@ -51,8 +51,8 @@ if tests[2]:
     ts.append(t2-t1)
 
 if tests[3] or tests[4] or tests[5]:
-    pattData = gzip.open('../Data/queries.txt.gz','rt').readlines()
-    pattData = [x.strip().replace('[H]','').replace('()','') for x in pattData]
+    pattData = gzip.open('../Data/queries.txt.gz').readlines()
+    pattData = [x.decode().strip().replace('[H]','').replace('()','') for x in pattData]
     logger.info('patterns from smiles')
     patts = []
     t1=time.time()
@@ -224,6 +224,6 @@ if tests[17]:
     ts.append(t2-t1)
 
 
-    
+
 
 print('times: ',' || '.join(['%.1f'%x for x in ts]))
```
comment
created
ptosco
username_0
Yes, of course. I have become overly paranoid about 'rt' and 'rb' in connection with Windows because of the CR+LF issue, but here I can relax :-)
comment