-1

I'm trying to write a spambot for my google form mutiple choice questions so I can get random answers for a homework assignment. I tried writing it fully by myself but I couldn't. So i found a pre-written code: (https://github.com/endeneer1/google-form-autofilling-spam-bot-using-Python-multiple-choice-questions/blob/master/google-form-spambot.py) and after 4 hours of installing selenium i got a most of it working except the links for the assets i need to use. It keeps on saying

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

no matter what i do,I looked on similar cases but I can't find the answer. Please help I have been doing this for 9 hours. By the way I code on Pycharm.

import time
import random
from selenium import webdriver

chromedriver = "C:\Users\LORD\Desktop\max spam junk\chromedriver")
driver = webdriver.chrome(chromedriver)

Normally it should open a google page and put in the link of the google form, and then fill it in with random answers but it won't work because of unicode stuff. Here is the error C:\python\python.exe "C:/mblock python junk/gg.py" File "C:/mblock python junk/gg.py", line 5 chromedriver.encode("C:\Users\LORD\Desktop\max spam junk\chromedriver") ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

Process finished with exit code

And as I said the full code is at the link here(https://github.com/endeneer1/google-form-autofilling-spam-bot-using-Python-multiple-choice-questions/blob/master/google-form-spambot.py)

  • 2
    You need to show us the code and the data that is giving you the error. You are asking us to imagine your code and then suggest what is wrong with it. Include the full traceback (that is the part that begins `Traceback (most recent call last):`) and enough of the code surrounding the error so that we can see what is going on. Please put this information in your question (use the `edit` link), not in a comment. – BoarGules Apr 28 '19 at 11:06

1 Answers1

-1

The first backslash in your string is being interpreted as a special character. To fix this you need to escape the backslashes in the chromedriver path string.

Try this:

import time
import random
from selenium import webdriver

chromedriver = "C:\\Users\\LORD\\Desktop\\max spam shit\\chromedriver")
driver = webdriver.Chrome(chromedriver)

S Ahmed
  • 1,454
  • 1
  • 8
  • 14
  • I got this:C:\python\python.exe "C:/mblock python shit/gg.py" Traceback (most recent call last): File "C:/mblock python shit/gg.py", line 6, in driver = webdriver.chrome(chromedriver) TypeError: 'module' object is not callable Process finished with exit code 1 and i also tried without the parenthese at the end and i got:C:\python\python.exe "C:/mblock python shit/gg.py" Traceback (most recent call last): File "C:/mblock python shit/gg.py", line 6, in driver = webdriver.chrome(chromedriver) TypeError: 'module' object is not callable – gorfgorf23 Apr 28 '19 at 11:54
  • @gorfgorf23 There was a typo in the code. Try it now. – S Ahmed Apr 28 '19 at 20:14