[Rdkit-discuss] Rev. 5775 (Windows) - pyGraphMolWrap test fails

2015-07-13 Thread James Davidson
Dear All,

I have just built revision 5775 on Windows, and the pyGraphMolWrap test fails.  
The relevant bit of the verbose output is below:

78: ERROR: testGithub498 (__main__.TestCase)
78: --
78: Traceback (most recent call last):
78:   File C:/RDKit/Code/GraphMol/Wrap/rough_test.py, line 3033, in 
testGithub498
78: outf = gzip.open(tempfile.mktemp(),'wt+')
78:   File C:\Anaconda\lib\gzip.py, line 34, in open
78: return GzipFile(filename, mode, compresslevel)
78:   File C:\Anaconda\lib\gzip.py, line 94, in __init__
78: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
78: ValueError: Invalid mode ('wt+b')


This seems to be due to a difference in python/gzip behaviour on Windows vs. eg 
Linux:

On Ubuntu (Anaconda python):

In [1]: import tempfile, gzip
In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')
In [3]:


On Windows (again Anaconda python):

In [1]: import tempfile, gzip
In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')
---
ValueErrorTraceback (most recent call last)
ipython-input-2-6bee12287576 in module()
 1 outf = gzip.open(tempfile.mktemp(), 'wt+')

C:\Anaconda\lib\gzip.pyc in open(filename, mode, compresslevel)
 32
 33 
--- 34 return GzipFile(filename, mode, compresslevel)
 35
 36 class GzipFile(io.BufferedIOBase):

C:\Anaconda\lib\gzip.pyc in __init__(self, filename, mode, compresslevel, 
fileobj, mtime)
 92 mode += 'b'
 93 if fileobj is None:
--- 94 fileobj = self.myfileobj = __builtin__.open(filename, mode 
or 'rb')
 95 if filename is None:
 96 # Issue #13781: os.fdopen() creates a fileobj with a bogus 
name

ValueError: Invalid mode ('wt+b')

In [3]:



Is this an easy one to fix?

Kind regards

James

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the Company address and 
registration details link at the bottom of the page..
__--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Rev. 5775 (Windows) - pyGraphMolWrap test fails

2015-07-13 Thread Nicholas Firth
Looks like the problem opening the file with the extra parameters used ('t+') 
as the gzip module just sticks a 'b' on the end of the opening mode

if mode and 'b' not in mode:
mode += 'b'

The test should run if line 3033 is changed from
 outf = gzip.open(tempfile.mktemp(),'wt+')
to
 outf = gzip.open(tempfile.mktemp(),'wb+')

which I would put right but I still have zero idea how to use git :)

The more interesting question is why does this work on Unix/Mac but not on 
Windows, and why do you get this error when it's not in the gzip code?


Best,
Nick

Nicholas C. Firth | PhD Student | Cancer Therapeutics
The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | Surrey 
| SM2 5NG
T 020 8722 4033 | E nicholas.fi...@icr.ac.ukmailto:nicholas.fi...@icr.ac.uk | 
W www.icr.ac.ukhttp://www.icr.ac.uk/ | Twitter 
@ICRnewshttps://twitter.com/ICRnews
Facebook 
www.facebook.com/theinstituteofcancerresearchhttp://www.facebook.com/theinstituteofcancerresearch
Making the discoveries that defeat cancer

[cid:image001.gif@01CE053D.51D3C4E0]

On 13 Jul 2015, at 15:16, James Davidson 
j.david...@vernalis.commailto:j.david...@vernalis.com wrote:

gzip.pyc


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Rev. 5775 (Windows) - pyGraphMolWrap test fails

2015-07-13 Thread Greg Landrum
Just a quick FYI that Paolo's PR has been accepted in github.

I'm still digging out from the email from last week, so  I'm slow.

-greg


On Tue, Jul 14, 2015 at 12:23 AM, Paolo Tosco paolo.to...@unito.it wrote:

  Hi James,

 I just submitted a pull request about this; a patch is attached to this
 e-mail. To apply the patch, cd to $RDBASE and issue the following command:

 patch -p0  patch20150713.txt

 Best,
 p.


 On 13/07/2015 15:16, James Davidson wrote:

  Dear All,



 I have just built revision 5775 on Windows, and the pyGraphMolWrap test
 fails.  The relevant bit of the verbose output is below:



 78: ERROR: testGithub498 (__main__.TestCase)

 78: --

 78: Traceback (most recent call last):

 78:   File C:/RDKit/Code/GraphMol/Wrap/rough_test.py, line 3033, in
 testGithub498

 78: outf = gzip.open(tempfile.mktemp(),'wt+')

 78:   File C:\Anaconda\lib\gzip.py, line 34, in open

 78: return GzipFile(filename, mode, compresslevel)

 78:   File C:\Anaconda\lib\gzip.py, line 94, in __init__

 78: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')

 78: ValueError: Invalid mode ('wt+b')





 This seems to be due to a difference in python/gzip behaviour on Windows
 vs. eg Linux:



 *On Ubuntu (Anaconda python):*



 In [1]: import tempfile, gzip

 In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')

 In [3]:





 *On Windows (again Anaconda python):*



 In [1]: import tempfile, gzip

 In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')

 ---

 ValueErrorTraceback (most recent call last)

 ipython-input-2-6bee12287576 in module()

  1 outf = gzip.open(tempfile.mktemp(), 'wt+')



 C:\Anaconda\lib\gzip.pyc in open(filename, mode, compresslevel)

  32

  33 

 --- 34 return GzipFile(filename, mode, compresslevel)

  35

  36 class GzipFile(io.BufferedIOBase):



 C:\Anaconda\lib\gzip.pyc in __init__(self, filename, mode, compresslevel,
 fileobj, mtime)

  92 mode += 'b'

  93 if fileobj is None:

 --- 94 fileobj = self.myfileobj = __builtin__.open(filename,
 mode or 'rb')

  95 if filename is None:

  96 # Issue #13781: os.fdopen() creates a fileobj with a
 bogus name



 ValueError: Invalid mode ('wt+b')



 In [3]:







 Is this an easy one to fix?



 Kind regards



 James

 __
 PLEASE READ: This email is confidential and may be privileged. It is
 intended for the named addressee(s) only and access to it by anyone else is
 unauthorised. If you are not an addressee, any disclosure or copying of the
 contents of this email or any action taken (or not taken) in reliance on it
 is unauthorised and may be unlawful. If you have received this email in
 error, please notify the sender or postmas...@vernalis.com. Email is not
 a secure method of communication and the Company cannot accept
 responsibility for the accuracy or completeness of this message or any
 attachment(s). Please check this email for virus infection for which the
 Company accepts no responsibility. If verification of this email is sought
 then please request a hard copy. Unless otherwise stated, any views or
 opinions presented are solely those of the author and do not represent
 those of the Company.

 The Vernalis Group of Companies
 100 Berkshire Place
 Wharfedale Road
 Winnersh, Berkshire
 RG41 5RD, England
 Tel: +44 (0)118 938 

 To access trading company registration and address details, please go to
 the Vernalis website at www.vernalis.com and click on the Company
 address and registration details link at the bottom of the page..
 __


 --
 Don't Limit Your Business. Reach for the Cloud.
 GigeNET's Cloud Solutions provide you with the tools and support that
 you need to offload your IT needs and focus on growing your business.
 Configured For All Businesses. Start Your Cloud 
 Today.https://www.gigenetcloud.com/



 ___
 Rdkit-discuss mailing 
 listRdkit-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/rdkit-discuss




 --
 Don't Limit Your Business. Reach for the Cloud.
 GigeNET's Cloud Solutions provide you with the tools and support that
 you need to offload your IT needs and focus on growing your business.
 Configured For All Businesses. Start Your Cloud Today.
 https://www.gigenetcloud.com/
 ___
 Rdkit-discuss mailing list
 Rdkit-discuss@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/rdkit-discuss