2

I am trying to resolve some dependencies for the MYSQL connector for Python on Angstrom.

From the command line I get the following error:

Python 2.6.6 (r266:84292, Feb 25 2011, 16:50:01)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named io

I thought that IO was a base-level module. It appears to be up-to-date:

# opkg install python-core
Package python-core (2.6.6-ml12.2.6) installed in root is up to date.

Shouldn't IO be available by default, and what can I do to resolve this issue?

ChronoFish
  • 3,589
  • 5
  • 27
  • 38
  • yes it should be available, how did you install python or is it the system default? – Padraic Cunningham Dec 22 '14 at 00:18
  • It was part of my original Angstrom install (just checked on my notes). I have added a number of options since then using opkg including the OpenCV library. My most recent effort has been getting MySQL to work with it (also using opkg) and a down-loaded mysql connector from the Mysql/Oracle site. – ChronoFish Dec 22 '14 at 00:45
  • 1
    Have you checked the packages to see if you have the io file? – Padraic Cunningham Dec 22 '14 at 00:47
  • Thanks @PadraicCunningham - What would the path/file name be? – ChronoFish Dec 22 '14 at 00:48
  • 1
    not familiar with angstrom-linux but I imagine something like `'/usr/bin/lib/python2.6/io.pyc'` – Padraic Cunningham Dec 22 '14 at 00:57
  • Nope - it's not there: '/usr/lib/python2.6# ls c*.py cProfile.py cgi.py cmd.py codecs.py collections.py commands.py cookielib.py copy_reg.py calendar.py chunk.py code.py codeop.py colorsys.py compileall.py copy.py csv.py' – ChronoFish Dec 22 '14 at 01:11
  • 1
    ok that is strange, like I said I am not familiar with angstrom-linux but you should have the io lib, I would try to reinstall python if possible. – Padraic Cunningham Dec 22 '14 at 01:13
  • I was looking for "core" but looking for "io" did not change the result...still not there. – ChronoFish Dec 22 '14 at 01:26
  • 1
    Have you tried reinstalling? – Padraic Cunningham Dec 22 '14 at 01:32
  • What board ? opkg update then try opkg install python-modules opkg install python-setuptools opkg install python-misc opkg install distribute opkg install python-openssl easy_install pip – lxx Dec 22 '14 at 02:26
  • Thanks @PadraicCunningham - with your help I was able to move on. I re-built the current (currently installed version) and then re-installed the MySQL connector. That did the trick. Answer the question so I can give you credit and close out the question. – ChronoFish Dec 22 '14 at 03:39
  • No worries, you can add an answer yourself and accept it. – Padraic Cunningham Dec 22 '14 at 11:44
  • I wonder, have you tried `opkg install python-io`? – Wtower Nov 01 '16 at 16:20

1 Answers1

0

Thanks to Padraic Cunningham who lead me on the path to a solution.

I found that several files, including io.py were missing from the install. Building the Angstrom for the Beagleboard (XM) image from the Angstrom website did not include these files (or subsequent modifications I made deleted them?). I rebuilt Python, keeping the identical version, from the Python source.

I had to then rebuild the MySQL connector (from MySql/Oracle). (All my other modules including OpenCV continued to work without issue)

This worked and I am now able to query the database.

One additional note. Once all the dependencies were resolved, I still could not connect to the database. The problem was that the MySQL connector was assuming a TCP/IP connection rather than file based socket. So I had to add the following to the connection string:

unix_socket="/tmp/mysql.sock"

Such that the full connection string looked like this:

cnx = mysql.connector.connect(user='username', password='password', host='localhost', database='dbname', raise_on_warnings=True, unix_socket="/tmp/mysql.sock")
ChronoFish
  • 3,589
  • 5
  • 27
  • 38