QuinterApp / Quinter

The accessible Quinter Twitter client
11 stars 9 forks source link

"no module named 'tolk'" error when running #10

Closed mehgcap closed 3 years ago

mehgcap commented 3 years ago

I don't think this is a common problem, but here goes... When I run Quinter from source, I get the following traceback in errors.log:

Traceback (most recent call last):
  File "quinter.pyw", line 17, in <module>
    import speak
  File "C:\Users\mehgc\programming\Quinter\speak.py", line 6, in <module>
    import Tolk as speaker
  File "C:\Users\mehgc\programming\Quinter\Tolk.py", line 11, in <module>
    _tolk = cdll.Tolk
  File "C:\Program Files\Python38\lib\ctypes\__init__.py", line 443, in __getattr__
    dll = self._dlltype(name)
  File "C:\Program Files\Python38\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'Tolk' (or one of its dependencies). Try using the full path with constructor syntax.

I ran pip install tolk, even after installing everything from requirements.txt, and pip did install the package. Yet the error remains, and I'm not quite sure why. I even tried running "regsvr32 Tolk.dll", just to see if that would do anything, but I got an error. I'm on Python 3.8 in case that matters.

TheQuinbox commented 3 years ago

Hi, This is a common problem with Python 3.8 and above. I thought I fixed it, but apparently only for 3.9 ,as that worked for me. Will look into this. Thanks!

TheQuinbox commented 3 years ago

Hi, Can you let me know if the latest commit fixes this? Thanks!

mehgcap commented 3 years ago

That did seem to take care of that error, though there's now a new one related to the dll directory that Tolk tries to create:

Traceback (most recent call last):
  File "quinter.pyw", line 16, in <module>
    import speak
  File "C:\Users\mehgc\programming\Quinter\speak.py", line 6, in <module>
    import Tolk as speaker
  File "C:\Users\mehgc\programming\Quinter\Tolk.py", line 14, in <module>
    os.add_dll_directory(".")
  File "C:\Program Files\Python38\lib\os.py", line 1109, in add_dll_directory
    cookie = nt._add_dll_directory(path)
OSError: [WinError 87] The parameter is incorrect: '.'
TheQuinbox commented 3 years ago

Why, Python, why must you change things like this? OK, I'll see what I can do. Sorry if this takes a bit of time, I don't feel good and won't be in town for a lot of this week.

mehgcap commented 3 years ago

No problem; there's no hurry. I've never seen this, or dealt with DLLs in Python, but I'll see what I can find as well. It's also no big deal for me to go to 3.9, if that'd be easier. You could just set your minimum version there and be done with it.

TheQuinbox commented 3 years ago

OK, does it work now? If not, I'm going to have to do this the hard way. I'm testing on 3.7 again, but really should install 3.8.

mehgcap commented 3 years ago

Unfortunately, no. I'm seeing the same error, but with ./ now. Just to be sure, you're updating the main branch, right? I'm not supposed to be testing this on a different branch I don't have pulled yet?

TheQuinbox commented 3 years ago

Yup, you are. OK, I'll work on this a bit later, or if you know something I don't about this new method of loading DLLs, feel free to PR. Sorry for the trouble.

masonasons commented 3 years ago

@mehgcap mind giving this a try?

mehgcap commented 3 years ago

I think you have something! I'm getting the below traceback, but it's nothing to do with DLLs or Tolk.

Traceback (most recent call last):
  File "quinter.pyw", line 17, in <module>
    from GUI import main
  File "C:\Users\mehgc\programming\Quinter\GUI\main.py", line 9, in <module>
    import globals
  File "C:\Users\mehgc\programming\Quinter\globals.py", line 4, in <module>
    from GUI import main, misc
  File "C:\Users\mehgc\programming\Quinter\GUI\misc.py", line 7, in <module>
    from . import chooser, main, tweet, view
  File "C:\Users\mehgc\programming\Quinter\GUI\tweet.py", line 9, in <module>
    import twitter_text.parse_tweet
ModuleNotFoundError: No module named 'twitter_text'

I think twitter_text is absent from requirements.txt, but I got the same error even after I installed it with pip.

masonasons commented 3 years ago

@mehgcap pip install twitter_text_parser

This is in the requirements.

masonasons commented 3 years ago

Make sure you uninstall twitter_text, though.

mehgcap commented 3 years ago

Thanks. Uninstalling twitter_text, then re-running pip install -r requirements.txt did the job. I'm now able to run from source.