ForwardMessage not working
Closed this issue · 1 comments
avremy commented
Hey
Forward message function seems to be failing
from WPP_Whatsapp import Create
# start client with your session name
your_session_name = "test"
creator = Create(session=your_session_name)
client = creator.start()
# Now scan Whatsapp Qrcode in browser
# check state of login
if creator.state != 'CONNECTED':
raise Exception(creator.state)
phone_number = "123456789" # or "+201016708170"
message = "hello from wpp"
# Simple message
result = client.sendText(phone_number, message)
id = result.get('id')
forward_phone_number = '9876543210'
client.forwardMessages(forward_phone_number,id,False)
error is
Traceback (most recent call last):
File "/Users/user/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1534, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Applications/PyCharm Professional Edition.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/user/Code/app/WhatsappBot/main.py", line 26, in <module>
client.forwardMessages(forward_phone_number,id,False)
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/SenderLayer.py", line 76, in forwardMessages
return self.ThreadsafeBrowser.run_threadsafe(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/WPP_Whatsapp/controllers/browser.py", line 53, in run_threadsafe
return super().run_threadsafe(func, timeout_=timeout_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 316, in run_threadsafe
result = future.result()
^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 306, in __step_run_and_handle_result
result = coro.throw(exc)
^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 308, in run_task
r = await task_
^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/WPP_Whatsapp/api/layers/SenderLayer.py", line 413, in forwardMessages_
return await self.ThreadsafeBrowser.page_evaluate("""({ to, messages, skipMyMessages }) =>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 475, in page_evaluate
return await self.create_task(page.evaluate(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/PlaywrightSafeThread/browser/threadsafe_browser.py", line 285, in create_task
return await self.loop.create_task(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/futures.py", line 287, in __await__
yield self # This tells Task to wait for completion.
^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 375, in __wakeup
future.result()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 304, in __step_run_and_handle_result
result = coro.send(None)
^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/playwright/async_api/_generated.py", line 8340, in evaluate
await self._impl_obj.evaluate(
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/playwright/_impl/_page.py", line 440, in evaluate
return await self._main_frame.evaluate(expression, arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/playwright/_impl/_frame.py", line 278, in evaluate
await self._channel.send(
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 59, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Code/app/WhatsappBot/.venv/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 514, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.evaluate: Object
python-BaseException
thanks for an awesome app
3mora2 commented
now update to last version