简体   繁体   中英

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:


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:
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
Eu já tentei rodar esse código no python 3.4 e tive a mesma mensagem.

Somebody know what's the solution for this? Or know some better python compatible framework to make this function?
Alguém sabe a solução para isso? 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. 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.

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). 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. So this call fails, with the Windows error code 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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