Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix path bugs #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix path bugs #5

wants to merge 1 commit into from

Conversation

myaooo
Copy link

@myaooo myaooo commented Feb 7, 2017

When I was using the version 0.2.4, and use the following command in ipython on macos, there is this bugs with tracebacks:

In [6]: dataset = pytreebank.load_sst("./")
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/Users/mingyao/anaconda/envs/tensorflow/lib/python3.5/shutil.py in move(src, dst, copy_function)
    537     try:
--> 538         os.rename(src, real_dst)
    539     except OSError:

FileNotFoundError: [Errno 2] No such file or directory: './trainDevTestTrees_PTB/trees/dev.txt' -> './dev.txt'

During handling of the above exception, another exception occurred:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-6-37dfe8a72d6d> in <module>()
----> 1 dataset = pytreebank.load_sst("./")

~/anaconda/envs/tensorflow/lib/python3.5/site-packages/pytreebank/parse.py in load_sst(path, url)
    112         path = os.path.expanduser("~/stanford_sentiment_treebank/")
    113         makedirs(path, exist_ok=True)
--> 114     fnames = download_sst(path, url)
    115     return {key: import_tree_corpus(value) for key, value in fnames.items()}
    116

~/anaconda/envs/tensorflow/lib/python3.5/site-packages/pytreebank/download.py in download_sst(path, url)
     81     ZipFile(zip_local).extractall(path)
     82     for fname in local_files.values():
---> 83         move(join(path, 'trainDevTestTrees_PTB', 'trees', fname.split('/')[-1]), fname)
     84     delete_paths([zip_local, join(path, 'trainDevTestTrees_PTB', 'trees'), join(path, 'trainDevTestTrees_PTB')])
     85     return local_files

~/anaconda/envs/tensorflow/lib/python3.5/shutil.py in move(src, dst, copy_function)
    550             rmtree(src)
    551         else:
--> 552             copy_function(src, real_dst)
    553             os.unlink(src)
    554     return real_dst

~/anaconda/envs/tensorflow/lib/python3.5/shutil.py in copy2(src, dst, follow_symlinks)
    249     if os.path.isdir(dst):
    250         dst = os.path.join(dst, os.path.basename(src))
--> 251     copyfile(src, dst, follow_symlinks=follow_symlinks)
    252     copystat(src, dst, follow_symlinks=follow_symlinks)
    253     return dst

~/anaconda/envs/tensorflow/lib/python3.5/shutil.py in copyfile(src, dst, follow_symlinks)
    112         os.symlink(os.readlink(src), dst)
    113     else:
--> 114         with open(src, 'rb') as fsrc:
    115             with open(dst, 'wb') as fdst:
    116                 copyfileobj(fsrc, fdst)

FileNotFoundError: [Errno 2] No such file or directory: './trainDevTestTrees_PTB/trees/dev.txt'

And it was fixed with this commit.
Not sure whether it's the same case on other os.

@JonathanRaiman
Copy link
Owner

@myaooo I believe the latest version 0.2.5 addresses this issue. (pip3 install pytreebank --upgrade). Please let me know if you still run into this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants