t.me/xtekky commited on
Commit
a2ed9c6
1 Parent(s): 746dd87

fix for account creation

Browse files
Files changed (1) hide show
  1. quora/__init__.py +8 -4
quora/__init__.py CHANGED
@@ -390,7 +390,7 @@ class Poe:
390
  self.client = PoeClient(self.cookie)
391
 
392
  def __load_cookie(self) -> str:
393
- if (cookie_file := Path("cookie.json")).exists():
394
  with cookie_file.open() as fp:
395
  cookie = json.load(fp)
396
  if datetime.fromtimestamp(cookie["expiry"]) < datetime.now():
@@ -410,8 +410,12 @@ class Poe:
410
  print(mail_address)
411
  options = webdriver.FirefoxOptions()
412
  # options.add_argument("-headless")
413
- driver = webdriver.Firefox(options=options)
414
-
 
 
 
 
415
  driver.get("https://www.poe.com")
416
 
417
  # clicking use email button
@@ -441,7 +445,7 @@ class Poe:
441
 
442
  cookie = driver.get_cookie("p-b")
443
 
444
- with open("cookie.json", "w") as fw:
445
  json.dump(cookie, fw)
446
 
447
  driver.close()
 
390
  self.client = PoeClient(self.cookie)
391
 
392
  def __load_cookie(self) -> str:
393
+ if (cookie_file := Path("./quora/cookie.json")).exists():
394
  with cookie_file.open() as fp:
395
  cookie = json.load(fp)
396
  if datetime.fromtimestamp(cookie["expiry"]) < datetime.now():
 
410
  print(mail_address)
411
  options = webdriver.FirefoxOptions()
412
  # options.add_argument("-headless")
413
+ try:
414
+ driver = webdriver.Firefox(options=options)
415
+
416
+ except Exception:
417
+ raise Exception(b'The error message you are receiving is due to the `geckodriver` executable not being found in your system\'s PATH. To resolve this issue, you need to download the geckodriver and add its location to your system\'s PATH.\n\nHere are the steps to resolve the issue:\n\n1. Download the geckodriver for your platform (Windows, macOS, or Linux) from the following link: https://github.com/mozilla/geckodriver/releases\n\n2. Extract the downloaded archive and locate the geckodriver executable.\n\n3. Add the geckodriver executable to your system\'s PATH.\n\nFor macOS and Linux:\n\n- Open a terminal window.\n- Move the geckodriver executable to a directory that is already in your PATH, or create a new directory and add it to your PATH:\n\n```bash\n# Example: Move geckodriver to /usr/local/bin\nmv /path/to/your/geckodriver /usr/local/bin\n```\n\n- If you created a new directory, add it to your PATH:\n\n```bash\n# Example: Add a new directory to PATH\nexport PATH=$PATH:/path/to/your/directory\n```\n\nFor Windows:\n\n- Right-click on "My Computer" or "This PC" and select "Properties".\n- Click on "Advanced system settings".\n- Click on the "Environment Variables" button.\n- In the "System variables" section, find the "Path" variable, select it, and click "Edit".\n- Click "New" and add the path to the directory containing the geckodriver executable.\n\nAfter adding the geckodriver to your PATH, restart your terminal or command prompt and try running your script again. The error should be resolved.')
418
+
419
  driver.get("https://www.poe.com")
420
 
421
  # clicking use email button
 
445
 
446
  cookie = driver.get_cookie("p-b")
447
 
448
+ with open("./quora/cookie.json", "w") as fw:
449
  json.dump(cookie, fw)
450
 
451
  driver.close()