<div dir="ltr">For this initial testing, I'm running Django directly. In production it will be run behind Apache/mod_wsgi.<div><br></div><div>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).</div><div><br></div><div>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.<br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Scott Vitale<div>Founder & CEO</div><div>720.288.6336</div><div><a href="https://twitter.com/svvitale" style="font-size:12.8px" target="_blank">@svvitale</a></div><div><br></div><div></div><div><a href="http://spigotlabs.com" target="_blank"><img src="https://docs.google.com/uc?export=download&id=1RBbjiSpgWbjQ8Pcz5rmVNeXVRFSwMWwJ&revid=0B_UtbxebwQXnVFRCYlFjWmMxVkxKWElTVEdtOFh2SzRDWWlBPQ" width="200" height="50"></a><br></div><div><br></div><div><span style="font-size:12.8px">Learn about my perspectives on development, business, and my personal quest to shake up the #eventtech world on </span><a href="https://bit.ly/svvitale-medium" style="font-size:12.8px" target="_blank">Medium</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Sun, Mar 25, 2018 at 4:00 PM, <span dir="ltr"><<a href="mailto:python-win32-request@python.org" target="_blank">python-win32-request@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send python-win32 mailing list submissions to<br>
<a href="mailto:python-win32@python.org">python-win32@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://mail.python.org/mailman/listinfo/python-win32" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-win32</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:python-win32-request@python.org">python-win32-request@python.<wbr>org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:python-win32-owner@python.org">python-win32-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of python-win32 digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: win32com + Brother Printer + Django (Tim Roberts)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Sat, 24 Mar 2018 23:23:43 -0700<br>
From: Tim Roberts <<a href="mailto:timr@probo.com">timr@probo.com</a>><br>
To: Python-Win32 List <<a href="mailto:python-win32@python.org">python-win32@python.org</a>><br>
Subject: Re: [python-win32] win32com + Brother Printer + Django<br>
Message-ID: <<a href="mailto:3023455A-9311-4480-A31F-5672DC4E6EB3@probo.com">3023455A-9311-4480-A31F-<wbr>5672DC4E6EB3@probo.com</a>><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
On Mar 23, 2018, at 9:44 AM, Scott Vitale <<a href="mailto:scott@spigotlabs.com">scott@spigotlabs.com</a>> wrote:<br>
><br>
> 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.<br>
><br>
> I've tried calling `CoInitialize` in a variety of ways, no difference in behavior.<br>
><br>
> 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.<br>
<br>
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.<br>
?<br>
Tim Roberts, <a href="mailto:timr@probo.com">timr@probo.com</a><br>
Providenza & Boekelheide, Inc.<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
______________________________<wbr>_________________<br>
python-win32 mailing list<br>
<a href="mailto:python-win32@python.org">python-win32@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-win32" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-win32</a><br>
<br>
<br>
------------------------------<br>
<br>
End of python-win32 Digest, Vol 179, Issue 11<br>
******************************<wbr>***************<br>
</blockquote></div><br></div></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img alt="" style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac2NvdHRAc3BpZ290bGFicy5jb20%3D&type=zerocontent&guid=eb81d857-7efc-4478-9ea5-015cdf08d331"><font color="#ffffff" size="1">ᐧ</font></div>