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

AttributeError: module 'liwc' has no attribute 'load_token_parser' #20

Open
miao3906 opened this issue Sep 20, 2022 · 6 comments
Open

Comments

@miao3906
Copy link

Hi Brown,
Thanks so much for your contribution. I got the 2015 dic from developer. When I try to use the liwc, it shows the attribute error. I am a newbie in Python. Just don't know hw to solve the issue cause I can't similar solutions online to this error. The code I used is as follows:

import liwc
liwcPath = ('D:/Dropbox/01_CEO activism/Data/01_raw/LIWC2015Dictionary.dic')
parse, category_names = liwc.load_token_parser('liwcPath')

and the error is like:
C:\Users\miaoyun2\AppData\Local\Programs\Python\Python310\python.exe "D:/CEO activism_Data/02_dofiles/textanalysis.py"
Traceback (most recent call last):
File "D:\CEO activism_Data\02_dofiles\textanalysis.py", line 11, in
parse, category_names = liwc.load_token_parser('liwcPath')
AttributeError: module 'liwc' has no attribute 'load_token_parser'

Thank you so much for your time!

@ericcwiemer
Copy link

Hi there!

I want to echo the thanks for making this. I was wondering if there is any update on this issue as I am also still getting the "module 'liwc' has no attribute 'load_token_parser'". There aren't any other viable options to use LIWC in python so I would really appreciate an acknowledgement or update on this. Again, can't thank you enough for your work on this!

@idiotforever
Copy link

I also encounter the same problem "module 'liwc' has no attribute 'load_token_parser'"... Completely lost 😢

@chbrown
Copy link
Owner

chbrown commented Nov 19, 2023

Taking a wild guess here since I don't have nearly enough context, but I expect anyone running into this has an unrelated liwc.py or liwc/__init__.py in their working directory, which will shadow the pip-installed package.

Normal good case:
terminal session with install import and no conflict

Confusing shadow case:
terminal session with conflicting file

If this is your problem, the solution is to name your files / directories something different.

@idiotforever
Copy link

thank you for your reply! I'm also new to python. I send an email to Dr.Pennebaker and he attached this file to me. I had problem running
import liwc
parse, category_names = liwc.load_token_parser('my path')

I don't know if there's something to be done to this file before running python.
WechatIMG874

@idiotforever
Copy link

idiotforever commented Nov 21, 2023

This is the file overview🙏
WechatIMG875
btw It is so hard for an English major student to learn python from scratch😭

@idiotforever
Copy link

I simply left this problem for two days and did nothing. Suddenly it was fixed. Don't know what happened. 😉

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

4 participants