help with a com object
Scott Hathaway
slhath at home.com.nospam
Wed Aug 30 11:23:48 EDT 2000
After trying the following (per the suggestions I have gotten) I get the
same error.
class PythonDir:
_public_methods_ = [ 'GetListing' ]
_reg_progid_ = "PythonDir.Utils"
_reg_clsid_ = "{95CBD1B0-7E6F-11D4-AB71-0000929181BF}"
def GetListing(self, thePath, theType):
import os
myFiles = os.listdir(thePath)
for x in myFiles :
if theType == "f":
if os.path.isfile(thePath + x):
print x + '|',
else:
if os.path.isdir(thePath + x):
print x + '|',
if __name__=='__main__':
print "Registering COM Server..."
import win32com.server.register
win32com.server.register.UseCommandLine(PythonDir)
Please help!
Scott
"Arpad Kiss" <sekter at matavnet.hu> wrote in message
news:004a01c0128b$1b8d67e0$3404a8c0 at geometria.hu...
> Hi,
> The methods first parameter is always an instance variable(usually named
> self).
> Arpad
>
> Scott Hathaway <slhath at home.com.nospam> wrote in message
> news:E_7r5.914$qO1.64948 at news.flash.net...
> > Hello All,
> >
> > I am trying to create a COM object in python to use with PHP 4. I have
> > listed the entire code below. All I want it to do is have one method
that
> > is passed a directory to scan and a flag that tells to return subfolders
> or
> > files. From PHP, I can instantiate the COM object without errors, but
it
> > fails with an exception on the call to GetListing.
> >
> > class PythonDir:
> > _public_methods_ = [ 'GetListing' ]
> > _reg_progid_ = "PythonDir.Utils"
> > _reg_clsid_ = "{95CBD1B0-7E6F-11D4-AB71-0000929181BF}"
> >
> > def GetListing(str(thePath), str(theType)):
> > import os
> > myFiles = os.listdir(thePath)
> > for x in myFiles :
> > if theType == "f":
> > if os.path.isfile(thePath + x):
> > print x + '|',
> > else:
> > if os.path.isdir(thePath + x):
> > print x + '|',
> >
> > if __name__=='__main__':
> > print "Registering COM Server..."
> > import win32com.server.register
> > win32com.server.register.UseCommandLine(PythonDir)
> >
> > Here is the php code:
> >
> > $pyCOM = new COM("PythonDir.Utils");
> > $pyCOM->GetListing("c:\\", "f");
> >
> > Please help!
> >
> > Thanks,
> > Scott
> >
> >
> > --
> > http://www.python.org/mailman/listinfo/python-list
> >
>
>
More information about the Python-list
mailing list