jimmyppi / searchthemcp

Add search functionality to the Marvel Chronology Project
3 stars 0 forks source link

files not being written #1

Open nwtn opened 10 years ago

nwtn commented 10 years ago

Hey, I'm having trouble getting this going. It looks like the files aren't being saved, and then an error is being thrown when the script tries to read the files that aren't there:

dnewton@newtron ~/Sites/searchthemcp-master 👍  ./searchthemcp.py
Traceback (most recent call last):
  File "./searchthemcp.py", line 178, in <module>
    createFiles(update_source_files=args.download, sql_files_max_size=args.maxsqlsize)
  File "./searchthemcp.py", line 128, in createFiles
    figures,comics,anomalies = parser.getFiguresAndComics(verbose=True)
  File "/Users/dnewton/Sites/searchthemcp-master/mcparser.py", line 151, in getFiguresAndComics
    self.abbrs = self._getAbbreviations()
  File "/Users/dnewton/Sites/searchthemcp-master/mcparser.py", line 204, in _getAbbreviations
    key = self._readFile(self.KEYFILE)
  File "/Users/dnewton/Sites/searchthemcp-master/mcparser.py", line 193, in _readFile
    with open(os.path.join(MCPFILESDIR, f + self.FILEEND), 'r') as inp:
IOError: [Errno 2] No such file or directory: '/Users/dnewton/Sites/searchthemcp-master/data/mcp/key.php'

Any ideas?

Thanks!

jimmyppi commented 10 years ago

Hi!

The files are not downloaded by default, so the first time you run the script the download flag needs to be provided:

$ ./searchthemcp.py --download

Does that help?

nwtn commented 10 years ago

It helps, but still results in an error. This time it looks like it's breaking while trying to create the data directory:

dnewton@newtron ~/Sites/searchthemcp-master 👍  ./searchthemcp.py --download
Traceback (most recent call last):
  File "./searchthemcp.py", line 178, in <module>
    createFiles(update_source_files=args.download, sql_files_max_size=args.maxsqlsize)
  File "./searchthemcp.py", line 127, in createFiles
    parser.updateMCPFiles()
  File "/Users/dnewton/Sites/searchthemcp-master/mcparser.py", line 176, in updateMCPFiles
    os.mkdir(MCPFILESDIR)
OSError: [Errno 2] No such file or directory: '/Users/dnewton/Sites/searchthemcp-master/data/mcp'
dnewton@newtron ~/Sites/searchthemcp-master

If I create the directories manually, though, it works! Thanks for the help.

jimmyppi commented 10 years ago

Good!

I should probably make the script more friendly by asking to download them if they don't exist.