I am looking to try porting over my application from Python 2.7 to Python
3.6 and have run into snags.
The first being that Pyglet uses BytesIO for version 3 instead of StringIO.
I am using a ZIPLocation.
I can no longer seem to use pyglet.resource.file for things that require a
file-like object.
Example:
```
#!python
cfg = configparser.ConfigParser()
file_obj = pyglet.resource.file(filename)
cfg.read_file(file_obj)
```
Will produce an error:
```
#!python
File "c:\python36-32\lib\configparser.py", line 1031, in _read
if line.strip().startswith(prefix):
builtins.TypeError: startswith first arg must be bytes or a tuple of bytes,
not
str
```
However BytesIO should be considered bytes? If I try to convert the BytesIO
to pure bytes like it says it wants, using:
```
#!python
file_obj = pyglet.resource.file(filename).getvalue()
```
I then get the error:
```
#!python
File "c:\python36-32\lib\configparser.py", line 1031, in _read
if line.strip().startswith(prefix):
```
builtins.AttributeError: 'int' object has no attribute 'strip'
I can't seem to get this BytesIO to actually work as a file-like object.
What am I missing?
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.