IronPython: simplejsonが動かない

ので、twitできない。

twtter on CPython2.5

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import twitter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Shared\CPython2.5.1\Lib\site-packages\twitter.py", line 14, in <modul
e>
    import simplejson
ImportError: No module named simplejson
>>>

ダウンロードインストール

C:\Shared\CPython2.5.1>svn export http://svn.red-bean.com/bob/simplejson/trunk

C:\Shared\CPython2.5.1\trunk>python setup.py install
running install
running bdist_egg
running egg_info
creating simplejson.egg-info
writing simplejson.egg-info\PKG-INFO
writing top-level names to simplejson.egg-info\top_level.txt
writing dependency_links to simplejson.egg-info\dependency_links.txt
writing entry points to simplejson.egg-info\entry_points.txt
writing manifest file ‘simplejson.egg-info\SOURCES.txt’
reading manifest file ‘simplejson.egg-info\SOURCES.txt’
writing manifest file ‘simplejson.egg-info\SOURCES.txt’
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.

 

Thanks to http://jhcore.com/:

C:\Shared\CPython2.5.1\trunk>python setup.py build_ext –compiler=mingw32 install

C:\Shared\CPython2.5.1>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import twitter
>>> api=twitter.Api(username=’hdknr’,password=’******’)
>>> status=api.PostUpdate(u’Hello from python-twitter on Windows Vista CPython2.5′)
>>>

image

テスト

C:\Shared\CPython2.5.1>ipy
IronPython 2.0 Alpha (2.0.0.800) on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import twitter
Traceback (most recent call last):
  File , line unknown, in ##23
  File , line unknown, in _stub_##2
ImportError: No module named twitter

 

パス追加

C:\Shared\IronPython-2.0A8\Lib>echo sys.path.append(r"C:\Shared\CPython2.5.1\Lib\site-packages") >> site.py

テスト

C:\Shared\IronPython-2.0A8>ipy
IronPython 2.0 Alpha (2.0.0.800) on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import twitter
Traceback (most recent call last):
  File , line unknown, in ##23
  File , line unknown, in _stub_##2
  File C:\Shared\CPython2.5.1\Lib\site-packages\twitter.py, line 14, in Initiali
ze
  File , line unknown, in _stub_##2
ImportError: No module named simplejson

 

simplejsonパッケージの確認

C:\Shared\IronPython-2.0A8>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import simplejson
>>> dir(simplejson)
[‘JSONDecoder’, ‘JSONEncoder’, ‘__all__’, ‘__builtins__’, ‘__doc__’, ‘__file__’,
‘__loader__’, ‘__name__’, ‘__path__’, ‘__version__’, ‘_default_decoder’, ‘_defa
ult_encoder’, ‘decoder’, ‘dump’, ‘dumps’, ‘encoder’, ‘load’, ‘loads’, ‘read’, ‘s
canner’, ‘write’]
>>> simplejson.__path__
[‘C:\\Shared\\CPython2.5.1\\lib\\site-packages\\simplejson-1.7.4-py2.5-win32.egg\\simplejson’]
>>>

eggをunzipして、 site-packages\egg\simplejson に移動して、site-packages\egg をappendする。

 

C:\Shared\IronPython-2.0A8\Lib>ipy
IronPython 2.0 Alpha (2.0.0.800) on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import simplejson
Traceback (most recent call last):
  File , line unknown, in ##23
  File , line unknown, in _stub_##2
  File C:\Shared\CPython2.5.1\Lib\site-packages\egg\simplejson\__init__.py, line
95, in Initialize
  File , line unknown, in _stub_##2
  File C:\Shared\CPython2.5.1\Lib\site-packages\egg\simplejson\decoder.py, line
10, in Initialize
  File C:\Shared\CPython2.5.1\Lib\site-packages\egg\simplejson\decoder.py, line
13, in _floatconstants
LookupError: unknown encoding: hex

 

今日は時間切れ。

カテゴリー: 未分類 パーマリンク

IronPython: simplejsonが動かない への1件のフィードバック

  1. Unknown より:

    Hi,Do you need digital signage, digital sign, ad players and ad displays? Please go Here:www.amberdigital.com.hk(Amberdigital).we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

    amberdigital Contact Us
    E-mail:sstar@netvigator.com
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[efhbefeggegfge]

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中