Skip to content

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

Merged
ctran merged 1 commit into
ctran:developfrom
Hamms:ensure-string-paths
May 10, 2021
Merged

Allow get_loaded_model to succeed when $LOAD_PATH contains non-string values#848
ctran merged 1 commit into
ctran:developfrom
Hamms:ensure-string-paths

Conversation

@Hamms

@HammsHamms commented Jan 26, 2021

Copy link
Copy Markdown
Contributor

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.
Fixesctran#758
@bopm

bopm commented May 10, 2021

Copy link
Copy Markdown

@ctran any news on this one?

@ctran
ctran merged commit e075a21 into ctran:developMay 10, 2021
@ctran

Copy link
Copy Markdown
Owner

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.
Fixesctran#758
@Hamms
Hamms deleted the ensure-string-paths branch April 28, 2023 18:51
Sign up for freeto 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

@Hamms@bopm@ctran