Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Raspberry pi problems #49

Closed
sirzento opened this issue Sep 1, 2022 · 12 comments
Closed

Raspberry pi problems #49

sirzento opened this issue Sep 1, 2022 · 12 comments

Comments

@sirzento
Copy link

sirzento commented Sep 1, 2022

I get this error when trying to start the script:

*          Thank you for using Capsule Farmer!          *
* Please consider supporting League of Poro on YouTube. *
*********************************************************

INFO: 2022/09/01 20:17:46 - Using configuration from: ./config.yaml
100% [......................................................] 7067070 / 7067070Traceback (most recent call last):
  File "/home/EsportsCapsuleFarmer/./main.py", line 186, in <module>
    driver = createWebdriver(browser, isHeadless and hasAutoLogin)
  File "/home/EsportsCapsuleFarmer/./main.py", line 40, in createWebdriver
    return webdriver.Chrome(service=service, options=options)
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
    self.service.start()
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 71, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/EsportsCapsuleFarmer/chromedriver'
root@raspberrypi:/home/EsportsCapsuleFarmer#

Running on Raspbian Bullseye with Python 3.10

@LeagueOfPoro
Copy link
Owner

Hi, I am not sure if the library I am using for automatic download takes ARM arch into account.
You can hardcode it though.

  1. Install the driver: sudo apt-get install chromium-chromedriver
  2. Change the driverPath to full path to the chromedriver on your system service = ChromeService('/home/something/')

It should work

@sirzento
Copy link
Author

sirzento commented Sep 1, 2022

Wow that was a fast answer.
Sadly I'm kinda a linux noob and I have no clue what I have to do on your step 2. Where is the driverPath that I need to change?
The driver is on /usr/lib/chromium-browser/chromedriver


Ok nevermind. Found the place where I need to change it in the main.py.
Problem is, that there are still error messages after starting:

*********************************************************
*          Thank you for using Capsule Farmer!          *
* Please consider supporting League of Poro on YouTube. *
*********************************************************

INFO: 2022/09/01 21:08:43 - Using configuration from: ./config.yaml
100% [..........................................................................] 7067070 / 7067070Traceback (most recent call last):
  File "/home/EsportsCapsuleFarmer/./main.py", line 186, in <module>
    driver = createWebdriver(browser, isHeadless and hasAutoLogin)
  File "/home/EsportsCapsuleFarmer/./main.py", line 40, in createWebdriver
    return webdriver.Chrome(service=service, options=options)
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in __init__
    super().__init__(
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 277, in __init__
    self.start_session(capabilities, browser_profile)
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 370, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
    self.error_handler.check_response(response)
  File "/root/.local/share/virtualenvs/EsportsCapsuleFarmer-aO-VNY7R/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x005588bdbe54 <unknown>
#1 0x00558895e9bc <unknown>
#2 0x00558897e280 <unknown>
#3 0x00558897a7e8 <unknown>
#4 0x0055889ac1f8 <unknown>
#5 0x005588983658 <unknown>
#6 0x005588c1bcdc <unknown>
#7 0x005588c1ec54 <unknown>
#8 0x005588c09bb0 <unknown>
#9 0x005588c1f540 <unknown>
#10 0x005588bfecec <unknown>
#11 0x005588c386a0 <unknown>
#12 0x005588c387ec <unknown>
#13 0x005588c50bc0 <unknown>
#14 0x007fb2961628 <unknown>
#15 0x007fb248e01c <unknown>

Installed chromium: Version 101.0.4951.57 (Official Build) Built on Debian , running on (64-bit)

@sirzento
Copy link
Author

sirzento commented Sep 2, 2022

Update: Selenium realy doesn't like to be run as root so running it with the pi user works!

There is only a slight problem left. When running it in headless mode, the login fails Automatic login failed, incorrect credentials?. There isn't even a log message that says that the credentials are submitted so it fails before that somehow. The error message appears exactly after 20s so I guess the WebDriverWait().until is running in a timeout. Setting it to 50s will throw the error after 50s.

Running it with the browser visible does work.

@LeagueOfPoro
Copy link
Owner

LeagueOfPoro commented Sep 2, 2022

I'm glad you got it working. Just a note, the bot is completely untested on raspi/ARM and you are probably the first one to try.
I would test it, but all my Pis are running non-standard OS.
Could you add driver.save_screenshot('screenshot.png') before or after the wait just so we can see what's happening?

EDIT: If you save two screenshots they need to have different names

@sirzento
Copy link
Author

sirzento commented Sep 2, 2022

Here is the screenshot.
before_login

Since it is in german the translation is:

A problem has occurred with the OAuth2 protocol. Please try again later.

We are sorry, the login servers are temporarily unavailable. Please try again later. Under Service Status you can find more information

@kacperkr90
Copy link

Running farmer inside Raspberry Pi gave my quite a headache. I settled to running it in docker-composed config, where browser and farmer run in separate containers. Check my fork if you are interesed.

@sirzento
Copy link
Author

sirzento commented Sep 7, 2022

Running farmer inside Raspberry Pi gave my quite a headache. I settled to running it in docker-composed config, where browser and farmer run in separate containers. Check my fork if you are interesed.

Thanks, I will try that. I see that you added the 'remote' option as browser. Should I use this? And I guess you did test it with firefox right?
Edit: I can't even install docker right on my system... Can it work without it?

@kacperkr90
Copy link

Running farmer inside Raspberry Pi gave my quite a headache. I settled to running it in docker-composed config, where browser and farmer run in separate containers. Check my fork if you are interesed.

Thanks, I will try that. I see that you added the 'remote' option as browser. Should I use this? And I guess you did test it with firefox right? Edit: I can't even install docker right on my system... Can it work without it?

Unfortunately not :( By the way if you manage to install docker on your device I extended README.md with detailed instructions.

@LeagueOfPoro
Copy link
Owner

Running farmer inside Raspberry Pi gave my quite a headache. I settled to running it in docker-composed config, where browser and farmer run in separate containers. Check my fork if you are interesed.

Added link to your repo to Readme. Thanks for solving that!

@kacperkr90
Copy link

Running farmer inside Raspberry Pi gave my quite a headache. I settled to running it in docker-composed config, where browser and farmer run in separate containers. Check my fork if you are interesed.

Added link to your repo to Readme. Thanks for solving that!

No problem :) Glad I could help. Thank you for creating farmer for us, lazy people :)

@sirzento
Copy link
Author

sirzento commented Sep 7, 2022

@kacperkr90 I can't open an issue on your fork so I will ask you here. I forgot to add the last two key in the api.env and now it is throwing errors that it can't find those keys. What must I do to refresh the keys after I added those to the api.env file? It wasn't restarting the docker container

Never mind, got it. But I have another error. This is my log: https://i.imgur.com/gsodtHC.png

strange thing is, that everything after the "INFO next check" was posted at 18:13. But the next check should have been on 18:06.

Any Ideas to that error?

EDIT: Could be because my RAM and SWP was full.

EDIT2: I still have some errors. I got it to work for a few hours and now it started to throw errors. Here is my log: https://pastebin.com/raw/snyRAJqp

@kacperkr90
Copy link

kacperkr90 commented Sep 8, 2022

Hey, I enabled issues on my fork, so if you have any other problems you can create discussion there :)

Anyway, I see that you are using the old version of the code. Yesterday I reverted changes related to switching to Twitch provider (Now I see that OVERRIDES are easier and simpler solution).

To update composed config do the following:

  1. git pull && git reset --hard origin/master - to pull new changes and clean repo (I made changes to commits author, so it needs to be cleaned with reset)
  2. docker-compose down - it will delete old containers and network
  3. docker-compose build - it will rebuild image for EsportCapsuleFarmer
  4. docker-compose up -d - start the config5.

EDIT: I'll remove printing password in log, it was done for debugging purposes.

@kacperkr90 I can't open an issue on your fork so I will ask you here. I forgot to add the last two key in the api.env and now it is throwing errors that it can't find those keys. What must I do to refresh the keys after I added those to the api.env file? It wasn't restarting the docker container

Never mind, got it. But I have another error. This is my log: https://i.imgur.com/gsodtHC.png

strange thing is, that everything after the "INFO next check" was posted at 18:13. But the next check should have been on 18:06.

Any Ideas to that error?

EDIT: Could be because my RAM and SWP was full.

EDIT2: I still have some errors. I got it to work for a few hours and now it started to throw errors. Here is my log: https://pastebin.com/raw/snyRAJqp

@LeagueOfPoro LeagueOfPoro pinned this issue Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants