techouse / mysql-to-sqlite3

Transfer data from MySQL to SQLite
https://techouse.github.io/mysql-to-sqlite3/
MIT License
222 stars 31 forks source link

Not installing mysql client libraries gives python exception FileNotFoundError #9

Closed CozC closed 4 years ago

CozC commented 4 years ago

Describe the bug Not installing mysql client libraries a python error is thrown

Expected behaviour A messages that something is missing or need to be installed as a dependency

Actual result Traceback (most recent call last): File "/usr/bin/mysql2sqlite", line 7, in from mysql_to_sqlite3.cli import cli File "/usr/lib/python2.7/site-packages/mysql_to_sqlite3/cli.py", line 65, in message=tabulate(info(), headers=["software", "version"], tablefmt="github") File "/usr/lib/python2.7/site-packages/mysql_to_sqlite3/debug_info.py", line 88, in info ["MySQL", _mysql_version()], File "/usr/lib/python2.7/site-packages/mysql_to_sqlite3/debug_info.py", line 70, in _mysql_version except FileNotFoundError: NameError: global name 'FileNotFoundError' is not defined

System Information Centos 7.6.1810

$ mysql2sqlite --version
| software               | version                                                                       |
|------------------------|-------------------------------------------------------------------------------|
| mysql-to-sqlite3       | 1.3.2                                                                         |
|                        |                                                                               |
| Operating System       | Linux 3.10.0-957.el7.x86_64                                                   |
| Python                 | CPython 2.7.5                                                                 |
| MySQL                  | mysql  Ver 15.1 Distrib 5.5.65-MariaDB, for Linux (x86_64) using readline 5.1 |
| SQLite                 | 3.7.17                                                                        |
|                        |                                                                               |
| click                  | 7.1.2                                                                         |
| mysql-connector-python | 8.0.21                                                                        |
| python-slugify         | 4.0.1                                                                         |
| pytimeparse            | 1.1.8                                                                         |
| simplejson             | 3.17.2                                                                        |
| six                    | 1.15.0                                                                        |
| tabulate               | 0.8.7                                                                         |
| tqdm                   | 4.48.2                                                                        |

Additional context installing the mariadb dependency fixed the issue. yum install mariadb

techouse commented 4 years ago

Hmm, OK, I kinda find it hard to believe that you'd only have a server and not a client binary installed. But yea I see the issue.

CozC commented 4 years ago

My development machine is on windows (mysql also) and I wanted to have the
exact replica of a mysql database in sqlite. Given the fact the python for
windows does not work very well I installed a centos 7 in virtual machine
and I forgot to install the mysql/mariadb packages. A quick look over the
source code gave me the necessary clue to install also de mysql/mariadb
client libraries. Indeed after the installation everything went smooth. Thanks for the effort in maintaining it.

On Mon, 17 Aug 2020 16:13:06 +0300, Klemen Tusar
notifications@github.com wrote:

Hmm, OK, I kinda find it hard to believe that you'd only have a server
and not a client binary installed. But yea I see the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

-- Cosmin Cioranu

techouse commented 4 years ago

By the way, I expected FileNotFoundError to be thrown, however, since you're using Python 2, which does not have that exception, it failed spectacularly. With Python 3 it would have simply caught it and told you that it can't fetch the version. True, I forgot to test this, but I didn't think it would ever come up. :)

Also, and please remember, every time you use Python 2, God violently murders 3485783298137249859132749 kittens. So please stahp :D