简体   繁体   English

Python 3.7 & 3.4 GPS3 模块上的 WinError10057

[英]WinError10057 on Python 3.7 & 3.4 GPS3 Module

I'm studying the GPS3 Python 3.7 library, running this basic code: Estou estudando a biblioteca GPS3 do python 3.7, rodando esse código simples:我正在研究 GPS3 Python 3.7 库,运行以下基本代码:Estou estudando a biblioteca GPS3 do python 3.7,rodando esse código simples:


skt, dts = gps3.GPSDSocket(), gps3.DataStream()

skt.connect()
skt.watch()
for dt in skt:
    if dt:
        dts.unpack(dt)
        print(skt.TPV['alt'],skt.TPV['lat'])

I got the following output:我得到了以下 output:
Eu tive a seguinte saída: Eu tive a seguinte saída:

GPS3 gpsd connection at '192.168.0.13' on port '2947' failed

GPS3 send command fail with [WinError 10057] Uma solicitação de envio ou recebimento de dados não foi permitida porque o soquete não está conectado e (durante o envio em um soquete de datagrama usando-se uma chamada sendto) não foi fornecido um endereço

I already tried to run this code on python 3.4 and i got exactly the same output我已经尝试在 python 3.4 上运行此代码,并且得到完全相同的 output
Eu já tentei rodar esse código no python 3.4 e tive a mesma mensagem. Eu já tentei rodar esse código no python 3.4 e tive mesma mensagem。

Somebody know what's the solution for this?有人知道这有什么解决方案吗? Or know some better python compatible framework to make this function?或者知道一些更好的 python 兼容框架来制作这个 function?
Alguém sabe a solução para isso? Alguém sabe a solução para isso? Ou conhece algum framework melhor para essa função que seja compatível com python? Ou conhece algum framework melhor para essa função que seja compatível com python?

The line "skt.connect()" attempts to connect to GPSd, but judging by the diagnostic "GPS3 gpsd connection at '192.168.0.13' on port '2947' failed" which you received, that attempt failed. “skt.connect()”行尝试连接到 GPSd,但根据您收到的诊断“在端口 '2947' 上的 '192.168.0.13' 处的 GPS3 gpsd 连接失败”判断,该尝试失败。 This could be because the GPSd server is not listening at that IP address and port, or that there is a firewall in the way, or for a number of other reasons.这可能是因为 GPSd 服务器未在该 IP 地址和端口上进行侦听,或者存在防火墙,或其他一些原因。

For some reason, failure to connect to GPSd does not raise an exception, even though I think it should (so this is arguably a bug in the Python GPS library).出于某种原因,无法连接到 GPSd 不会引发异常,即使我认为它应该(所以这可以说是 Python GPS 库中的一个错误)。 So your code continues to run.所以你的代码继续运行。

The line "skt.watch()" attempts to wait for new data to arrive on the socket to GPSd, but due to the preceding error, that socket was never opened, so can't be waited on. "skt.watch()" 行尝试等待新数据到达 GPSd 的套接字,但由于前面的错误,该套接字从未打开,因此无法等待。 So this call fails, with the Windows error code 10057.因此此调用失败,Windows 错误代码为 10057。

In summary, the solution is to ensure that the GPSd server is reachable by your code, and ensure that the Python GPS library and your code both contain adequate error detection and throw exceptions in fatal error conditions.总之,解决方案是确保您的代码可以访问 GPSd 服务器,并确保 Python GPS 库和您的代码都包含足够的错误检测并在致命错误条件下抛出异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM