2012年11月14日水曜日

Scientific Linux 6.3でGPIB: ナノボルトメータと通信

まずは/etc/gpib.confを編集し,アドレスが22,型番34420Aを登録します.
一応USBからGPIBインターフェースをぬいて,再起動.

起動後に,もう一度USBにGPIBアダプタをさす.
dmesgとLEDを確認.

さてさて,インタープリタで扱う方がテストとしてはやりやすいので,pythonから使えるかな?という甘い考えを抱き,Pythonでテスト.
しかし....


>>> import Gpib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Gpib
>>>


...そんなモジュールないとか言い出す.
きっとパスが通ってないに違いない,と思い,


>>> import sys
>>> sys.path
['', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info', '/usr/lib/python2.6/site-packages/webkit-1.0']
>>>

やっぱり.
linux-gpib関係はすべて/usr/local/libの下にいます.
そこで,環境変数PYTHONPATHを設定してみた.

$ export PYTHONPATH=/usr/local/lib:/usr/local/lib/python2.6/:/usr/local/lib/python2.6/site-packages/

再びPythonを起動してチェック.
$ python
Python 2.6.6 (r266:84292, Jun 18 2012, 09:59:14) 
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/site-packages', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info', '/usr/lib/python2.6/site-packages/webkit-1.0']

理屈の上ではこれで大丈夫なはず.
もう一度リベンジ!

>>> import Gpib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/site-packages/Gpib.py", line 2, in <module>
    import gpib
ImportError: libgpib.so.0: cannot open shared object file: No such file or directory
>>> 

しんどいなぁ.....
今日は帰ろう.



0 件のコメント:

コメントを投稿