Skip to content

Conversation

@yidinghao
Copy link

In biberplus.tagger.tagger_utils, the function build_variable_dictionaries does not run properly in Windows. This is because on line 21, the filenames are being parsed by splitting on '/':

# E.g. constants/suasive_verbs.txt -> suasive_verbs
file_name = constant_file.split('/')[-1].replace('.txt', '')
variables_dict[file_name] = read_in_variables(constant_file)

This code does not behave as intended on Windows, because Windows directories use '\\' instead of '/'. Thus, the variables_dict key corresponding to constants/suasive_verbs.txt is 'constants\\suasive_verbs' instead of 'suasive_verbs'. This causes several downstream errors, e.g. when running biberplus.tagger.tag_text.

To fix this issue, this pull request parses the filenames using pathlib instead of splitting on '/', thus populating variables_dict correctly on all platforms.

… Windows, which uses \ instead of / for directories.
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.

1 participant