I have an application that analyses text looking for keywords using natural language processing.
I created an executable and it works fine on my computer.
I've sent it to a friend but in his computer he gets an error:
Traceback (most recent call last):
File "Main.py", line 15, in <module>
File "Menu.py", line 349, in main_menu
File "Menu.py", line 262, in analyse_text_menu
File "Menu.py", line 178, in analyse_text_function
File "AnalyseText\ProcessText.py", line 232, in process_text
File "AnalyseText\ProcessText.py", line 166, in generate_keyword_complete_list
File "AnalyseText\ProcessText.py", line 135, in lemmatize_text
File "stanza\pipeline\core.py", line 88, in _init_
stanza.pipeline.core.ResourcesFileNotFoundError: Resources file not found at: C:\Users\jpovoas\stanza_resources\resources.json Try to download the model again.
[26408] Failed to execute script 'Main' due to unhandled exception!
It's looking for resources.json
inside a folder in his computer. Even though I've added stanza
as a hidden import with pyinstaller.
I'm using a model in another language, as opposed to the default one in english. The model is located in a folder inside the User folder.
The thing is, I don't want the end user to have to download the model separatedly.
I've managed to include the model folder with --add-data C:\Users\Laila\stanza_resources\pt;Stanza"
when creating the executable.
It still looks for the model's json file inside the stanza_resources
folder that's should be inside the User folder of whoever is using the program.
How do I tell stanza to look for the model inside the executable folder generated instead?
Can I just add stanza.download("language")
in my script? If so how do I change stanza's model download folder? I want it to be downloaded into a folder inside the same directory as the executable. How do I do that?