Hello,
I am trying to convert an Ironpython filewatcher program into a windows service. I started by translating a c# example to ipy. I tried to simply use System.ServiceProcess.ServiceBased, and received a message

"AttributeError: attribute 'ServiceProcess' of 'namespace#' object is read-only"

I also failed to import System.ServiceProcess.

I also tried to add a Reference to System.ServiceProcess.dll, and even that did not work.

Here are the code snippets ...

    # coding: latin-1
    import System
    import clr
    #clr.AddReference("System.ServiceProcess.dll")  # fails
    #import System.ServiceProcess                   # fails
    from System import Array

    class Program:
        @staticmethod
        def Main():
            x = System.ServiceProcess.ServiceBase   # fails
            print dir(x)
ServicesToRun = System.Array[System.ServiceProcess.ServiceBase](
                [
                FolderWatch()
                ])
            ServiceBase.Run(ServicesToRun);

    prg = Program()
    prg.Main()

Does anyone have an idea, how to accomplish that or - more generally - how to make an windows service out of an ipy program?

Thanks in advance
Peter Schwalm


_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to