[Pyrex] Newbie qustion

vanitha at cs.wisc.edu vanitha at cs.wisc.edu
Fri Nov 25 14:33:54 CET 2005


Hi All,
I'm new to Pyrex and Python, so you'll have to pardon me if this is a
silly question!

I ran a simple example to test Pyrex. I used the one given in
http://cfl-x.uwindsor.ca/graham/pyrex/

I have a file foo.pyx that has the following code in it:
"""A simple extension module example"""

cdef class Foo:
	"""A foo, like any other.
	Create one with Foo(s), where s is the name to assign to your foo."""

	cdef char *name

	def __init__(self, name):
		self.name = name

	def __repr__(self):
		return "A Foo named %s." % (self.name)

I have a setup.py that has the following code in it:

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

setup(name='foo', ext_modules=[Extension("foo", ["foo.pyx"])],
	cmdclass = {'build_ext': build_ext}
)

I run python setup.py build_ext --inplace
and end up getting the following errors:

running build_ext
building 'foo' extension
Traceback (most recent call last):
  File "setup.py", line 6, in ?
    cmdclass = {'build_ext' : build_ext}
  File "/afs/cs.wisc.edu/u/v/a/vanitha/lib/python2.4/distutils/core.py",
line 149, in setup
    dist.run_commands()
  File "/afs/cs.wisc.edu/u/v/a/vanitha/lib/python2.4/distutils/dist.py",
line 946, in run_commands
    self.run_command(cmd)
  File "/afs/cs.wisc.edu/u/v/a/vanitha/lib/python2.4/distutils/dist.py",
line 966, in run_command
    cmd_obj.run()
  File
"/afs/cs.wisc.edu/u/v/a/vanitha/lib/python2.4/distutils/command/build_ext.py",
line 279, in run
    self.build_extensions()
  File
"/afs/cs.wisc.edu/u/v/a/vanitha/lib/python2.4/distutils/command/build_ext.py",
line 405, in build_extensions
    self.build_extension(ext)
  File
"/afs/cs.wisc.edu/u/v/a/vanitha/lib/python2.4/distutils/command/build_ext

What am I missing here?

Thanks,

- Vanitha





More information about the Pyrex mailing list