Hi All,I found a problem when I run The MakeCOMServer.py script.
Hi gives me this error:
*********************************
Driver script
C:\Users\mboscolo\Desktop\R38\test\Com-Server\SimpleComClass\drivecomserver.py
created
Traceback (most recent call last):
File "MakeCOMServer.py", line 166, in <module>
create(args, debug, verbosity, workdir, ascii)
File "MakeCOMServer.py", line 97, in create
workdir=workdir, pathex=paths, comserver=1, ascii=ascii)
File "C:\Users\mboscolo\Desktop\R38\pyinstaller-trunk\Makespec.py",
line 151, in main
config = eval(open(configfile, 'r').read())
TypeError: coercing to Unicode: need string or buffer, NoneType found
It seems that from the main function the configfile attributes is null.
I fix it in this way :
def main(scripts, configfile=None, name=None, tk=0, freeze=0, console=1,
debug=0,
strip=0, upx=0, comserver=0, ascii=0, workdir=None,
pathex=[], version_file=None, icon_file=None, manifest=None,
resources=[], crypt=None, **kwargs):
try:
if configfile==None:
configfile=os.path.join(os.getcwd(),'config.dat')
config = eval(open(configfile, 'r').read())
In this way the script works fine but I'm still not able to regsvr32 the
dll created ..
Any Help ?
Thanks
Matteo
*This is my script*:
import win32com.client
class comtest(object):
_reg_clsid_ = "{CAB0ED28-43C2-4DAA-AF28-67B27FCCD581}"
_reg_desc_ = "python com test interface"
_reg_progid_ = "Python.comtest"
_public_methods_ = ['getValue','setValue']
def __init__(self):
self.value=0
def getValue(self):
return str(self.value)
def setValue(self,value):
self.value=value
if __name__=='__main__':
import win32com.server.register
win32com.server.register.UseCommandLine(comtest)
*
this is the spec file :*
# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'),
os.path.join(HOMEPATH,'support\\useUnicode.py'),
'C:\\Users\\mboscolo\\Desktop\\R38\\test\\Com-Server\\SimpleComClass\\drivecomserver.py'],
pathex=['C:\\Users\\mboscolo\\Desktop\\R38\\test\\COM-SE~1\\SIMPLE~1',
'C:\\Users\\mboscolo\\Desktop\\R38\\pyinstaller-trunk'])
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=1,
name=os.path.join('build\\pyi.win32\\drivecomserver',
'drivecomserver.exe'),
debug=1,
strip=0,
upx=0,
console=1 )
dll = DLL(pyz,
a.scripts,
exclude_binaries=1,
name=os.path.join('build\\pyi.win32\\drivecomserver',
'drivecomserver.dll'),
debug=1)
coll = COLLECT(exe, dll,
a.binaries,
a.zipfiles,
a.datas,
strip=0
upx=0,
name=os.path.join('dist', 'drivecomserver'))
*
this is the drive file:*
import sys
import string
import os
import pythoncom
pythoncom.frozen = 1
inprocess = getattr(sys, 'frozen', None)
import comserver
klasses = (comserver.comtest,)
def DllRegisterServer():
import win32com.server.register
win32com.server.register.RegisterClasses(*klasses)
return 0
def DllUnregisterServer():
import win32com.server.register
win32com.server.register.UnregisterClasses(*klasses)
return 0
if sys.frozen!="dll":
import win32com.server.localserver
for i in range(1, len(sys.argv)):
arg = string.lower(sys.argv[i])
if string.find(arg, "/reg") > -1 or string.find(arg, "--reg") > -1:
DllRegisterServer()
break
if string.find(arg, "/unreg") > -1 or string.find(arg,
"--unreg") > -1:
DllUnregisterServer()
break
# MS seems to like /automate to run the class factories.
if string.find(arg, "/automate") > -1:
clsids = []
for k in klasses:
clsids.append(k._reg_clsid_)
win32com.server.localserver.serve(clsids)
break
else:
# You could do something else useful here.
import win32api
win32api.MessageBox(0, "This program hosts a COM Object
and\r\nis started automatically", "COM Object")
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.