Skip to content

Vocab.load throws error due to "/" operator usage with strings.  #617

@williamleif

Description

@williamleif

When I attempt to run Vocab.load(path) I get the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-81-2ca5fe3111cd> in <module>()
----> 1 Vocab.load(str(constants.DATA_HOME + "spacy_comments/vocab.bin"))

/afs/cs.stanford.edu/u/wleif/anaconda/lib/python2.7/site-packages/spacy/vocab.pyx in spacy.vocab.Vocab.load (spacy/vocab.cpp:3559)()
     77                 "vectors argument to Vocab.load() deprecated. "
     78                 "Install vectors after loading.")
---> 79         if tag_map is True and (path / 'vocab' / 'tag_map.json').exists():
     80             with (path / 'vocab' / 'tag_map.json').open('r', encoding='utf8') as file_:
     81                 tag_map = json.load(file_)

TypeError: unsupported operand type(s) for /: 'str' and 'unicode'

Looking at error and code it appears that '/' operator is being applied to strings, which my Python does not agree with. Is this an issue with my Python version or something similar? I've tested the use of '/' with strings in Python 3 as well and get the same error.

Thanks!!

Environment

  • Operating System: CentOs 6.8
  • Python Version Used: Python 2.7
  • spaCy Version Used: 1.2.0
  • Environment Information: Standard Anaconda packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and behaviour differing from documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions