开发者

IMDbPY Importing to MySQL Problem

开发者 https://www.devze.com 2023-04-06 16:16 出处:网络
I am having a problem while trying to import imdb data from text files to MySQL database using imdbpy2sql.py script.

I am having a problem while trying to import imdb data from text files to MySQL database using imdbpy2sql.py script.

It throws the following error. It seems like the exception handler code tries to insert a duplicated record into cast_info table with existing primary key.

Can anyone help me fix this problem or suggest any work around solution?

SCANNING actor: Hall, Stephan
SCANNING actor: Halsey, William F.
 * FLUSHING CharactersCache...
 * TOO MANY DATA (100000 items in CharactersCache), recursion: 1
   * SPLITTING (run 1 of 2), recursion: 1
 * FLUSHING CharactersCache...
Traceback (most recent call last):
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 2951, in <module>
    run()
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 2812, in run
    castLists(_charIDsList=characters_imdbIDs)
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 1576, in castLists
    doCast(f, roleid, rolename)
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 1535, in doCast
    cid = CACHE_CID.addUnique(role)
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 957, in addUnique
    else: return self.add(key, miscData)
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 950, in add
    self[key] = c
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 860, in __setitem__
    self.flush()
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 912, in flush
    self.flush(quiet=quiet, _recursionLevel=_recursionLevel)
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 883, in flush
    self._toDB(quiet)
  File "D:\project\IMDB\IMDbPY-4.7\bin\imdbpy2sql.py", line 1186, in _toDB
    CURS.executemany(self.sqlstr, self.converter(l))
  File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 206, in executemany
    r = r + self.execute(query, a)
  File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.IntegrityError: (1062, "Duplicate entry '745684开发者_如何转开发' for key 'PRIMARY'")


A lot of similar problems were fixed in the development version. Please try again with the version in the Mercurial repository: https://bitbucket.org/alberanid/imdbpy/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号