aisingapore / TagUI

Free RPA tool by AI Singapore
Apache License 2.0
5.65k stars 585 forks source link

PHP Notice and Fatal error on MacOS when running TagUI? #1332

Closed lookang closed 2 months ago

lookang commented 1 year ago

this error is output on the terminal every time i run tagui.

Screenshot 2023-03-15 at 10 10 32 AM

PHP Warning: file_get_contents(tagui_chrome.in): Failed to open stream: No such file or directory in /Users/lookang/Desktop/tagui/src/tagui_chrome.php on line 34 PHP Deprecated: Creation of dynamic property WebSocket\Client::$options is deprecated in /Users/lookang/Desktop/tagui/src/ws/Client.php on line 25

START - automation started - Wed Mar 15 2023 09:57:22 GMT+0800 (+08) PHP Notice: fwrite(): Send of 83 bytes failed with errno=32 Broken pipe in /Users/lookang/Desktop/tagui/src/ws/Base.php on line 246 PHP Fatal error: Uncaught WebSocket\ConnectionException: Could only write out of 83 bytes. in /Users/lookang/Desktop/tagui/src/ws/Base.php:249 Stack trace:

0 /Users/lookang/Desktop/tagui/src/ws/Base.php(126): WebSocket\Base->write('\x81\xCD\xE9y\xD4\xF7\x92[\xBD\x93\xCBC\xE7\xDB\xCB...')

1 /Users/lookang/Desktop/tagui/src/ws/Base.php(70): WebSocket\Base->send_fragment(true, '{"id":3,"method...', 'text', true)

2 /Users/lookang/Desktop/tagui/src/tagui_chrome.php(47): WebSocket\Base->send('{"id":3,"method...')

3 {main}

thrown in /Users/lookang/Desktop/tagui/src/ws/Base.php on line 249

according to chatgpt This error message is related to a PHP script that is attempting to use the TagUI RPA (Robotic Process Automation) tool to automate a web browser. Here's a breakdown of the error message:

PHP Warning: file_get_contents(tagui_chrome.in): Failed to open stream: No such file or directory in /Users/lookang/Desktop/tagui/src/tagui_chrome.php on line 34: This warning indicates that the PHP script is attempting to read the contents of a file named tagui_chrome.in, but the file does not exist in the specified directory. This could be due to a misconfiguration or incorrect file path.

PHP Deprecated: Creation of dynamic property WebSocket\Client::$options is deprecated in /Users/lookang/Desktop/tagui/src/ws/Client.php on line 25: This deprecated notice indicates that the PHP script is using a deprecated method to create a dynamic property $options in the WebSocket\Client class. This means that this property may be removed in future versions of the library, and the script should be updated to use a different approach.

PHP Notice: fwrite(): Send of 83 bytes failed with errno=32 Broken pipe in /Users/lookang/Desktop/tagui/src/ws/Base.php on line 246: This notice indicates that an attempt to write data to a stream failed because the pipe to the underlying process was broken. This could be due to a network issue or a problem with the server.

PHP Fatal error: Uncaught WebSocket\ConnectionException: Could only write out of 83 bytes. in /Users/lookang/Desktop/tagui/src/ws/Base.php:249: This fatal error indicates that the script encountered an exception while trying to write data to the WebSocket connection. The error message suggests that only a partial amount of data (83 bytes) could be written to the connection.

Overall, these error messages suggest that there may be issues with the PHP script's configuration or connectivity to the WebSocket server, or that there may be compatibility issues with the version of TagUI being used. It may be necessary to troubleshoot and resolve these issues before the automation can be successfully executed.

hope it can be fixed? I not sure what is the impact of this error but the tag file still runs. Maybe it affects the "live" mode, i cannot do snap in live, not sure if they are related issues.

LIVE MODE - type done to quit snap (0,0)-(100,100) to image.png click image.png

didn't work, no file image.png and also no click

ruthtxh commented 1 year ago

Hi @lookang most likely this is because MacOS Monterey removes Python2 by default. Can you try to run the command python in the terminal and see if it shows up? Otherwise you can install from here

lookang commented 1 year ago

when i run on terminal, it appears it have python2.

Last login: Mon Mar 20 20:45:43 on console lookang@Opens-MacBook-Pro ~ % python Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 19 2020, 20:48:48) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information.

lookang commented 1 year ago

i also have python3 lookang@Opens-MacBook-Pro ~ % python3 Python 3.9.6 (v3.9.6:db3ff76da1, Jun 28 2021, 11:49:53) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information.

i actually use python3 to do some python code, not python2. I not sure if my configuration is messed up?

marcelocecin commented 1 year ago

try this https://ahmadawais.com/how-to-set-python-default-version-to-3-on-macos/

lookang commented 1 year ago

try this https://ahmadawais.com/how-to-set-python-default-version-to-3-on-macos/

ok, seems to fix something but this is what i see now

lookang@Opens-MacBook-Pro ~ % tagui

tagui v6.113: use following options and this syntax to run - ./tagui flow_filename option(s) tagui live launch TagUI live mode enabled with visual automation for interactive development tagui update download and update to latest TagUI version (please backup your version beforehand) input(s) add your own parameter(s) to be used in your automation flow as variables p1 to p8 data.csv specify a csv file to be used as the datatable for batch automation of many records -deploy -d generate .command file which can be double-clicked to run workflow with specific options -headless -h run on invisible Chrome web browser instead of visible as default (first install Chrome) -nobrowser -n run without any web browser, for example to perform automation only with visual automation -report -r track run result in tagui/src/tagui_report.csv and save html log of automation execution -turbo -t run automation at 10X the speed of normal human user (read the caveats in usage guide!) -quiet -q run without output except for explicit output (echo, show, check steps and errors etc) -edge -e run TagUI using Microsoft Edge instead of Google Chrome (can be used with -headless)

lookang@Opens-MacBook-Pro ~ % cd /Users/lookang/Desktop/tagui/flows/lookang/20210707/

lookang@Opens-MacBook-Pro 20210707 % tagui loginsls5mims.tag

PHP Deprecated: Creation of dynamic property WebSocket\Client::$options is deprecated in /Users/lookang/Desktop/tagui/src/ws/Client.php on line 25

it runs like before but with this warning of "PHP Deprecated: Creation of dynamic property WebSocket\Client::$options is deprecated in /Users/lookang/Desktop/tagui/src/ws/Client.php on line 25"

marcelocecin commented 1 year ago

what version of your PHP? maybe a solution: https://stackoverflow.com/questions/74998398/php-creation-of-dynamic-property-is-deprecated-allowdynamicproperties-not-worki

lookang commented 1 year ago

lookang@Opens-MacBook-Pro ~ % php -version PHP 8.2.1 (cli) (built: Jan 5 2023 20:07:04) (NTS) Copyright (c) The PHP Group Zend Engine v4.2.1, Copyright (c) Zend Technologies with Zend OPcache v8.2.1, Copyright (c), by Zend Technologies lookang@Opens-MacBook-Pro ~ %

do i need to upgrade php?

marcelocecin commented 1 year ago

no need to update PHP, try editing the /Users/lookang/Desktop/tagui/src/ws/Client.php file and insert in line 12: #[\Allow Dynamic Properties]

marcelocecin commented 1 year ago

or you can downgrade PHP version: https://github.com/aisingapore/TagUI/issues/1136

ohmygaugh-crypto commented 1 year ago

no need to update PHP, try editing the /Users/lookang/Desktop/tagui/src/ws/Client.php file and insert in line 12: #[\Allow Dynamic Properties]

Actually, I didn't need to do either option.

tagui works as expected for me with PHP 8.2.11 running on Apple m2 chip.

image

Removing that suggestion from line 12 actually fixed my issue.

Thank you @marcelocecin and @lookang for looking into this issue and the many others during you maintenance of TagUI. Y'all are the real hero's.