<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal style='text-autospace:none'>Hello Guys,<o:p></o:p></p>

<p class=MsoNormal style='text-autospace:none'><o:p> </o:p></p>

<p class=MsoNormal style='text-autospace:none'>I’m looking for a little
advice on spawning a sub process to run a command line application for transferring
a file over Bluetooth. Now the spawned process runs from start to finish
exactly as I would expect it too, however its very slow. <o:p></o:p></p>

<p class=MsoNormal style='text-autospace:none'><o:p> </o:p></p>

<p class=MsoNormal style='text-autospace:none'>Now the main reason this is so
odd, is that If I have my python application running as usual, and I start the
command line application manually myself from the command line, then it’ll
transfer the file to my phone about 3 or 4 times faster than when the app is
launch using sub process. Take a look below for a quick snippet example of my
process launch code.<o:p></o:p></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>send = 'ussp-push --debug --dev hci%s %s@%s
/pblue/new/Media/%s %s' % (<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>adapter, <o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>mac, <o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>result, <o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>media[3], <o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>media[0]<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>process = subprocess.Popen(<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>send, <o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt;text-autospace:none'><span
style='font-size:9.0pt;font-family:"Courier New"'>shell=True, <o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:9.0pt;
font-family:"Courier New"'>stdout=subprocess.PIPE,
stderr=subprocess.PIPE).stderr<o:p></o:p></span></p>

<p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>

<p class=MsoNormal>Do you have any ideas what might be causing this slow behaviour?
Do spawned sub processes generally run at a much slower rate than expected? Or is
this something specific to my application?<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>I’d love to work this out as when transferring larger
files this becomes a real pain, especial when I know there is no real physical
reason for it running so slowly.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Thanks guys for any help you can offer.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Rob<o:p></o:p></p>

</div>

</body>

</html>