Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokio error 'there is no reactor running, must be called from the context of a Tokio 1.x runtime' #13

Open
EntityinArray opened this issue Jun 23, 2023 · 0 comments

Comments

@EntityinArray
Copy link

EntityinArray commented Jun 23, 2023

Goody day! Thank you for working on this amazing crate.

I wrote a simple program that should connect to OpenRGB server. Everything compiles well, but upon running it panics with this error:

thread 'main' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime',
/home/entityinarray/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/net/tcp/stream.rs:160:18

main.rs

use openrgb::OpenRGB;
use std::error::Error;
use futures::executor;

async fn connect() -> Result<(), Box<dyn Error>> {

    // connect to default server at localhost
    let client = OpenRGB::connect().await?;

    Ok(())
}

fn main() {

    println!("Connecting to OpenRGB server at 127.0.0.1:6742");
    let con_result = executor::block_on(connect());
    
    println!("We got here!");
}

Output:

Connecting to OpenRGB server at 127.0.0.1:6742
thread 'main' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime', /home/entityinarray/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/net/tcp/stream.rs:160:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Cargo.toml

[package]
name = "openrgb-fft"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures = { version = "0.3.28", features = ["io-compat", "futures-executor", "compat"] }
openrgb = "0.1.2"
tokio = { version = "1.28.2", features = ["tokio-macros", "full"] }

I will greatly appreciate any help in what i'm doing wrong. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant