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

Compiling with pyinstaller does not work if "--collect-all hanja" is not used #32

Open
linguistbro opened this issue Aug 20, 2024 · 3 comments

Comments

@linguistbro
Copy link

linguistbro commented Aug 20, 2024

Hello! Unfortunately, I am not an advanced python coder so I'm not sure if I can provide the best feedback but here is what I encountered.

  1. Compile my app using pyinstaller
    pyinstaller -F -w main.py
  2. Run the application using the main.exe
  3. The 'hanja' corresponding function is not working. The app does not crash, the app does not throw any error at all. It just does nothing.
  4. I go back to my IDE and test it. Everything is working perfectly fine without any errors.
  5. I start to use additional commands with pyinstaller. I try --hidden-import, it does not work. Then, I try --collect-all and it works.
  6. I get confused. I have no idea why it didn't work previously but it worked after.

This is the only bit of hanja I use in my code:
converted_source = hanja.translate(source_value, 'substitution')

I do not know what info/files/logs to share with you to provide more information, please let me know if you want more specific details. It might be a rare issue, I might be the only person encountering this type of problem.

Edit: I'm using python 3.11 and a venv. Also, I am able to reproduce this problem 100% of the time.

@suminb
Copy link
Owner

suminb commented Aug 20, 2024

Can you copy & paste some of the source values that you tried, if they're not confidential? Some characters appear the same but they actually use different unicode values. The Hanja coverage of this library is not complete so I'd suspect the source_value is a such case.

@linguistbro
Copy link
Author

linguistbro commented Aug 20, 2024

The source code is confidential unfortunately but I can share the simplified version. I even used this example "大韓民國은 民主共和國이다." that is on the homepage when testing my app.

source_value is a pandas dataframe string. My dataframe only has 2 columns and rows (for testing purposes).

The test code is like this:

for index, row in dataframe.iterrows():
 source_value = row['Source']
 converted_source = hanja.translate(source_value, 'substitution')
 return converted_source

I used some debugging with the code to find out where it stops because it does not throw any errors.

I updated the code to be like this. I am using PyQt6:

for index, row in dataframe.iterrows():
 error_label.setText('Working - 1')
 source_value = row['Source']
 error_label.setText('Working - 2')
 converted_source = hanja.translate(source_value, 'substitution')
 error_label.setText('Working - 3')
 return converted_source

The label never changes to 'Working - 3'. The app does not freeze or crash, any other function on the app continues to work fine (it is a multi function tool). However, if I compile again with pyinstaller using '--collect-all hanja', everything is fine! If I run the code from the IDE, it is also fine.

I know it sounds super odd but this is what I experience if I don't use '--collect-all hanja' with pyinstaller.

@linguistbro
Copy link
Author

linguistbro commented Aug 20, 2024

I will try to replicate this issue with a small dummy code at home using my personal PC. If I can replicate the issue again, I will share the dummy code and a video. I cannot share any part of the app I am working on at work, sorry.

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

No branches or pull requests

2 participants