1

I'm a former developer but haven't really used Python before. I'm trying to run imdbpy2sql to get the full IMDB into a MySQL database before the ftp files go away.

Python is installed. SQLObject is installed. From the command line, I start from the IMDBPy bin directory and run this line:

E:\IMDB\IMDBPy\imdbpy-5.1\bin>imdbpy2sql.py -d e:\IMDB\IMDB_PT -u mysql://root:a
dmin@localhost/imdb2

...and I get:

  File "E:\IMDB\IMDBPy\imdbpy-5.1\bin\imdbpy2sql.py", line 185
    except getopt.error, e:
                       ^

SyntaxError: invalid syntax

My plain text files are in e:\IMDB\IMDB_PT. I'm just running a personal MySQL database with user root, password admin.

Looking at the code, line 135 and surrounding looks like this:

133 for opt in optlist:
134     if opt[0] in ('-d', '--data'):
135         IMDB_PTDF_DIR = opt[1]
136     elif opt[0] in ('-u', '--uri'):
137         URI = opt[1]
138     elif opt[0] in ('-c', '--csv'):
139         CSV_DIR = opt[1]
140     elif opt[0] == '--csv-ext':
141         CSV_EXT = opt[1]
142     elif opt[0] in ('-i', '--imdbids'):
143         IMDBIDS_METHOD = opt[1]
144     elif opt[0] in ('-e', '--execute'):

...and it goes on a bit. But it seems to be saying my parameters are off. I just don't have enough experience running this package to know what I've done wrong.

Any help would be appreciated.

DocMagro
  • 33
  • 1
  • 4

1 Answers1

0

IMDbPY is currently compatible only with Python 2.x, and it seems you're running it using Python 3.

Install Python 2.7 (if not already present on your system), and use it to run the script:

python2 imdbpy2sql.py [arguments]
Davide Alberani
  • 1,061
  • 1
  • 18
  • 28
  • Thanks! Going to mark this correct although I cannot verify it, because I believe it moved me further along. I am encountering other problems trying to get all the packages installed successfully with Python 2.7 so I can run IMDBPy scripts. Will post a new question with my current problem. – DocMagro Nov 04 '17 at 18:01