On 2016-09-26 11:25, Sergi Almacellas Abellana wrote:
> On python2 everything is working well, but in python3 I get the following
> error:
> 
> https://travis-ci.org/trytonspain/trytond-import_csv/jobs/162620003
> 
> This is because proteus does only accept bytes or bytearrays for Binary
> fields, but in python (both 2 and 3) read returns and str. See:
> 
> » python3
> Python 3.5.2 (default, Sep 10 2016, 08:21:44)
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> isinstance(open('default.csv').read(), str)
> True
> 
> Python 2.7.12 (default, Jul  1 2016, 15:12:24)
> [GCC 5.4.0 20160609] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> isinstance(open('default.csv').read(), str)
> True
> 
> Am I doing something wrong? Or it's a proteus bug and it should accept also
> string values for text files?

str in Python2 or Python3 is not the same thing.
You must use str in Python2 and bytes in Python3 for Binary field.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20160926094005.GD21733%40tetsuo.

Reply via email to