For this initial testing, I'm running Django directly. In production it will be run behind Apache/mod_wsgi.
Setting sys.coinit_flags = 0 fixes the hang when running Django from a simple command line. This confirms to me that the issue is thread-related. What I'm seeing now is that the hang still occurs when running under the PyCharm debugger, but functions correctly in all other cases (run directly, run under Apache/mod_wsgi). It's no longer a blocking issue for me, but it would still be nice to understand root cause and if anything can be done (in my code or in PyCharm) to make the debugger function correctly. If you guys have any ideas on how to further debug or collect information on what might be hanging, that'd be greatly appreciated. Scott Vitale Founder & CEO 720.288.6336 @svvitale <https://twitter.com/svvitale> <http://spigotlabs.com> Learn about my perspectives on development, business, and my personal quest to shake up the #eventtech world on Medium <https://bit.ly/svvitale-medium> On Sun, Mar 25, 2018 at 4:00 PM, <python-win32-requ...@python.org> wrote: > Send python-win32 mailing list submissions to > python-win32@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/python-win32 > or, via email, send a message with subject or body 'help' to > python-win32-requ...@python.org > > You can reach the person managing the list at > python-win32-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of python-win32 digest..." > > > Today's Topics: > > 1. Re: win32com + Brother Printer + Django (Tim Roberts) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 24 Mar 2018 23:23:43 -0700 > From: Tim Roberts <t...@probo.com> > To: Python-Win32 List <python-win32@python.org> > Subject: Re: [python-win32] win32com + Brother Printer + Django > Message-ID: <3023455a-9311-4480-a31f-5672dc4e6...@probo.com> > Content-Type: text/plain; charset=utf-8 > > On Mar 23, 2018, at 9:44 AM, Scott Vitale <sc...@spigotlabs.com> wrote: > > > > I'm looking for some win32com help... I have a simple Python script that > creates a `Dispatch` object for a `bpac.Document` type (it's a Brother > printer SDK class). It works perfectly fine in a standalong script, but as > soon as I attempt to call this code from Django, it hangs on creating the > `Dispatch` object....so bizarre. > > > > I've tried calling `CoInitialize` in a variety of ways, no difference in > behavior. > > > > The other oddity is that I can create `bpac.Printer` objects with no > issue. It's only the `bpac.Document` type that hangs. Unfortunately I > don't have access to the library source and I'm not sure how to debug why > it's hanging. > > How are you running your Django app? Is it running as a service? Is it > networked, or directly connected? Microsoft does not recommend printing > from Windows services, in parts because of security considerations. Your > service is running as a special Windows user (unless you've configured it), > and that special user needs permissions to use the printer. > ? > Tim Roberts, t...@probo.com > Providenza & Boekelheide, Inc. > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > https://mail.python.org/mailman/listinfo/python-win32 > > > ------------------------------ > > End of python-win32 Digest, Vol 179, Issue 11 > ********************************************* > ᐧ
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32