Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - magikmw

Pages: [1]
1
Python / Problem with Image.load_from_file()
« on: October 29, 2012, 09:43:49 pm »
I'm having problems with loading a png into an Image object.
The same method works fine with Texture.

Code follows, first my call, and then the error.

# Load the icon file
icon = Image.load_from_file('game/pngs/icon.png')
window.set_icon(16,16,icon.get_pixels())

Traceback (most recent call last):
  File "/usr/lib/python3.3/runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python3.3/runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "game/__main__.py", line 302, in <module>
    main()
  File "game/__main__.py", line 281, in main
    icon = Image.load_from_file('game/pngs/icon.png')
  File "sfml.pyx", line 1870, in sfml.Image.load_from_file (src/sfml.cpp:23910)
TypeError: expected bytes, str found
 

I'm thinking it's an API error or maybe I'm doing something wrong?

Edit:
Oh, and I'm using SFML 2.0 RC1, pySFML build from tar on github, and Python3.3

Pages: [1]