我想在路径中添加一些python脚本.
我可以将bash脚本添加到路径中的文件夹中,然后从任何地方执行它们.当我使用python脚本时,我只能在同一目录中执行它们.
例如,如果我将test和test2.py放在我路径中的同一文件夹中.
这项工作:
Run Code Online (Sandbox Code Playgroud)sh test success hello world
这不是:
Run Code Online (Sandbox Code Playgroud)python test.2.py python: can't open file 'test2.py': [Errno 2] No such file or directory [Errno 2] No such file or directory
我正在尝试在新线程上安排一个可观察对象,并将结果返回到当前线程上。
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Log("init");
Observable.Return(0)
.ObserveOn(NewThreadScheduler.Default)
.Do(_ => Log("Do1 method"))
.ObserveOn(CurrentThreadScheduler.Instance)
.Do(_ => Log("Do2 method"))
.Subscribe(_ => Log("subscribe method"));
Console.ReadKey();
}
static void Log(string label)
{
Console.WriteLine("{0} on {1}", label, Thread.CurrentThread.ManagedThreadId);
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的结果:
init on 9
Do1 method on 10
Do2 method on 10
subscribe method on 10
Run Code Online (Sandbox Code Playgroud)
为什么 Do2 方法和 subscribe 方法在线程 #10 上而不是在线程 #9 上?我期待这个结果:
init on 9
Do1 method on 10
Do2 method on 9
subscribe …Run Code Online (Sandbox Code Playgroud)