When you add a reference to something in the GAC, don't add ".dll" to the
name. That is,
clr.AddReference('System.ServiceProcess')
On Thu, Jan 3, 2013 at 6:34 AM, Peter Schwalm <[email protected]> wrote:
> 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
> [email protected]
> http://mail.python.org/**mailman/listinfo/ironpython-**users<http://mail.python.org/mailman/listinfo/ironpython-users>
>
_______________________________________________
Ironpython-users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/ironpython-users