fbchat icon indicating copy to clipboard operation
fbchat copied to clipboard

AttributeError: module 'fbchat' has no attribute 'Session'

Open V35HR4J opened this issue 4 years ago • 3 comments

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 if event.author.id != session.user.id: event.thread.send_text(event.message.text)

V35HR4J avatar Feb 01 '21 13:02 V35HR4J

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)

alexdupat avatar Mar 16 '21 06:03 alexdupat

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

emilwareus avatar Apr 25 '21 21:04 emilwareus

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'

ras5566 avatar Mar 03 '23 08:03 ras5566