Trying to wrap SFML Window; getting "ImportError: No module named 'ExprNodes'"

40 views
Skip to first unread message

Goran Milovanovic

unread,
May 21, 2013, 3:51:07 AM5/21/13
to cython...@googlegroups.com
# sfml.pxd:

cdef extern from "SFML/Window.hpp" namespace "sf":

cdef cppclass VideoMode:
VideoMode(unsigned int, unsigned int) except +

cdef cppclass Window:
Window(VideoMode, String) except + 
void display()



# display.pyx:

cimport sfml

cdef class Window:

cdef sfml.Window* _this

def __cinit__(self, unsigned int width, unsigned int height):

self._this = new sfml.Window(sfml.VideoMode(width, height), "title")
def __dealloc__(self):

del self._this

def display(self):
self._this.display()


# setup.py:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [
Extension("display", ["display.pyx"],
language='c++',
libraries=["sfml-system", "sfml-window"])
]
)


The error when running `python setup.py build`:

running build
running build_ext
cythoning display.pyx to display.cpp
Traceback (most recent call last):
  File "setup.py", line 10, in <module>
    libraries=["sfml-system", "sfml-window"])
  File "/usr/lib/python3.3/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.3/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.3/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.3/distutils/command/build.py", line 126, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.3/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.3/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.3/site-packages/Cython/Distutils/build_ext.py", line 163, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib/python3.3/distutils/command/build_ext.py", line 354, in run
    self.build_extensions()
  File "/usr/lib/python3.3/site-packages/Cython/Distutils/build_ext.py", line 170, in build_extensions
    ext.sources = self.cython_sources(ext.sources, ext)
  File "/usr/lib/python3.3/site-packages/Cython/Distutils/build_ext.py", line 317, in cython_sources
    full_module_name=module_name)
  File "/usr/lib/python3.3/site-packages/Cython/Compiler/Main.py", line 608, in compile
    return compile_single(source, options, full_module_name)
  File "/usr/lib/python3.3/site-packages/Cython/Compiler/Main.py", line 549, in compile_single
    return run_pipeline(source, options, full_module_name)
  File "/usr/lib/python3.3/site-packages/Cython/Compiler/Main.py", line 386, in run_pipeline
    from . import Pipeline
  File "/usr/lib/python3.3/site-packages/Cython/Compiler/Pipeline.py", line 7, in <module>
    from .Visitor import CythonTransform
  File "Visitor.py", line 10, in init Cython.Compiler.Visitor (/build/src/Cython-0.19/Cython/Compiler/Visitor.c:15987)
ImportError: No module named 'ExprNodes'

Apparently, it can't find something called 'ExprNodes', but I don't think that my Cython installation is broken, because I managed to successfully wrap a different C++ library some time ago (reference), and I didn't run into this problem.

I'm using Cython 0.19.

I would appreciate any help/insight that you could offer.

Thanks.
Reply all
Reply to author
Forward
0 new messages