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

Allow get_loaded_model to succeed when $LOAD_PATH contains non-string values #848

Merged
merged 1 commit into from
May 10, 2021

Conversation

Hamms
Copy link
Contributor

@Hamms Hamms commented Jan 26, 2021

As currently implemented, get_loaded_model inspects the $LOAD_PATH global for path values when trying to find the path for a model file. This would be fine, except that variable is affected by userspace, which means that it will sometimes contain non-string values, often Pathnames. To avoid responding with the error Unable to annotate #{model_path}: no implicit conversion of Pathname into String in this situation, we simply add an explicit to_s call before performing string-specific operations.

Thanks to @a0s for doing the investigation here, and identifying exactly what needed to be changed in order to resolve this issue!

Fixes #758

…ring values

As currently implemented, `get_loaded_model` inspects the `$LOAD_PATH` global for path values when trying to find the path for a model file.  This would be fine, except that variable is affected by userspace, which means that it will sometimes contain non-string values, often Pathnames.  To avoid responding with the error `Unable to annotate #{model_path}: no implicit conversion of Pathname into String` in this situation, we simply add an explicit `to_s` call before performing string-specific operations.

Fixes ctran#758
@bopm
Copy link

bopm commented May 10, 2021

@ctran any news on this one?

@ctran ctran merged commit e075a21 into ctran:develop May 10, 2021
@ctran
Copy link
Owner

ctran commented May 10, 2021

Thanks!

ocarta-l pushed a commit to ocarta-l/annotate_models that referenced this pull request Jun 18, 2021
…ring values (ctran#848)

As currently implemented, `get_loaded_model` inspects the `$LOAD_PATH` global for path values when trying to find the path for a model file.  This would be fine, except that variable is affected by userspace, which means that it will sometimes contain non-string values, often Pathnames.  To avoid responding with the error `Unable to annotate #{model_path}: no implicit conversion of Pathname into String` in this situation, we simply add an explicit `to_s` call before performing string-specific operations.

Fixes ctran#758
@Hamms Hamms deleted the ensure-string-paths branch April 28, 2023 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no implicit conversion of Pathname into String
3 participants