inmcm / micropyGPS

A Full Featured GPS NMEA-0183 sentence parser for use with Micropython and the PyBoard embedded platform
MIT License
340 stars 117 forks source link

Lypo import issues #2

Closed nikolaymomchev closed 7 years ago

nikolaymomchev commented 7 years ago

Whenever I try to import micropyGPS no further part of the main.py code executes. Prints put inside micropyGPS don't execute either. This fork of Mycropython doesn't have pyb. Can that be a problem?

inmcm commented 7 years ago

Please post the problem code as a gist. I'm not familiar with the Lypo platform; do you mean LoPy? micropyGPS doesn't depend on the pyb interface of the standard micropython, I just use it in the the examples. You're have to adapt those example to the serial interface of your platform. If you're using LoPy, or any pycom product, maybe start by looking here: https://docs.pycom.io/pycom_esp32/library/machine.UART.html

Ralphpy commented 7 years ago

Hi, I had the same problem on LoPy with Pytrack. After removing the the part starting with if name == "main": micropyGPS imports just fine.

I'm quite new to this myself, so not exactly sure why, but learning every day ;-)

inmcm commented 7 years ago

It sounds like the what you're trying to do is

if __name__ == '__main__':

which has namespace significance in Python

https://stackoverflow.com/questions/419163/what-does-if-name-main-do