I managed to get a service working how i want it using pywin32, your
example was helpful =)

However, can you post your cx_freeze setup.py for the service? The problem
i'm having now is that if I try running the service as just a normal python
script, like:

py -3 some_service.py install | start

that works fine, but once I freeze it, whenever i try and start it, it just
fails instantly saying "Error starting service: The service did not respond
to the start or control request in a timely fashion", and I have found
nothing online on how to solve this. Maybe it works for you because of your
ControlService class, and cx_freeze just calls your ControlService.main()
method, which then launches the service using
servicemanager.PrepareToHostSingle()? Any other insight would be great, I'm
not an expert by any means in the win32 / service api..

My setup.py is:

https://gist.github.com/mgrandi/530569380c5a22cc2a73

Thanks again!

~Mark

On Fri, Feb 20, 2015 at 6:40 AM, Dan McCombs <dmcco...@dyn.com> wrote:

> Hi Mark,
>
> My setup.py doesn't have anything specific for pywin32, cx_Freeze handles
> that well. I just have base set to Win32GUI (though maybe you could use
> Win32Console if it's only a service) and I have the include_msvcr set to
> True.
>
> Yes, arguments passed to the exe are accessible via sys.argv just as in a
> normal Python script - in my case the code I shared with you is used as a
> module and I have a "main" script that parses the arguments and then passes
> them to methods in the class of that module to start things up.
>
> Take care,
>
> -Dan
>
> [image: Dyn logo, Dyn.com] <http://dyn.com/>
> <http://twitter.com/dyn> <http://twitter.com/dyninc>   [image: Dyn
> facebook account] <http://facebook.com/dyn>   [image: Dyn LinkedIn
> account] <http://linkedin.com/company/dyn>
>
> Dan McCombs  / Senior Software Engineer
>  603 296 1568      @danmccombs <http://twitter.com/danmccombs/>
>
> On Thu, Feb 19, 2015 at 4:16 PM, Mark Grandi <markgra...@gmail.com> wrote:
>
>> Awesome! This might be the thing I need then since there seems to be some
>> subtle bug in cx_freeze. How is your setup.py written for
>> pywin32/cx_freeze? Do you just not specify anything specific and cx_freeze
>> is smart enough to pull in the pywin32 pyd files and all that? Then once
>> you generate the exe, it correctly handles the argv parameters and gives it
>> to python (and pywin32's win32serviceutil.HandleCommandLine()?
>>
>> Thanks again!
>>
>> ~Mark
>>
>> On Feb 19, 2015, at 2:08 PM, Dan McCombs <dmcco...@dyn.com> wrote:
>>
>> Hey Mark,
>>
>> Yes, I freeze with pywin32 (using cx_Freeze) and it runs on systems
>> without Python installed - we actually use this for our production Dyn
>> Updater client in use by hundreds of thousands of end users without much
>> issue.
>>
>> We ended up going this route rather than the cx_Freeze type because we
>> have one executable that runs both the UI and the service, the service is
>> just launched via a command line argument to the executable. Though I think
>> we end up with less debugging output (console-wise) because of the
>> cx_Freeze executable being set to a Win32GUI app.
>>
>> I vaguely remember playing with the win32service piece of cx_Freeze early
>> on, but I didn't get it working and ended up going the pywin32 route for
>> the other reasons above anyway.
>>
>> Take care,
>>
>> -Dan
>>
>>
>>
>> [image: Dyn logo, Dyn.com] <http://dyn.com/>
>> <http://twitter.com/dyn> <http://twitter.com/dyninc>   [image: Dyn
>> facebook account] <http://facebook.com/dyn>   [image: Dyn LinkedIn
>> account] <http://linkedin.com/company/dyn>
>>
>> Dan McCombs  / Senior Software Engineer
>>  603 296 1568      @danmccombs <http://twitter.com/danmccombs/>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
>> _______________________________________________
>> cx-freeze-users mailing list
>> cx-freeze-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> cx-freeze-users mailing list
> cx-freeze-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
cx-freeze-users mailing list
cx-freeze-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users

Reply via email to