zvovov / whatsapp-web

WhatsApp chat from [command line, terminal, console, cli] :no_mobile_phones:
MIT License
313 stars 74 forks source link

invalid syntax on line 249 of chat.py #26

Closed anabis closed 3 years ago

anabis commented 5 years ago

It works after commenting the lines 249 & 250. I know nothing about python but I couldn't see the syntax error. hugo@brun:~/sources$ python whatsapp-web/chat.py File "whatsapp-web/chat.py", line 249 sys.exit(print(e, decorateMsg("\n\tChromedriver Error. Read the above error (if any), then\n\tCheck ``if installed chromedriver version is compatible with installed Chrome version.", bcolors.WARNING)))

Neto223317 commented 5 years ago

run: python3 whatsapp-web/chat.py name

luigisalas commented 5 years ago

Remember install selenium for python3

pip3 install selenium

robinsonmas commented 5 years ago

hi , i have this error .

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" C:\chat>chat.py robinsonmas Traceback (most recent call last): File "C:\chat\chat.py", line 243, in main() File "C:\chat\chat.py", line 54, in main chrome_data_dir_directory = "{0}/.chrome/data_dir/whatsapp_web_cli".format(os.environ['HOME']) File "C:\Users\robinsonmas.DC\AppData\Local\Programs\Python\Python37-32\lib\os.py", line 678, in getitem raise KeyError(key) from None KeyError: 'HOME'

""""""""""""""""""""""""""""""""""""""""""""

any posible solution , ?>

Thanks for your help .

zvovov commented 3 years ago

The HOME environment variable is not available on Windows.

As a workaround, you can either comment out these 3 lines from chat.py

chrome_data_dir_directory = "{0}/.chrome/data_dir/whatsapp_web_cli".format(os.environ['HOME'])
if not os.path.exists(chrome_data_dir_directory):
    os.makedirs(chrome_data_dir_directory)

This would remove the functionality of auto sign-in and you would have to scan the QR code everytime you run the script.

Alternatively, you can look at this solution to figure out how to access the USERPROFILE variable as described here

I don't have access to a Windows machine at the moment. Let me know how it goes