<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Downloading Large Files Async With GIO</title>
	<atom:link href="http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/</link>
	<description>At home with Jono Bacon, Community Manager and Author</description>
	<lastBuildDate>Sat, 11 Feb 2012 21:46:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Download Files Async With Gio And Python&#160;&#124;&#160;jonobacon@home</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-137019</link>
		<dc:creator>Download Files Async With Gio And Python&#160;&#124;&#160;jonobacon@home</dc:creator>
		<pubDate>Mon, 15 Mar 2010 19:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-137019</guid>
		<description>&lt;p&gt;[...] I asked for some help on how to download a file without blocking the GUI. Thanks to everyone who contributed their expertise in the post comments: I now have my program [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] I asked for some help on how to download a file without blocking the GUI. Thanks to everyone who contributed their expertise in the post comments: I now have my program [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-137010</link>
		<dc:creator>chris</dc:creator>
		<pubDate>Mon, 15 Mar 2010 13:54:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-137010</guid>
		<description>&lt;p&gt;If you just want to download the file you probably should use copy_async().&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If you just want to download the file you probably should use copy_async().</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Otte</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-137009</link>
		<dc:creator>Benjamin Otte</dc:creator>
		<pubDate>Mon, 15 Mar 2010 13:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-137009</guid>
		<description>&lt;p&gt;Why don&#039;t you just copy the file using http://library.gnome.org/devel/gio/stable/GFile.html#g-file-copy-async - or its pygtk equivalent?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Why don&#8217;t you just copy the file using <a href="http://library.gnome.org/devel/gio/stable/GFile.html#g-file-copy-async" rel="nofollow">http://library.gnome.org/devel/gio/stable/GFile.html#g-file-copy-async</a> &#8211; or its pygtk equivalent?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Ward</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-137008</link>
		<dc:creator>Stuart Ward</dc:creator>
		<pubDate>Mon, 15 Mar 2010 13:09:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-137008</guid>
		<description>&lt;p&gt;Wouldn&#039;t it be easier to use subprocess module to execute a wget commend.
command = [&#039;wget&#039;,path_name]
wget_process = subprocess.Popen(command)&lt;/p&gt;

&lt;p&gt;You can then check on when it is complete with the wget_process.returncode == None if it is still running.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t it be easier to use subprocess module to execute a wget commend.
command = ['wget',path_name]
wget_process = subprocess.Popen(command)</p>

<p>You can then check on when it is complete with the wget_process.returncode == None if it is still running.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Johan Dahlin</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-137003</link>
		<dc:creator>Johan Dahlin</dc:creator>
		<pubDate>Mon, 15 Mar 2010 11:37:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-137003</guid>
		<description>&lt;p&gt;A mostly async example is available here:&lt;/p&gt;

&lt;p&gt;http://git.gnome.org/browse/pygobject/tree/examples/gio/downloader.py&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>A mostly async example is available here:</p>

<p><a href="http://git.gnome.org/browse/pygobject/tree/examples/gio/downloader.py" rel="nofollow">http://git.gnome.org/browse/pygobject/tree/examples/gio/downloader.py</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: punch bag stand &#124; punching bag sets</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-137000</link>
		<dc:creator>punch bag stand &#124; punching bag sets</dc:creator>
		<pubDate>Mon, 15 Mar 2010 10:45:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-137000</guid>
		<description>&lt;p&gt;[...] Downloading Large Files Async With GIO &#124; jonobacon@home [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Downloading Large Files Async With GIO | jonobacon@home [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Joaquim Rocha</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-136999</link>
		<dc:creator>Joaquim Rocha</dc:creator>
		<pubDate>Mon, 15 Mar 2010 10:15:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-136999</guid>
		<description>&lt;p&gt;Hi Jono,&lt;/p&gt;

&lt;p&gt;I have a simple Python app for the N900 and I make a few async calls in it.&lt;/p&gt;

&lt;p&gt;The concept is really simple, I have an Async worker which is a thread and has a queue of items to be dealt with. An item receives a target method to execute and a callback to be called when it is done, each with its respective arguments.&lt;/p&gt;

&lt;p&gt;Then the items are put in the queue and the async worker just goes through running them.&lt;/p&gt;

&lt;p&gt;Here you have the code for the AsyncWorker and Items:&lt;/p&gt;

&lt;p&gt;http://gitorious.org/seriesfinale/seriesfinale/blobs/master/src/SeriesFinale/asyncworker.py&lt;/p&gt;

&lt;p&gt;Take a look here for an example of how it&#039;s used:&lt;/p&gt;

&lt;p&gt;http://gitorious.org/seriesfinale/seriesfinale/blobs/master/src/SeriesFinale/series.py&lt;/p&gt;

&lt;p&gt;Hope it helps you,&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Jono,</p>

<p>I have a simple Python app for the N900 and I make a few async calls in it.</p>

<p>The concept is really simple, I have an Async worker which is a thread and has a queue of items to be dealt with. An item receives a target method to execute and a callback to be called when it is done, each with its respective arguments.</p>

<p>Then the items are put in the queue and the async worker just goes through running them.</p>

<p>Here you have the code for the AsyncWorker and Items:</p>

<p><a href="http://gitorious.org/seriesfinale/seriesfinale/blobs/master/src/SeriesFinale/asyncworker.py" rel="nofollow">http://gitorious.org/seriesfinale/seriesfinale/blobs/master/src/SeriesFinale/asyncworker.py</a></p>

<p>Take a look here for an example of how it&#8217;s used:</p>

<p><a href="http://gitorious.org/seriesfinale/seriesfinale/blobs/master/src/SeriesFinale/series.py" rel="nofollow">http://gitorious.org/seriesfinale/seriesfinale/blobs/master/src/SeriesFinale/series.py</a></p>

<p>Hope it helps you,</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Larsson</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-136997</link>
		<dc:creator>Alexander Larsson</dc:creator>
		<pubDate>Mon, 15 Mar 2010 08:45:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-136997</guid>
		<description>&lt;p&gt;If you want the whole file contents then you should use load_contents_async/load_contents_finish as Jan said. read_async() just returns an opened stream you can read from.&lt;/p&gt;

&lt;p&gt;However, all this is void unless you also enable threads by calling g_thread_init() (or whatever this is in python) early in your app. Its not possible to implement async local file i/o without threads, so when its not enabled gio &quot;emulates&quot; it by reading from idle handlers.&lt;/p&gt;

&lt;p&gt;Additionally, this part of your code:
 outputfile = open(&quot;/home/jono/Desktop/shot.ogg&quot;,&quot;w&quot;)
 outputfile.writelines(f)&lt;/p&gt;

&lt;p&gt;Is not async and will block your app.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If you want the whole file contents then you should use load_contents_async/load_contents_finish as Jan said. read_async() just returns an opened stream you can read from.</p>

<p>However, all this is void unless you also enable threads by calling g_thread_init() (or whatever this is in python) early in your app. Its not possible to implement async local file i/o without threads, so when its not enabled gio &#8220;emulates&#8221; it by reading from idle handlers.</p>

<p>Additionally, this part of your code:
 outputfile = open(&#8220;/home/jono/Desktop/shot.ogg&#8221;,&#8221;w&#8221;)
 outputfile.writelines(f)</p>

<p>Is not async and will block your app.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Tomeu Vizoso</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-136996</link>
		<dc:creator>Tomeu Vizoso</dc:creator>
		<pubDate>Mon, 15 Mar 2010 08:44:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-136996</guid>
		<description>&lt;p&gt;Already considered connecting both streams with gio.OutputStream.splice_async()?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Already considered connecting both streams with gio.OutputStream.splice_async()?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: herodiade</title>
		<link>http://www.jonobacon.org/2010/03/15/downloading-large-files-async-with-gio/comment-page-1/#comment-136995</link>
		<dc:creator>herodiade</dc:creator>
		<pubDate>Mon, 15 Mar 2010 08:36:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonobacon.org/?p=2519#comment-136995</guid>
		<description>&lt;p&gt;Hi,
I&#039;m not an expert but I think at least the write isn&#039;t async here (this alone can freeze, esp. on slow disks). And I think (not sure) the read callback will be triggered as soon as the fd opened by read_async() is available (if so read_finish(result).read() will block).&lt;/p&gt;

&lt;p&gt;There&#039;s a complete and working example (using gio&#039;s copy_async()) in Rhythmbox source code :
http://osdir.com/ml/general/2010-02/msg24291.html
http://git.gnome.org/browse/rhythmbox/tree/plugins/magnatune/magnatune/MagnatuneSource.py&lt;/p&gt;

&lt;p&gt;The faq.pygtk example isn&#039;t likely to block because it doesn&#039;t write() as your code snippet do, and only display 100 bytes (less than a single tcp packet, should be fully available in one shot when the read callback is triggered or soon after).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,
I&#8217;m not an expert but I think at least the write isn&#8217;t async here (this alone can freeze, esp. on slow disks). And I think (not sure) the read callback will be triggered as soon as the fd opened by read_async() is available (if so read_finish(result).read() will block).</p>

<p>There&#8217;s a complete and working example (using gio&#8217;s copy_async()) in Rhythmbox source code :
<a href="http://osdir.com/ml/general/2010-02/msg24291.html" rel="nofollow">http://osdir.com/ml/general/2010-02/msg24291.html</a>
<a href="http://git.gnome.org/browse/rhythmbox/tree/plugins/magnatune/magnatune/MagnatuneSource.py" rel="nofollow">http://git.gnome.org/browse/rhythmbox/tree/plugins/magnatune/magnatune/MagnatuneSource.py</a></p>

<p>The faq.pygtk example isn&#8217;t likely to block because it doesn&#8217;t write() as your code snippet do, and only display 100 bytes (less than a single tcp packet, should be fully available in one shot when the read callback is triggered or soon after).</p>]]></content:encoded>
	</item>
</channel>
</rss>

