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

spell checker displays output then gets stuck in IDLE #56

Open
gaurav-95 opened this issue Apr 6, 2022 · 11 comments
Open

spell checker displays output then gets stuck in IDLE #56

gaurav-95 opened this issue Apr 6, 2022 · 11 comments
Labels
bug Something isn't working IDLE bugs that only occur in python IDLE Windows bugs that only apply to Windows

Comments

@gaurav-95
Copy link

This is my code, I am adding bullets wherever there is a new line and then trying to get spell-checked texts stored in res

import language_tool_python
#tool = language_tool_python.LanguageTool('en-US', config={ 'cacheSize': 1000, 'pipelineCaching': True })

text = 'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy\n. Bet there is something here.\n Bests goats are in town.'
lines = text.split('\n\n' or '\n')
lines = [ "• " + para for para in lines]
res = "\n\n".join(lines)
with language_tool_python.LanguageTool('en-US', config={ 'cacheSize': 1000, 'pipelineCaching': True }) as tool:
  # do stuff with `tool`
    result = tool.correct(res)
    print(result)

I get an output of the corrected text. But there is no error, no other output. Just freezes there. I tried giving explicit close and using with statement as well to no avail.

@jxmorris12 jxmorris12 added the bug Something isn't working label Apr 6, 2022
@jxmorris12
Copy link
Owner

Thanks for reporting @gaurav-95. So to be clear, the print(result) line actually prints? But then the closing of the with statement hangs?

@jxmorris12
Copy link
Owner

@gaurav-95 I just tried running this on my machine and it runs fine - result is printed, and nothing freezes. Please reopen if you're still having issues.

@gaurav-95
Copy link
Author

Will check again and post output.

@gaurav-95
Copy link
Author

gaurav-95 commented Apr 18, 2022

Yes, i can confirm that the output gets printed but the code keeps running on the terminal. It does not finish/ exit from runtime.

image

@jxmorris12 jxmorris12 reopened this Apr 18, 2022
@jxmorris12
Copy link
Owner

I think we can diagnose this issue as: self._terminate_server() not killing server on Windows. That's the most likely cause.

It's difficult for me to debug without a windows machine...

@gaurav-95
Copy link
Author

I see, my bad to not mention I was running on windows beforehand.

@Pikamander2
Copy link

@jxmorris12 - I'm not getting any hard freezes on Windows 10, but I do have a likely-related problem where the java.exe process never ends even after IDLE is closed.

image

At one point I ended up with 20+ java.exe processes running hours after I had finished what I was doing.

Also, each Java process that's running seems to make the script's startup slower. It flashes a window briefly at the bottom of Windows one time for every current process, so if you have 10 java.exe processes running then it'll flash 10 times before the language tool object is successfully created.

Here's the only code required to reproduce the issue:

tool = language_tool_python.LanguageTool('en-US')

@jxmorris12
Copy link
Owner

@Pikamander2 thanks for reporting, this is a serious issue. Are you running that code in a script? Or through the python IDLE?

@Pikamander2
Copy link

@jxmorris12 - I just tested out the process bug in both CMD and IDLE and it looks like this bug also only occurs with IDLE.

In regards to Windows testing, one option that you could try is to run an evaluation copy of Windows in a virtual machine. Alternatively, a Windows VPS is about $5 per month.

@jxmorris12
Copy link
Owner

This SO answer looks relevant: https://stackoverflow.com/a/55411153/2287177

@jxmorris12 jxmorris12 added IDLE bugs that only occur in python IDLE Windows bugs that only apply to Windows labels Aug 10, 2022
@jxmorris12 jxmorris12 changed the title spell checker displays output then gets stuck. spell checker displays output then gets stuck in IDLE Oct 18, 2022
@bMorgan01
Copy link

bMorgan01 commented Nov 25, 2022

Sorry for reviving this, I might have some info that can help.

I see this hanging issue upon calling tool.close() in WSL and in the pydev debugger on top of the previously mentioned terminals.

Weird that this works on my linux machine but not in WSL (running Ubuntu 20)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working IDLE bugs that only occur in python IDLE Windows bugs that only apply to Windows
Projects
None yet
Development

No branches or pull requests

4 participants