rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.19k stars 347 forks source link

Windows 11 Docker Error #29

Closed ahmetozmtn closed 1 year ago

ahmetozmtn commented 1 year ago

Hello good day When I build and run the code on docker in windows 11, it gives the following error, how can I fix this error?

image

docker run twitchbot:experimental Error: python: can't open file 'run.py': [Errno 2] No such file or directory

The steps I followed

rdavydov commented 1 year ago

Hello,

You didn't create a run.py file. See https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2#how-to-use

MyNameJeff12123 commented 1 year ago

Rebuild it and rename example.pu to run.pySent from my iPhone 13 Pro MaxOn 2 Nov 2022, at 10:36, Ahmet Özmetin @.***> wrote: Hello good day When I build and run the code on docker in windows 11, it gives the following error, how can I fix this error?

docker run twitchbot:experimental Error: python: can't open file 'run.py': [Errno 2] No such file or directory The steps I followed

Download the repo from Github and edit it according to myself (password etc.) docker build -t twitchbot:experimental . build using this code run container with code docker run twitchbot:experimental

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

rdavydov commented 1 year ago

Rebuild it and rename example.pu to run.py

Don't just rename it, you need to edit it. See my answer above.

ahmetozmtn commented 1 year ago

I already created that file, still giving error

rdavydov commented 1 year ago

Show the output of ls

rdavydov commented 1 year ago

Oh, it's Windows, then dir, not ls

ahmetozmtn commented 1 year ago

image

rdavydov commented 1 year ago

still giving error

What error? I guess it should be different one now.

rdavydov commented 1 year ago

If it's the same error, maybe it is related to this remark by @Tkd-Alex from README:

$(pwd) Could not work on Windows (cmd), please use the absolute path instead

I don't really know why it is happening and why it doesn't see the run.py file, since I don't use Docker.

Could someone else please assist with this issue?

rdavydov commented 1 year ago

@ahmetozmtn It would be nice of you to leave a comment before closing the issue, so it will help other people with the same problem. Did you manage to solve this issue? What was the cause?

ahmetozmtn commented 1 year ago

Thanks for the help, but I couldn't solve the problem

rdavydov commented 1 year ago

Let's keep this open, maybe someone else will help.

rdavydov commented 1 year ago

@ahmetozmtn Try to replace Dockerfile with https://gist.github.com/rdavydov/5c4c53ca1bd237d6c800f63856a499b1

rdavydov commented 1 year ago

Docker container is only useful when you already have a cookie file. Docker can only run CLI programs, so it will not start Google Chrome in the non-headless mode.

However, there are workarounds. I think I should experiment with a VNC server in a container, this may be a good cross-plaform approach. More info: https://www.howtogeek.com/devops/how-to-run-gui-applications-in-a-docker-container/

rdavydov commented 1 year ago

Nevertheless, adding COPY ./run.py ./ to the Dockerfile should solve @ahmetozmtn 's problem.

Rakambda commented 1 year ago

Not sure why I got pinged here but

Docker container is only useful when you already have a cookie file. Docker can only run CLI programs, so it will not start Google Chrome in the non-headless mode. However, there are workarounds. I think I should experiment with a VNC server in a container, this may be a good cross-plaform approach. More info: https://www.howtogeek.com/devops/how-to-run-gui-applications-in-a-docker-container/

Selenium has docker images that you can add to a docker-compose/swarm/kubernetes... stack. It also has vnc integrated to it so that you can interact with the browser. From a code point of view it changes nothing, just that instead of creating a ChromeDriver, you create a RemoteDriver.

In the case of my project everything is in docker (just I didn't manage to login as my chrome gets detected for some reason), but the integrity token is queried every so often by connecting to a dockerized chrome instance.

rdavydov commented 1 year ago

@ahmetozmtn Abort my previous suggestion. The correct solution for Windows lies in the correct command line: docker run --name user2 -v C:\Absolute\Path\To\Twitch-Channel-Points-Miner-v2\run.py:/usr/src/app/run.py:ro -p 5002:5000 rdavidoff/twitch-channel-points-miner-v2

run.py MUST be mounted as a volume (-v).

Everything else is described in https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2#docker