问题标签 [pyro4]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
185 浏览

windows - Pyro4 configuration doesn't change

I put the Pyro4 configuration as this in the starting part of my code: Pyro4.config.THREADPOOL_SIZE = 1 Pyro4.config.THREADPOOL_SIZE_MIN = 1

I check if I tried to run two client code at the same time, it will say ' rejected: no free workers, increase server threadpool size'. It looks like the setting is working, but when I open the console to check the pyro configuration using "python -m Pyro4.configuration", it returns: THREADPOOL_SIZE = 40 THREADPOOL_SIZE_MIN = 4

Does someone know why?

0 投票
1 回答
347 浏览

python-3.x - 多线程 Python Pyro4 daemon.requestLoop()

我一直在使用 Pyro4 构建一个私人聊天应用程序。下面是我声明 Pyro4 守护进程的代码。

我的代码无法通过 daemon.requestLoop() 。它卡在那里。由于某些原因,我希望之后的代码被执行,所以我决定对它进行多线程处理,但我的代码不起作用。请告诉我该怎么做。

0 投票
0 回答
151 浏览

python - 在 Pyro4 中为特定类创建一个新的 URI

我一直在构建一个聊天应用程序,其中连接到服务器的客户端可以使用 Pyro4 进行私人聊天。客户端注册到服务器以向所有人表明他们可以进行私人聊天。客户端现在可以邀请其他客户端使用 RMI 直接交换消息进行私人聊天会话。下面是我的课程代码。

每当一位客户邀请一位客户进行私人聊天时,我的代码都会在下面重新运行以创建一个 uri 。

它运行良好,第一次运行。但是对于第二次私聊请求,却报错:

我该如何解决?我想为建立私有连接的不同客户端创建不同的 URI?

0 投票
1 回答
144 浏览

python - 在不同机器上使用 Pyro4 时出现错误 99

我使用的部分代码基于https://github.com/irmen/Pyro4/tree/master/examples/messagebus上的 messagebus 示例。我在一台机器上设置了 Pyro4 名称服务器。服务器和发布者也在这台机器上运行。

如果我在这台机器上运行它,订阅者可以工作,但如果我尝试在另一台机器上运行它,我会收到错误消息。我需要这个在几台不同的机器上工作。

我得到的错误是:“错误:[Errno 99] 无法分配请求的地址”

我的代码失败的行是:

其中 NS_HOST 是运行名称服务器等的主机的名称,6193 是 ns 使用的端口。出于某种原因,除了本地主机之外,它似乎在任何地方都不起作用。我需要做一些不同的事情吗?我知道我可以连接到该主机的 ns,因为我没有收到以下错误:

上面的行目前不在我的代码中(我只是用它来检查我没有遇到错误的主机名、防火墙等问题)但我想知道是否有一种方法可以将它与 Pyro4.Daemon 结合起来( ) 让代码工作 - 有什么想法吗?

我正在使用python 2.7。

谢谢你的帮助!

0 投票
1 回答
173 浏览

python - Pyro4 杀死空的名称服务器

我在分布式系统中使用 Pyro4。我的问题是两个网络连接后可能会有很多名称服务器。对我来说没问题,但如果其中任何一个是空的(没有注册对象),我的网络可能会失败。这是因为我正在实现和弦,我需要知道是否已经有任何和弦节点在运行(如果空的名称服务器响应,则将创建两个和弦环。如果名称服务器为空,有什么方法可以杀死它?
我的代码是在 python3 中。谢谢

0 投票
0 回答
68 浏览

python - Pyinstaller and Pyro4

I created a simple pyro server and tried packaging it with pyinstaller but whenever I try to run the executable by calling './main --s' and then in another terminal tab './main --c' the code gives me the correct output but when I look at activity monitor there are new instances of my executable being created constantly. User interrupting the shell instances does not have any affect and these processes keep getting spawned until I completely restart my system.

here is my main script that I compile as an executable:

here is the class definitions for pyro:

Also these processes that are started use up far more cpu percentage than than the script does when running through python. If I watch activity monitor or 'top -u' I can see a new process is spawned every couple seconds. This issues become way worse when I am using my full application code instead of this simple example.

Also, yes I am using the newest pyinstaller, I have tried freezing multiprocessing, the name-server is behaving correctly, but no matter what I do this issue persists.

0 投票
2 回答
144 浏览

python - Pyro4:反序列化 protobuf 类

我对 Pyro4 完全陌生。我希望提供一个包含属性的 python 类,该属性是编译为 python 类的 protobuf 对象的实例。

设置服务器运行后,我创建服务对象的代理,并查询 MyProtobuf 属性:

我得到的是一个序列化的对象:

我从文档(https://pythonhosted.org/Pyro4/clientcode.html#sharing-the-way-your-custom-classes-are-de-serialized)中了解到“默认情况下,自定义类被序列化为一个字典. 它们不会反序列化回您的自定义类的实例。”

我正在寻找说明,或者描述如何将这个序列化字典转回我的类的示例,包括该类包含的 protobuf 消息实例。

看起来这一定是一个常见的、微不足道的操作,但我找不到一个很好的例子来展示给我看,并且文档没有提供我可以看到的明确帮助。

谢谢!

0 投票
2 回答
187 浏览

python - Pyro4:在远程子对象上调用方法而不尝试返回子对象

假设我有一个对象是另一个对象的属性。

在本地机器上,我运行这个

当我尝试调用 abfoo 时,它试图序列化 ab 并在本地调用 foo,但我想在远程 ClassA 实例上已经存在的 ClassB 实例上调用 foo。

当然,我可以向 ClassA 添加一个委托给 b.foo() 的方法,例如

但我宁愿不那样做。

0 投票
1 回答
283 浏览

python - 如何使用 Pyro4 处理自定义异常?

我正在尝试使用 Pyro4 公开我的课程。问题是我的班级有一个 Pyro4 无法处理的自定义异常。

我尝试过使用序列化,但似乎没有任何效果。

我所拥有的是:

Pyro4 无法引发 TestException。它给了我一个错误:{SerializedError}不支持的序列化类:TestException

有谁知道如何解决这个问题?

谢谢。

0 投票
0 回答
76 浏览

python - 接收数据上的 Pyro4 随机 TimeoutError

我已经使用 Pyro4 在两台 PC 之间建立了连接设置,大多数情况下一切都在无缝运行,但有时我会得到这样的随机 TimeoutError:

起初我认为这可能是一些与网络相关的问题,但是我在后台检查了 ping 进程,PC 之间的连接永远不会丢失。我在 Pyro 文档中找不到任何关于它的内容。