[Pyrex] "import ... as ..." has different result in python vs pyrex

Dan dg at pnylab.com
Sat May 5 16:09:18 UTC 2007


If the following is run with Python:
	import dir.module as M
Then 'M' is the module 'dir.module', but when run as Pyrex 'M' is the
module 'dir'.  Buglet?

PS. Many thanks for Pyrex, it feels like it hits the sweet spot.

Here is the complete example:
	Python 2.3.4
	Pyrex 0.9.5.1a
	Linux i686
	
	Directory layout:
		dir/
			__init__.py
			module.so

	The code:
		import dir
		import dir.module as module_as
		from dir import module as module_from_as
		
		def main():
			print 'dir',dir
			print 'module_as',module_as
			print 'module_from_as',module_from_as
			
		if __name__=='__main__':
			main()
	
	Output when ran as Python:
		dir <module 'dir' from '/home/dg/dir/__init__.pyc'>
		module_as <module 'dir.module' from '/home/dg/dir/module.so'>
		module_from_as <module 'dir.module' from  '/home/dg/dir/module.so'>
	
	Output when ran as Pyrex:
		dir <module 'dir' from './dir/__init__.pyc'>
		module_as <module 'dir' from './dir/__init__.pyc'>		# DIFFERENT
		module_from_as <module 'dir.module' from './dir/module.so'>

-- 
Dan




More information about the Pyrex mailing list