sfu-natlang / lensingwikipedia

Lensing Wikipedia is an interface to visually browse through human history as represented in Wikipedia. This the source code that runs the website:
http://lensingwikipedia.cs.sfu.ca
Other
11 stars 4 forks source link

TSNE code fails if pwd is incorrect #179

Closed avacariu closed 9 years ago

avacariu commented 9 years ago

I usually run it as ./backend/tsne full.index rather than ./tsne ../full.index, but it fails with the following error:

Traceback (most recent call last):
  File "./backend/tsne", line 148, in <module>
    run(input_index, perplexity, theta, pca_dimensions, verbose, output_index, doc_buffer_size, do_dummy)
  File "./backend/tsne", line 71, in run
    for (metadatum, coordinate) in zip(metadata, coordinates):
  File "/home/vlad/Documents/dev/projects/lensingwikipedia/domains/wikipediahistory/backend/bhtsne/bhtsne.py", line 92, in bh_tsne
    with TmpDir() as tmp_dir_path:
  File "/home/vlad/Documents/dev/projects/lensingwikipedia/domains/wikipediahistory/backend/bhtsne/bhtsne.py", line 62, in __enter__
    self._tmp_dir_path = mkdtemp(dir='Temp/')
  File "/home/vlad/.local/bin/anaconda/envs/venv/lib/python2.7/tempfile.py", line 333, in mkdtemp
    _os.mkdir(file, 0700)
OSError: [Errno 2] No such file or directory: 'Temp/tmpomcozk'

The failure is because dir='Temp/' is a relative path. The call to mkdtemp should probably use something like os.path.abspath(os.path.dirname(__file__)) rather than relative paths, or maybe we should be using /tmp instead of Temp/?

anoopsarkar commented 9 years ago

Can you fix it yourself or should we get @KonceptGeek involved?

avacariu commented 9 years ago

I can fix it, but I just wanted to document it to remember what the issue is.

I think I'll switch to using /tmp as that'll get rid of an extra line from the Makefile, too.