Posts

Showing posts from August, 2011

ImportError: Can't load a json library while easy_install Tweepy

was playing with these:

- http://parezcoydigo.wordpress.com/2011/04/23/twitter-from-the-command-line/
- http://talkfast.org/2010/05/31/twitter-from-the-command-line-in-python-using-oauth

Was trying to install Tweepy library for python.
Encountered below:

1) yum install python-setuptools -y [success]
2) easy_install tweepy [success]
3) Made a simple script, trying to make use of Tweepy [Failed]

so tried to easy_install simplejson, also failed:
[root@chi alakClient]# easy_install simplejson
Searching for simplejson
Reading http://cheeseshop.python.org/pypi/simplejson/
Reading http://github.com/simplejson/simplejson
Reading http://cheeseshop.python.org/pypi/simplejson/2.1.6
Best match: simplejson 2.1.6
Downloading http://pypi.python.org/packages/source/s/simplejson/simplejson-2.1.6.tar.gz#md5=2f8351f6e6fe7ef25744805dfa56c0d5
Processing simplejson-2.1.6.tar.gz
Running simplejson-2.1.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-mEH9fn/simplejson-2.1.6/egg-dist-tmp-2qtieS
simplejson…

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)

Installed mysql 4 from dmg ackage, 64 bit.
started mysqld from preferences, but when trying to connect received this error:

MyCOmp~ # mysql5 -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (38)

The issue? well, few things:

1) make sure the /opt/local/var/run/mysql5/ directory does exist.
2) make sure proper permission, for write purpose for mysql user: sudo chown mysql:admin /opt/local/var/run/mysql5/
3) create and softlink it to proper places. which in my case, i took example of my.cnf from /opt/local/share/mysql5/mysql/my-small.cnf then after renaming it to /opt/local/etc/mysql/my.cnf. i then softlink this to /etc/mysql/my.cnf. Note that you might need to create the directory /etc/mysql

And then it works like a charm. :)

/alak