Open V35HR4J opened 3 years ago
I have the same problem
AttributeError: module 'fbchat' has no attribute 'Session'
With the sample :
import fbchat
session = fbchat.Session.login("", "") listener = fbchat.Listener(session=session, chat_on=False, foreground=False)
When I installed it from source it solved the problem. It seems like the Session import was removed in the packaged version of the project.
pip install git+https://github.com/carpedm20/fbchat.git
not work for me
pip install git+https://github.com/carpedm20/fbchat.git
Collecting git+https://github.com/carpedm20/fbchat.git
Cloning https://github.com/carpedm20/fbchat.git to c:\users\223\appdata\local\temp\pip-req-build-5u3cezxc
Running command git clone --filter=blob:none -q https://github.com/carpedm20/fbchat.git 'C:\Users\223\AppData\Local\Temp\pip-req-build-5u3cezxc'
Resolved https://github.com/carpedm20/fbchat.git to commit 916a14062d31f3624dfe8dd4ab672648a3e508c0
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\223\appdata\local\programs\python\python38\python.exe' 'C:\Users\223\AppData\Local\Temp\pip-standalone-pip-cyshetqf\__env_pip__.zip\pip' install --ignore-installed --no-user --prefix 'C:\Users\223\AppData\Local\Temp\pip-build-env-18inqv7l\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- flit
cwd: None
Complete output (1 lines):
c:\users\223\appdata\local\programs\python\python38\python.exe: can't find '__main__' module in 'C:\\Users\\223\\AppData\\Local\\Temp\\pip-standalone-pip-cyshetqf\\__env_pip__.zip\\pip'
AttributeError: module 'fbchat' has no attribute 'Session' import fbchat
session = fbchat.Session.login("", "")
listener = fbchat.Listener(session=session, chat_on=False, foreground=False)
for event in listener.listen(): if isinstance(event, fbchat.MessageEvent): print(f"{event.message.text} from {event.author.id} in {event.thread.id}")
If you're not the author, echo