Permalink
Browse files

git-svn-id: http://evserver.googlecode.com/svn/trunk@71 e9bb6d7e-af12…

…-11dd-bad7-87afd3b02348
  • Loading branch information...
1 parent ecd2ce5 commit 23ccf905427c6b9249b9e856ab5384864761e6cb majek04 committed Jan 27, 2009
Showing with 10 additions and 4 deletions.
  1. +10 −4 evserver/server.py
View
@@ -11,17 +11,23 @@
v = ctypes.libeventbinary_version.replace('-','_').replace('.','_')
oldcwd = os.getcwd()
-os.chdir( resource_filename(__name__, '') )
+os.chdir( os.path.join(resource_filename(__name__, ''), '..') )
-modulename = 'ctypes_event_%s' % v
+modulename = 'evserver.ctypes_event_%s' % v
try:
- libevent = __import__(modulename)
+ def my_import(name):
+ mod = __import__(name)
+ components = name.split('.')
+ for comp in components[1:]:
+ mod = getattr(mod, comp)
+ return mod
+ libevent = my_import(modulename)
except (AttributeError, ImportError), e:
raise Exception("**** libevent ctypes bindings %r are broken - probably wrong version of binary ****\n" % (modulename,)+
" currently, libevent.so is loaded from %r \n" %(ctypes.libeventbinary,)+
" try to specify different 'libevent.so' using '--libevent </path/to/libevent.so> \n"+
" if that fails, try to create new ctypes bindings for libevent using 'make bindings'\n"+
- " Tried to load the bindings from directory %r\n" % (os.getcwd(),) + str(e))
+ " Tried to load the bindings from directory: %r\nError message: %r\n" % (os.getcwd(), str(e)) )
os.chdir( oldcwd )

0 comments on commit 23ccf90

Please sign in to comment.