<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
    <title>CMWK: Python</title>
    <link rel="self" type="application/atom+xml" href="https://dogfood.lekumo.biz/cmwk/python/atom.xml" />
    <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/" />
    
    <id>tag:bb.lekumo.jp,2003:weblog-415535</id>
    <updated>2011-07-14T02:15:35+09:00</updated>
    <subtitle>blog.comewalk.com の倉庫</subtitle>
    <entry>
        <title>What editor/IDE do you use for Python?</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2011/07/what-editoride-do-you-use-for-python-python.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2011/07/what-editoride-do-you-use-for-python-python.html" thr:count="16" thr:updated="2014-07-27T13:38:07+09:00" />
        <id>tag:bb.lekumo.jp,2003:post-49233081</id>
        <published>2011-07-14T02:15:35+09:00</published>
        <updated>2013-02-16T01:35:14+09:00</updated>
        <summary>When I cleaned my inbox up today, I just...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Programming" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>When I cleaned my inbox up today, I just remembered that I would like to wrap  threads up. The threads are about an editor / IDE for Python. This list may be a little bit old though, if you are a beginner in Python world, it's useful, I think.</p>
<p>I found good page on stackoverflow, <a href="http://stackoverflow.com/questions/81584/what-ide-to-use-for-python">What IDE to use for Python?</a>, during wrapping this list up. Also it's worth checking it out.</p>
<p>Yeah, I use vim, too!</p>

<p>メールボックスを整理していてPythonのエディタ/IDEについてまとめようと思っていたのを思い出しました。もしPython初心者なら参考になるかもしれません。</p>
<p><a href="http://stackoverflow.com/questions/81584/what-ide-to-use-for-python">stackoverflow</a>にもありましたのでそちらも見てみるといいかも。</p>

<p>そうそう、わたしはvimを使ってます。</p>

<p>Thanks!</p>

<h4>Editors / IDEs</h4>
<ul>
<li><a href="http://www.vim.org/">vim</a> (some guys are using vim with <a href="http://www.vim.org/scripts/script.php?script_id=1658">NERD_tree.vim</a>,  <a href="http://www.vim.org/scripts/script.php?script_id=159">minibufexpl.vim</a> and so on)</li>
<li><a href="http://pydev.org/">PyDev in Eclipse</a></li>
<li><a href="http://www.gnu.org/software/emacs/">emacs</a></li>
<li><a href="http://www.jetbrains.com/pycharm/">PyCharm</a></li>
<li><a href="http://code.google.com/p/pyscripter/">pyscripter</a></li>
<li><a href="http://macromates.com/">TextMate</a></li>
<li><a href="http://www.aptana.com/products/studio3">Aptana3</a></li>
<li><a href="http://www.activestate.com/komodo-ide">Komodo IDE</a> / <a href="http://www.activestate.com/komodo-edit">Komodo Edit</a></li>
<li><a href="http://projects.gnome.org/gedit/">gedit</a></li>
<li><a href="http://code.google.com/p/macvim/">macvim</a> with 
<a href="https://github.com/carlhuda/janus">Janus</a></li>
</ul>

<h4>seealso</h4>
<ul>
<li><a href="http://groups.google.com/group/google-appengine-python/browse_thread/thread/40acd8ce9bc728b1">[appengine-python] Python Editor With GAE Awareness/Autocomplete</a></li>
<li><a href="http://stackoverflow.com/questions/81584/what-ide-to-use-for-python">What IDE to use for Python?</a></li>
<li><a href="http://groups.google.com/group/google-app-engine-japan/browse_thread/thread/09278f7aa0c201d3">GAE開発でのエディタやツール - Google-App-Engine-Japan | Google グループ</a></li>
<li><a href="http://wiki.python.org/">The Python Wiki</a> &gt; <a href="http://wiki.python.org/moin/DevelopmentTools">Development Tools</a> &gt; <a href="http://wiki.python.org/moin/PythonEditors">PythonEditors</a></li>
</ul></div>
]]>
</content>


    </entry>
    <entry>
        <title>plural</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/11/plural.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/11/plural.html" thr:count="2" thr:updated="2014-02-17T13:59:40+09:00" />
        <id>tag:bb.lekumo.jp,2003:post-49233109</id>
        <published>2010-11-02T09:25:33+09:00</published>
        <updated>2013-02-16T01:35:14+09:00</updated>
        <summary>I forgot how to display plural in Perl. Though I read Advanced Perl Programming before. Then its solved by Lingua::EN::Inflect. $ perl -MLingua::EN::Inflect=PL -le print PL(blog, 2) blogs By the way, in python world, pipy has same module named inflect....</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Perl" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>I forgot how to display plural in Perl. Though I read <a href="http://oreilly.com/catalog/9781565922204">Advanced Perl Programming</a> before. Then it&#39;s solved by <a href="http://search.cpan.org/dist/Lingua-EN-Inflect/">Lingua::EN::Inflect</a>.</p>
<blockquote>$ perl -MLingua::EN::Inflect=PL -le &#39;print PL(&quot;blog&quot;, 2)&#39;<br /> blogs</blockquote>
<p>By the way, in python world, pipy has same module named <a href="http://pypi.python.org/pypi/inflect">inflect</a>.</p>
<blockquote>$ easy_install inflect<br /> $ python<br /> &gt;&gt;&gt; import inflect<br /> &gt;&gt;&gt; p = inflect.engine()<br /> &gt;&gt;&gt; p.plural(&#39;blog&#39;, 2)<br /> &#39;blogs&#39;</blockquote>
<p>Okay, if I forgot again, first of all I&#39;ll search my blog :)</p>
<table border="0" cellpadding="5">
<tbody>
<tr>
<td valign="top"><a href="http://www.amazon.co.jp/Advanced-Perl-Programming-Simon-Cozens/dp/0596004567%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dcomewalk-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0596004567" target="_blank"><img alt="0596004567" border="0" src="http://ecx.images-amazon.com/images/I/41h5N6PJM3L._SL160_.jpg" /></a></td>
<td valign="top"><span><a href="http://www.amazon.co.jp/Advanced-Perl-Programming-Simon-Cozens/dp/0596004567%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dcomewalk-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0596004567" target="_blank">Advanced Perl Programming</a><img alt="" height="1" src="http://www.assoc-amazon.jp/e/ir?t=comewalk-22&amp;l=ur2&amp;o=9" style="border: none;" width="1" /><br />Simon Cozens <br />Oreilly &amp; Associates Inc  2005-08-30<br /><br /></span><span>by <a href="http://www.goodpic.com/mt/aws/index.html">G-Tools</a></span></td>
</tr>
</tbody>
</table></div>
]]>
</content>


    </entry>
    <entry>
        <title>iBus didnt work under Python 2.5 on Ubuntu 10.04</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/08/ibus-didnt-work-under-python-25-on-ubuntu-1004.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/08/ibus-didnt-work-under-python-25-on-ubuntu-1004.html" thr:count="29" thr:updated="2014-07-26T06:45:18+09:00" />
        <id>tag:bb.lekumo.jp,2003:post-49233153</id>
        <published>2010-08-10T09:58:07+09:00</published>
        <updated>2013-02-16T01:35:15+09:00</updated>
        <summary>Im using Ubuntu 10.04, and ibut-anthy i...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="ubuntu" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>I&#39;m using Ubuntu 10.04, and ibut-anthy is for Japanese input. Anyway, I wanted to use Python 2.5 for Google App Engine. Then I installed Python 2.5. Yeah, I was be able to use GAE. But I didn&#39;t input Japanese. I tried to re-install iBus and related stuffs. But it didn&#39;t look good. Hmm, ah,okay, so when I installed Python 2.5, I remained bin/python. This python was 2.5. ;p I removed bin/python as 2.5. Then I used Python 2.6 as default. Then iBus was just recovered. Hehe, just my two cents.</p>
<p>私は Ubuntu 10.04 で ibus-anthy で日本語入力をしています。で、Google App Engine を使いたかったので Python 2.5 をインストールしたら日本語が使えなくなりました。iBus 関連を再インストールしたりしたんだけど改善しなくて。そしたら Python 2.5 をインストールしたときに python の実行ファイルを残したままでした。そこで Python 2.5 の python 実行ファイルを削除して、デフォルトを Python 2.6 にしました。そしたら日本語入力も復活しました。Python をマルチで動かす人は気をつけよう。</p></div>
]]>
</content>


    </entry>
    <entry>
        <title>If you need to use simplejson on GAE,</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/03/if-you-need-to-use-simplejson-on-gae.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/03/if-you-need-to-use-simplejson-on-gae.html" thr:count="9" thr:updated="2014-04-25T20:32:40+09:00" />
        <id>tag:bb.lekumo.jp,2003:post-49233195</id>
        <published>2010-03-01T09:54:53+09:00</published>
        <updated>2013-02-16T01:35:16+09:00</updated>
        <summary>You shouldnt upload simplejson module to GAE. As some people have already mentioned, you should write below. from django.utils import simplejson GAE uses Django framework. Django includes simplejson module. seealso how to use simplejson with GAE - Google App Engine...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>You shouldn&#39;t upload simplejson module to GAE. As some people have already mentioned, you should write below.</p>
<blockquote>
<pre>from django.utils import simplejson<br /></pre>
</blockquote>
<p>GAE uses Django framework. Django includes simplejson module.</p>
<p>seealso</p>
<ul>
<li><a href="http://groups.google.com/group/google-appengine/browse_thread/thread/37e680e19daeae76">how to use simplejson with GAE - Google App Engine | Google Groups</a></li>
<li><a href="http://code.google.com/appengine/articles/rpc.html">Using AJAX to Enable Client RPC Requests - Google App Engine - Google Code</a></li>
</ul>
<p>&#0160;</p>
<p>(Additional)</p>
<p>Thanks Felix for your comment!</p>
<ul>
</ul></div>
]]>
</content>


    </entry>
    <entry>
        <title>Yahoo! Social SDKs</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/02/yahoo-social-sdks.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/02/yahoo-social-sdks.html" thr:count="0" />
        <id>tag:bb.lekumo.jp,2003:post-49233211</id>
        <published>2010-02-17T09:53:48+09:00</published>
        <updated>2013-02-16T01:35:17+09:00</updated>
        <summary>Python Easily add social capabilities to your website or web application using the Python SDK. Source code, complete documentation and examples are provided on the GitHub project page. Download the Yahoo! Python SDK 1.0 via developer.yahoo.com As you may know,...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><blockquote><h3>Python</h3>
<p>Easily add social capabilities to your website or web application using the Python SDK.</p>
<p>Source code, complete documentation and examples are provided on the <a href="http://github.com/yahoo/yos-social-python">GitHub project page</a>.
</p>
<p><a href="http://github.com/yahoo/yos-social-python/zipball/1.0" title="Download the Yahoo! Python SDK">Download the Yahoo! Python SDK 1.0</a></p>

</blockquote>

<p><small>via <a href="http://developer.yahoo.com/social/sdk/#python">developer.yahoo.com</a></small></p>

<p>As you may know, Yahoo! provides <a href="http://developer.yahoo.com/oauth/">OAuth</a>. Above quoted paragraph mentioned Python SDK. The SDK has some examples, especially appengine example.&#0160;The example is hosted by GAE. You can try it soon. The URL is&#0160;<a href="http://yapdemo.appspot.com/">http://yapdemo.appspot.com/</a>.</p>

<p>If you have any plans your application uses Yahoo! API - delicious, Yahoo! Mail, etc -, you&#39;d see the SDK.&#0160;Also you&#39;d read the document:&#0160;<a href="http://developer.yahoo.com/oauth/guide/" style="color: blue !important; text-decoration: underline !important; cursor: text !important; ">OAuth / OpenID Guides</a>.</p></div>
]]>
</content>


    </entry>
    <entry>
        <title>how to split extension from path</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/01/how-to-split-extension-from-path.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2010/01/how-to-split-extension-from-path.html" thr:count="0" />
        <id>tag:bb.lekumo.jp,2003:post-49233241</id>
        <published>2010-01-08T08:26:00+09:00</published>
        <updated>2013-02-16T01:35:17+09:00</updated>
        <summary>Im a beginner of Python. I tried to split extension. I dont know the best way. use os.path.splitext? or regexp? In case of regexp  import pre  p = re.compile(^.*\.(.*))  m = p.match(http://www.example.com/index.html)  m.group(1) html Or in...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>I&#39;m a beginner of Python. I tried to split extension. I don&#39;t know the best way. use os.path.splitext? or regexp?</p>

<p>In case of regexp</p>
<pre>&gt;&gt;&gt; import pre
&gt;&gt;&gt; p = re.compile(&#39;^.*\.(.*)&#39;)
&gt;&gt;&gt; m = p.match(&#39;http://www.example.com/index.html&#39;)
&gt;&gt;&gt; m.group(1)
&#39;html&#39;
</pre>

<p>Or in case of os.path.splitext</p>
<pre> 
&gt;&gt;&gt; import os.path                
&gt;&gt;&gt; os.path.splitext(&#39;http://www. example.com/index.html&#39;)
(&#39;http://www. example.com/index&#39;, &#39;.html&#39;)
</pre>

I like using os.path.splitext rather than regexp in this case. Any thought?</div>
]]>
</content>


    </entry>
    <entry>
        <title>How to resolve djangos encoding error on Mac OS X (Japanese)</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2009/11/how-to-resolve-djangos-encoding-error-on-mac-os-x-japanese.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2009/11/how-to-resolve-djangos-encoding-error-on-mac-os-x-japanese.html" thr:count="0" />
        <id>tag:bb.lekumo.jp,2003:post-49233283</id>
        <published>2009-11-30T08:49:02+09:00</published>
        <updated>2013-02-16T01:35:18+09:00</updated>
        <summary>I tried to run jaikuengine on my Mac OS ...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>I tried to run <a href="http://code.google.com/p/jaikuengine/">jaikuengine</a> on my Mac OS X (Tiger). I got following error.</p>

<blockquote><pre>LookupError: unknown encoding: X-MAC-JAPANESE</pre></blockquote>

<p>jaikuengine has django.</p>

<blockquote><pre>$ cd <em>&lt;YOUR_JAIKUENGINE_ROOT&gt;</em>
$ svn pg svn:externals vendor
django &#0160; http://code.djangoproject.com/svn/django/tags/releases/1.0/django</pre></blockquote>

<p>Then I needed to patch to <a href="http://code.djangoproject.com/svn/django/tags/releases/1.0/django/utils/tzinfo.py">tzinfo.py</a> on this version.</p>


<blockquote><pre>$ svn diff vendor/django/utils/tzinfo.py&#0160;
Index: vendor/django/utils/tzinfo.py
===================================================================
--- vendor/django/utils/tzinfo.py &#0160; &#0160; &#0160; (revision 11784)
+++ vendor/django/utils/tzinfo.py &#0160; &#0160; &#0160; (working copy)
@@ -7,6 +7,8 @@

&#0160;try:

&#0160;&#0160; &#0160; DEFAULT_ENCODING = locale.getdefaultlocale()[1] or &#39;ascii&#39;
+ &#0160; &#0160;if DEFAULT_ENCODING == &#39;X-MAC-JAPANESE&#39;:
+ &#0160; &#0160; &#0160; &#0160;DEFAULT_ENCODING = &#39;ascii&#39;
&#0160;except:
&#0160;&#0160; &#0160; # Any problems at all determining the locale and we fallback. See #5846.
&#0160;&#0160; &#0160; DEFAULT_ENCODING = &#39;ascii&#39;
</pre></blockquote>

<p>Reference from <a href="http://www.tsuyukimakoto.com/blog/2007/09/06/install-django-for-begginers-osx/">Mac OSXにDjango最新版を | tsuyuki.makoto</a>. This article was written in Sep 2007. But this was good information to me in this case. Thanks!</p></div>
]]>
</content>


    </entry>
    <entry>
        <title>simplejson と setuptools と私</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2008/12/simplejson-setu.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2008/12/simplejson-setu.html" thr:count="7" thr:updated="2014-07-23T10:46:38+09:00" />
        <id>tag:bb.lekumo.jp,2003:post-49233481</id>
        <published>2008-12-31T08:43:00+09:00</published>
        <updated>2013-02-16T01:35:23+09:00</updated>
        <summary>Python では simplejson がデファクトっぽい感じだったので、si...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="from typepad.jp" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>Python では simplejson がデファクトっぽい感じだったので、simplejson をインストールしようと思ったら、以下のようなエラーメッセージが。。。</p>

<pre class="code"> # wget http://pypi.python.org/packages/source/s/simplejson/simplejson-1.3.tar.gz#md5=fbe039b9b863572651a0f665acea34c9<br /> # tar zxvf simplejson-1.3.tar.gz <br /> # cd simplejson-1.3<br /> # python setup.py install<br /><br />---------------------------------------------------------------------------<br />This script requires setuptools version 0.6a11 to run (even to display<br />help).&nbsp; I will attempt to download it for you (from<br />http://cheeseshop.python.org/packages/2.5/s/setuptools/), but<br />you may need to enable firewall access for this script first.<br />I will start the download in 15 seconds.<br /><br />(Note: if this machine does not have network access, please obtain the file<br /><br />&nbsp; &nbsp;http://cheeseshop.python.org/packages/2.5/s/setuptools/setuptools-0.6a11-py2.5.egg<br /><br />and place it in this directory before rerunning this script.)<br />---------------------------------------------------------------------------<br />Downloading http://cheeseshop.python.org/packages/2.5/s/setuptools/setuptools-0.6a11-py2.5.egg<br />Traceback (most recent call last):<br />&nbsp; File &quot;setup.py&quot;, line 4, in <module><p>&nbsp; &nbsp; ez_setup.use_setuptools()<br />&nbsp; File &quot;/private/var/root/tmp/simplejson-1.3/ez_setup/__init__.py&quot;, line 88, in use_setuptools<br />&nbsp; &nbsp; egg = download_setuptools(version, download_base, to_dir, download_delay)<br />&nbsp; File &quot;/private/var/root/tmp/simplejson-1.3/ez_setup/__init__.py&quot;, line 142, in download_setuptools<br />&nbsp; &nbsp; src = urllib2.urlopen(url)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 124, in urlopen<br />&nbsp; &nbsp; return _opener.open(url, data)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 387, in open<br />&nbsp; &nbsp; response = meth(req, response)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 498, in http_response<br />&nbsp; &nbsp; 'http', request, response, code, msg, hdrs)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 419, in error<br />&nbsp; &nbsp; result = self._call_chain(*args)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 360, in _call_chain<br />&nbsp; &nbsp; result = func(*args)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 582, in http_error_302<br />&nbsp; &nbsp; return self.parent.open(new)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 387, in open<br />&nbsp; &nbsp; response = meth(req, response)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 498, in http_response<br />&nbsp; &nbsp; 'http', request, response, code, msg, hdrs)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 425, in error<br />&nbsp; &nbsp; return self._call_chain(*args)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 360, in _call_chain<br />&nbsp; &nbsp; result = func(*args)<br />&nbsp; File &quot;/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py&quot;, line 506, in http_error_default<br />&nbsp; &nbsp; raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)<br />urllib2.HTTPError: HTTP Error 404: Not Found</p></module></pre>

<p>

そもそも <a href="http://pypi.python.org/pypi/setuptools">setuptools</a> というのが必要みたい。（ごめんなさい。私は Python はよくわからないです。。。）</p>

<p>で、setuptools のサイト http://pypi.python.org/pypi/setuptools にアクセスして、<a href="http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other">Mac OS X</a> の項を見つつ、次のように実施しました。

</p>

<pre class="code">&nbsp; #&nbsp; wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg#md5=fe67c3e5a17b12c0e7c541b7ea43a8e6<br />&nbsp; #&nbsp; sh setuptools-0.6c9-py2.5.egg </pre>

<p>

なんと setuptools のインストールはとても簡単。</p>

<p>そして引き続き、simplejson のインストール

</p>

<pre class="code"> # python setup.py install<br />（中略）<br />Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/simplejson-1.3-py2.5.egg<br />Processing dependencies for simplejson==1.3<br />Finished processing dependencies for simplejson==1.3</pre>

<p>

すばらしい。あっさり入りましたぞ。</p>

<p>ってことで simplejson は setuptools があればあっさりインストールできますよ、というお話でした。</p>

<p>年末のテレビを見ながらダラダラと simplejson と setuptools を調べていた私でした。本年もどうぞよろしく。（なんのこっちゃ）</p>

<p>seealso:</p>

<ul>
<li><a href="http://pypi.python.org/pypi/simplejson">Python Package Index : simplejson 2.0.6</a></li>
<li><a href="http://pypi.python.org/pypi/setuptools">Python Package Index : setuptools 0.6c9</a></li>
<il><a href="http://code.google.com/p/simplejson/">simplejson - Google Code</a></li>
<li><a href="http://simplejson.googlecode.com/svn/tags/simplejson-2.0.6/docs/index.html">simplejson &#8212; JSON encoder and decoder &mdash; simplejson v2.0.0 documentation</a></li>
<li><a href="http://d.hatena.ne.jp/gonsuzuki/20080630/1214888695">Google App Engineで、外部にあるJSON形式のファイルを読み込む - 勉強したことのまとめ</a></li>
<li><a href="http://d.hatena.ne.jp/katz3/20070915/1189866031">simplejsonの使い方 - 図書館断想</a></li>
</ul></div>
]]>
</content>


    </entry>
    <entry>
        <title>Google App Engine を試したよ。</title>
        <link rel="alternate" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2008/12/google-app-engi.html" />
        <link rel="replies" type="text/html" href="https://dogfood.lekumo.biz/cmwk/2008/12/google-app-engi.html" thr:count="1" thr:updated="2012-07-06T19:48:19+09:00" />
        <id>tag:bb.lekumo.jp,2003:post-49233517</id>
        <published>2008-12-10T03:42:00+09:00</published>
        <updated>2013-02-16T01:35:24+09:00</updated>
        <summary>最初に知ったときからだいぶ時間があいてしまったのですが、やっと試す時間が作れまし...</summary>
        <author>
            <name>shigeta</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="from typepad.jp" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Programming" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Python" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Web/Tech" />
        
        
<content type="html" xml:base="https://dogfood.lekumo.biz/cmwk/">
<![CDATA[
<div xmlns="http://www.w3.org/1999/xhtml"><p>最初に知ったときからだいぶ時間があいてしまったのですが、やっと試す時間が作れました。今日は <a href="http://code.google.com/appengine/">Google App Engine</a> についてメモです。</p>

<h4>インストール</h4>

<p><a href="http://code.google.com/appengine/">Google App Engine</a> は Python 2.5 以上が必要なのですね。Google App Engine のインストール時に Python 2.5 以上がないと警告が出ましてインストールは途中で終了します。。。</p>

<p>Python は<a href="http://www.python.org/download/">こちら</a>からダウンロードできるようです。</p>

<p>さて、ここからやっと Google App Engine を使う準備が整ったことになりますね。</p>

<p>私の環境は Mac OS X (10.4.11、つまり Tiger) を使っています。</p>

<p>Google App Engine は /usr/local/google_appengine/ にインストールされました。</p>
<pre class="code"> # find /usr/local/google_appengine/ -type f</pre>
<p>としてみると <a href="http://www.djangoproject.com/">Django</a> が。へー。</p>

<h4>スタートガイドでしょ。</h4>

<p>さてインストールが完了したら早速触ってみます。まずは日本語版の<a href="http://code.google.com/intl/ja/appengine/docs/gettingstarted/">スタートガイド</a>を最初から順番においかけてみます。こういうときは写経です。</p>

<blockquote><pre>&#0160; &#0160; * 概要<br />&#0160; &#0160; * 開発環境<br />&#0160; &#0160; * Hello, World!<br />&#0160; &#0160; * webapp フレームワークの使用<br />&#0160; &#0160; * ユーザー サービスの使用<br />&#0160; &#0160; * webapp を使ったフォームの操作<br />&#0160; &#0160; * データストアの使用<br />&#0160; &#0160; * テンプレートの使用<br />&#0160; &#0160; * 静的ファイルの使用<br />&#0160; &#0160; * アプリケーションのアップロード</pre></blockquote>


<p>このスタートガイドでは最初は文字列 helloworld だけを表示するアプリをゲストブックアプリに成長させていくストーリーになっています。早速、「webapp フレームワークの使用」から「コンテンツを次のように置き換えます。」とどんどん上書きしていく形をとっています。（もし自分の心が写経モードだったときには章単位で新しいファイルを用意して、コピペではなくてちゃんとタイプしていくというのがいいですね。今回私はそのやり方にしました。）</p>

<h4>感想</h4>

<p>とても簡単にアプリの開発ができる感じですね。Rails や　Catalyst のように開発用のミニサーバで小さく作っていくスタイルはモチベーションが高まっていきますね。</p>

<p>Google App Engine はなかなか良さげです。早速自作アプリを作成しようと今コードを書いています。まだ Python をはじめて間もない、というか Google App Engine に触れるまでは Python のコードを書いたことがなかったので、これから一般的に使われるモジュールなどを知りたいな。おそらく Google App Engine で使えるモジュールと使えないモジュールがあると想像しているので、その辺りの違いなんかもこれから勉強したいです。</p>

<p>Python も結構面白いよ。</p>

<h4>おまけ</h4>

<p>最後にいくつか特記しておきます。</p>

<p><a href="http://code.google.com/intl/ja/appengine/docs/gettingstarted/usingdatastore.html">データストアの使用</a><br />ここで以下のエラーで詰まりました。
</p>

<pre class="code">Traceback (most recent call last):<br />&#0160; File &quot;/usr/local/google_appengine/google/appengine/ext/webapp/__init__.py&quot;, line 484, in __call__<br />&#0160; &#0160; handler.get(*groups)<br />&#0160; File &quot;/Users/takatsugu/GAE/helloworld/helloworld5.py&quot;, line 17, in get<br />&#0160; &#0160; greetings = db.GqlQuery(&quot;SELECT * FROM Greeting ORDER BY date DESC LIMIT 10&quot;)<br />&#0160; File &quot;/usr/local/google_appengine/google/appengine/ext/db/__init__.py&quot;, line 1496, in __init__<br />&#0160; &#0160; from google.appengine.ext import gql<br />SystemError: Parent module &#39;google.appengine.ext.db&#39; not loaded</pre>

<p>

よく調べてみると、/usr/local/google_appengine/demos/guestbook にこの章と似たようなサンプルがありました。コードを見比べても特に大きな違いは見られなかったので、試しにその demos/guestbook を起動しましたら、期待された動作が出来ました。「やっぱり何か違うのかなー」と思って、dev_appserver.py helloworld/ としたら、今度は上記のエラーを出力せずに起動しました。もしかして&#0160; db,Model はサーバ起動時に生成されるのかな？これまで、 Hello, World!、 webapp フレームワークの使用、 ユーザー サービスの使用、 webapp を使ったフォームの操作、とずっと dev_appserver.py を Ctrl + C で終了させずにきたのでした。。。</p>

<p>とりあえずこのエラーが出たときには dev_appserver.py が起動していたら Ctrl + C で一旦停止した後、再び dev_appserver.py 起動するというのが対処法っぽいですね。（将来的にはgoogle_appengine か dev_appserver.py などのフレームワーク関係のコードを見てみてることにします。とりあえずは「<a href="http://code.google.com/intl/ja/appengine/docs/thedevwebserver.html">開発用 Web サーバ</a>」の章が参考になります。） </p>

<p></p>
<p><a href="http://code.google.com/intl/ja/appengine/docs/gettingstarted/templates.html">テンプレートの使用</a><br />ここでは以下のようなエラーが出ました。
</p>

<pre class="code">Traceback (most recent call last):<br />&#0160; File &quot;/usr/local/google_appengine/google/appengine/ext/webapp/__init__.py&quot;, line 484, in __call__<br />&#0160; &#0160; handler.get(*groups)<br />&#0160; File &quot;/Users/takatsugu/GAE/helloworld/helloworld6.py&quot;, line 34, in get<br />&#0160; &#0160; self.response.out.write(template.render(path, template_values))<br />&#0160; File &quot;/usr/local/google_appengine/google/appengine/ext/webapp/template.py&quot;, line 80, in render<br />&#0160; &#0160; t = load(template_path, debug)<br />&#0160; File &quot;/usr/local/google_appengine/google/appengine/ext/webapp/template.py&quot;, line 125, in load<br />&#0160; &#0160; template = django.template.loader.get_template(file_name)<br />&#0160; File &quot;/usr/local/google_appengine/lib/django/django/template/loader.py&quot;, line 79, in get_template<br />&#0160; &#0160; source, origin = find_template_source(template_name)<br />&#0160; File &quot;/usr/local/google_appengine/lib/django/django/template/loader.py&quot;, line 54, in find_template_source<br />&#0160; &#0160; mod = __import__(module, globals(), locals(), [attr])<br />SystemError: Parent module &#39;django.template&#39; not loaded</pre>

<p>
ここでもデータストアの使用のときと同様に dev_appserver.pl を再起動したところエラーが解消されました。テンプレートエンジンには <a href="http://www.djangoproject.com/documentation/0.96/templates/">Django テンプレート エンジン</a> を使っているんですねぇ。<a href="http://www.djangoproject.com/documentation/0.96/templates/">本家サイト</a>では記法が詳しく書かれています。</p>

<p></p></div>
]]>
</content>


    </entry>
 
</feed>
