0

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:

from face_id.face_id import server, client
from multiprocessing import freeze_support
import sys

if __name__ == "__main__":
    freeze_support()

    if sys.argv[1] == '--s':
        server_start()
    elif sys.argv[1] == '--c':
        client_test()

here is the class definitions for pyro:

from __future__ import print_function
import Pyro4
import time
import sys
import cv2

sys.path.append('./')
import face_id.face as face


@Pyro4.expose
@Pyro4.behavior(instance_mode="single")
class FaceIDServer(object):
    def __init__(self):
        pass

    def test_server(self):
        return 'hello world'


class FaceIDClient:
    def __init__(self):
        sys.excepthook = Pyro4.util.excepthook
        self.server = Pyro4.Proxy("PYRONAME:face_id.server")

    def test(self):
        print(self.server.test_server())


def server_start():
    Pyro4.Daemon.serveSimple(
        {
            FaceIDServer: "face_id.server"
        },
        ns=True)


def client_test():
    client = FaceIDClient()
    client.test()

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.

4

0 回答 0