I write a very simple python code for testing PyInstaller compile issue.
Here is the code:
import yake
def main():
text = "Java基本数据类型"
language = "cz"
max_ngram_size = 3
deduplication_threshold = 0.9
numOfKeywords = 10
custom_kw_extractor = yake.KeywordExtractor(lan=language, n=max_ngram_size, dedupLim=deduplication_threshold, top=numOfKeywords, features=None)
keywords = custom_kw_extractor.extract_keywords(text)
for kw in keywords:
print(kw)
if __name__ == "__main__":
main()
The command: "python -m PyInstaller -F kw.py" run sucessfully. However, when I run the executable .exe file. It gives me error:
D:\interview_helper\keywordsExactTest\dist>kw.exe
Warning, read stopword list as ISO-8859-1
Traceback (most recent call last):
File "yake\yake.py", line 28, in __init__
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\wangs\\AppData\\Local\\Temp\\_MEI188842\\yake\\StopwordsList\\stopwords_noLang.txt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "kw.py", line 15, in <module>
File "kw.py", line 9, in main
File "yake\yake.py", line 32, in __init__
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\wangs\\AppData\\Local\\Temp\\_MEI188842\\yake\\StopwordsList\\stopwords_noLang.txt'
[26272] Failed to execute script 'kw' due to unhandled exception!
I write a very simple python code for testing PyInstaller compile issue. Here is the code:
The command: "python -m PyInstaller -F kw.py" run sucessfully. However, when I run the executable .exe file. It gives me error:
Thanks for helping.