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

Language.save_to_directory fails if the path is a string #1009

Closed
jgc128 opened this issue Apr 23, 2017 · 4 comments
Closed

Language.save_to_directory fails if the path is a string #1009

jgc128 opened this issue Apr 23, 2017 · 4 comments
Labels
bug Bugs and behaviour differing from documentation

Comments

@jgc128
Copy link

jgc128 commented Apr 23, 2017

Hi,

The documentation says that the path argument in the Language.save_to_directory method can be a string. However, this methods fails in such case:

File "lib/python3.6/site-packages/spacy/language.py", line 353, in save_to_directory
    self.setup_directory(path, **configs)
File "lib/python3.6/site-packages/spacy/language.py", line 192, in setup_directory
    directory = path / name
TypeError: unsupported operand type(s) for /: 'str' and 'str'

It works fine if the argument is a pathlib's Path.

Your Environment

  • spaCy version: 1.8.0
  • Platform: Linux-4.4.0-66-generic-x86_64-with-Ubuntu-16.04-xenial
  • Python version: 3.6.1
  • Installed models: en, en_core_web_md
@ines
Copy link
Member

ines commented Apr 23, 2017

Hmm, this is interesting! Could you share how you're calling save_to_directory(), i.e. the value you're passing in?

spaCy currently uses an ensure_path() helper function that should make sure string types are turned into pathlib paths. But somehow, this seems to fail here and returns a string...

@jgc128
Copy link
Author

jgc128 commented Apr 23, 2017

Oh, I see - I was using the version from pip, and it does not call ensure_path in save_to_directory, whereas the version from github uses it.

I'll close the issue then.

Thanks!

@jgc128 jgc128 closed this as completed Apr 23, 2017
@ines
Copy link
Member

ines commented Apr 23, 2017

Oh, I didn't realise this was a fix we hadn't released as part of v1.8.0 yet. The next point release will hopefully be up on pip later tonight! Sorry about the confusion.

@ines ines added the bug Bugs and behaviour differing from documentation label Apr 23, 2017
@lock
Copy link

lock bot commented May 8, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation
Projects
None yet
Development

No branches or pull requests

2 participants