如何创建可由工作进程修改的类的 python 共享对象。我使用 multiprocessing.Process 模块创建了工作进程。我对 multiprocessing.Manager 模块有一些了解。任何人都可以通过示例解释如何将我的类注册到管理器中,启动管理器并创建我的类的共享对象。
目前我正在使用Swift语言为我的应用程序编写FinderSync扩展.我的扩展需要对端口号为40322的本地主机上运行的服务器进行REST调用.根据响应,我将创建上下文菜单项.出于同样的原因,我在"FinderSync.swift" 文件中编写了以下代码
let config = URLSessionConfiguration.default
// Session Configuration
let session = URLSession(configuration: config)
// Load configuration into Session
let request_url = URL(string: "http://127.0.0.1:40322/api/get_rclick_settings_and_check_target")!
let task = session.dataTask(with: request_url, completionHandler: {
(data, response, error) in
if error != nil {
print("TAKS ERROR: \(error!.localizedDescription)")
}
else {
do {
if let json = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? [String: Any]
{
NSLog("TASK RESPONSE: \(json)")
}
} catch {
NSLog("error in JSONSerialization")
}
}
})
task.resume()
Run Code Online (Sandbox Code Playgroud)
但是错误为 "nw_socket_connect connectx失败:[1]操作不允许"的代码
但是在导入 …