Including python script in executable ile is a part of executable file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | def loadLibrary(lib,i=0,path=''):
#Uses: loadLibrary( 'libs.api.VKontakte' )
#print sys.path
#print 'loadLibrary( lib="'+lib+'", i='+str(i)+', path="'+path+'")'
s = lib.split('.')
if i == 0:
for pos in sys.path:
if os.path.isdir( pos ):
for p in os.listdir( pos + path ):
if os.path.isdir( p ):
if p == s[i]:
loadLibrary(lib,i=i+1,path=pos+'/'+p)
break
else:
if i < len(s)-1:
for pos in os.listdir( path ):
if os.path.isdir( path+'/'+pos ):
if pos == s[i]:
loadLibrary(lib,i=i+1,path=path+'/'+pos)
break
else:
possibilities = os.listdir( path )
for possibility in possibilities:
#print possibility[0:-3]
if possibility[0:-3] == s[i]:
#print 'Yes!'
fp = file(path + '/' + possibility)
exec fp in globals()
fp.close()
|