Re: Extensions on Linux: import without underscore?

2005-06-20 Thread Terry Hancock
On Monday 20 June 2005 06:39 am, Kent Johnson wrote: > Terry Hancock wrote: > > Okay, you may want a more elegant way to do this and other people > > have already responded to that point, but you do at least know you > > can just give it a new name: > > > > import _bright > > bright = _bright > >

Re: Extensions on Linux: import without underscore?

2005-06-20 Thread James Carroll
Swig actually was generating a bright.py file, but scons was leaving it in the source directory instead of putting it next to my SharedLibrary(). Once I moved the bright.py next to the _bright.so, it all worked with just import bright. Thanks everyone. My next trick is to try the same thing with

Re: Extensions on Linux: import without underscore?

2005-06-20 Thread Kent Johnson
Terry Hancock wrote: > Okay, you may want a more elegant way to do this and other people > have already responded to that point, but you do at least know you > can just give it a new name: > > import _bright > bright = _bright or more idiomatically and without adding _bright to the namespace: imp

Re: Extensions on Linux: import without underscore?

2005-06-19 Thread Terry Hancock
On Saturday 18 June 2005 10:35 pm, James Carroll wrote: > Hi, I'm creating an extension called _bright.so on linux. I can > import it with import _bright, but how can I import bright and get the > package? > > On windows, I've been able to import bright instead of import _bright, > but on Linux i

Re: Extensions on Linux: import without underscore?

2005-06-18 Thread Robert Kern
James Carroll wrote: > Thanks Robert. > >>Call it bright.so . > > If I rename it bright.so, then I get the error: > ImportError: dynamic module does not define init function (initbright) Sorry, I should have been clearer. Just renaming the file won't help. The init function also needs to be a

Re: Extensions on Linux: import without underscore?

2005-06-18 Thread James Carroll
Thanks Robert. > > Call it bright.so . > If I rename it bright.so, then I get the error: ImportError: dynamic module does not define init function (initbright) I'm using swig with the module declaration %module bright I've looked at some other source, and it looks like there are some good

Re: Extensions on Linux: import without underscore?

2005-06-18 Thread jchiang
Try SharedLibrary("bright.so", SHLIBPREFIX="", ...) The prefix option is documented here http://www.scons.org/doc/HTML/scons-man.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Extensions on Linux: import without underscore?

2005-06-18 Thread Robert Kern
James Carroll wrote: > Hi, I'm creating an extension called _bright.so on linux. I can > import it with import _bright, but how can I import bright and get the > package? > > On windows, I've been able to import bright instead of import _bright, That has to be a bug. You shouldn't rely on that b

Extensions on Linux: import without underscore?

2005-06-18 Thread James Carroll
Hi, I'm creating an extension called _bright.so on linux. I can import it with import _bright, but how can I import bright and get the package? On windows, I've been able to import bright instead of import _bright, but on Linux it seems to need the underscore. I'm tempted to create a bright.py w