Error due to browser

hello, when I run this code on a virtual machine I get this error: raise Error(“could not locate runnable browser”)
webbrowser.Error: could not locate runnable browser

from twitchAPI.helper import first
from twitchAPI.twitch import Twitch
from twitchAPI.oauth import UserAuthenticationStorageHelper
from twitchAPI.object.eventsub import ChannelFollowEvent
from twitchAPI.eventsub.websocket import EventSubWebsocket
from twitchAPI.type import AuthScope
import asyncio

br_id = "#"

mod_id = "#"

APP_ID = '#'
APP_SECRET = '#'
TARGET_SCOPES = [AuthScope.MODERATOR_READ_FOLLOWERS, AuthScope.USER_BOT, AuthScope.CHANNEL_BOT, AuthScope.USER_WRITE_CHAT]
twitch = Twitch(APP_ID, APP_SECRET)

async def on_follow(data: ChannelFollowEvent):
    print(f'{data.event.user_name} now follows {data.event.broadcaster_user_name}!')
    await twitch.send_chat_message(br_id, mod_id, f'{data.event.user_name} только что фоловнулся!')


async def run():

    helper = UserAuthenticationStorageHelper(twitch, TARGET_SCOPES)
    await helper.bind()

    user = await first(twitch.get_users())

    eventsub = EventSubWebsocket(twitch)
    eventsub.start()

    await eventsub.listen_channel_follow_v2(br_id, mod_id, on_follow)

    try:
        input('press Enter to shut down...')
    except KeyboardInterrupt:
        pass
    finally:
        await eventsub.stop()
        await twitch.close()


asyncio.run(run())

What should I use to make this code work on the token?

Gonna guess this is the python twitchio library

you might be able to get focussed help with the library on the libraries discord which you can find here - > Twitch API

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.