NEO6 GPS with Py PICO with micropython

2022-11-29 Thread KK CHN
List ,
I am following this tutorial to  get latitude and longitude data  using
NEO6 GPS module and Py PICO  to read the GPS data from the device.

I followed the code specified in this tutorial.
https://microcontrollerslab.com/neo-6m-gps-module-raspberry-pi-pico-micropython/

I have installed thony IDE in my Desktop(windows PC) and  run the code
after the devices all connected and using USB cable connected to my PC.

When I ran the program I am able to see the output of  latitude and
longitude in the console of thony IDE.  But  between certain intervals of a
few seconds  I am getting the latitude and longitude data ( its printing
GPS data not found ?? ) in the python console.

The satellite count from the $GGPA output showing 03 ..
and the GPS data not found repeating randomly for intervals of seconds.
Any hints why it is missing the GPS data (randomly) ??

PS:-  The GPS device I placed outside  my window and connected to the PC
with a USB cable from the PICO  module. GPS device NEO6 light (Red LED
) blinking even though the "  GPS data not found" messages in th python
console.

Any hints ?? most welcome

Yours,
Krishane
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python script not letting go of files

2022-11-29 Thread Weatherby,Gerard
Does the script exit when complete?

If you’re running on a Linux based system and have root access you can use lsof 
to see what processes have with files open. (Or use the psutil Python package).

From: Python-list  on 
behalf of Mike Dewhirst 
Date: Tuesday, November 29, 2022 at 2:20 AM
To: python-list@python.org 
Subject: Python script not letting go of files
I have a script which fetches a production site directly from a
Subversion repo using svn export

It runs a bunch of commands by calling this little method ...

def trycmd(cmd, log):
 retcode = -1
 ret = f"Trying {cmd}"
 try:
 retcode = os.system(cmd)
 ret = f"\n{cmd} -ok-> {retcode}"
 except Exception as err:
 ret = f"\n{cmd} -fail-> {err}"
 log.write(remove_password(ret))
 return retcode

This is the fetching script (omitting variables at the top) which
appears to be keeping a finger on files which Apache wants.

with open(fetchlog, 'a') as log:
 ret = f"\n\nFetching {tag}"
 log.write(ret)
 cmd = f"sudo rm -Rf {site_root}"
 if trycmd(cmd, log) == 0:
 cmd = f"sudo svn export --force --username {usr} --password
{pw} {svn_repo} {site_root}"
 if trycmd(cmd, log) == 0:
 # get any new dependencies
 cmd = f"sudo -H pip install -r {reqfile}"
 if trycmd(cmd, log) == 0:
 # run any migrations shipped from the repo
 cmd = f"sudo python3 {site_root}/manage.py migrate
--noinput --settings={settings}"
 if trycmd(cmd, log) == 0:
 # shouldn't find anything
 cmd = f"sudo python3 {site_root}/manage.py
makemigrations --noinput --settings={settings}"
 if trycmd(cmd, log) == 0:
 # should have been done already
 cmd = f"sudo python3 {site_root}/manage.py
migrate --noinput --settings={settings}"
 if trycmd(cmd, log) == 0:
 # remove all static files from their Apache dir
 cmd = f"sudo rm -Rf {static_root}/*"
 if trycmd(cmd, log) == 0:
 # copy all static files to the Apache
location
 cmd = f"sudo python3
{site_root}/manage.py collectstatic --noinput --settings={settings}"
 if trycmd(cmd, log) == 0:
 # set all permissions
 cmd = f"sudo {scripts}/perms_{host}.sh"
 if trycmd(cmd, log) == 0:
 cmd = "sudo service apache2
restart"
 if trycmd(cmd, log) == 0:
 ret = f"\nFinish {tag}\n\n"
 log.write(ret)
 else:
 print("Apache didn't restart")
 else:
 print("Didn't set permissions")
 else:
 print("Didn't collectstaic")
 else:
 print("Didn't delete static files")
 else:
 print("Didn't migrate 2")
 else:
 print("Didn't makemigration")
 else:
 print("Didn't migrate 1")
 else:
 print("Didn't install requirements")
 else:
 print("Didn't get source")
 else:
 print("Didn't remove site")
exit()

The problem I'm trying to fix is that after an Apache reload Apache
seems hellbent on filling up its scoreboard and running out of
resources. The kind folk on the Apache mailing list say something is
hogging the workers.

You can see the last operation above is an Apache restart. It should be
an Apache reload. Reload however lets Apache run out of resources.

Do any of you Python folks see any blunders in the above code along the
lines of not letting go of py files or static assets?

mod_wsgi is configured with 100% defaults.
mod_mpm_event conf per advice from the Apache mailing list is ...


 ServerLimit 32
 StartServers16
 MinSpareThreads 400
 MaxSpareThreads 800
 ThreadLimit 64
 ThreadsPerChild 50
 AsyncRequestWorkerFactor2
 MaxRequestWorkers   800
 MaxConnectionsPerChild  0


Server Version: Apache/2.4.52 (Ubuntu 2022.04) OpenSSL/3.0.2
mod_wsgi/4.9.0 Python/3.10
Server MPM: event
Server Built: 2022-09-30T04:09:50

DigitalOcean droplet 8BG RAM and lightly loaded.

Many thanks for an

Re: NEO6 GPS with Py PICO with micropython

2022-11-29 Thread dn

On 30/11/2022 00.53, KK CHN wrote:

List ,
I am following this tutorial to  get latitude and longitude data  using
NEO6 GPS module and Py PICO  to read the GPS data from the device.

I followed the code specified in this tutorial.
https://microcontrollerslab.com/neo-6m-gps-module-raspberry-pi-pico-micropython/

I have installed thony IDE in my Desktop(windows PC) and  run the code
after the devices all connected and using USB cable connected to my PC.

When I ran the program I am able to see the output of  latitude and
longitude in the console of thony IDE.  But  between certain intervals of a
few seconds  I am getting the latitude and longitude data ( its printing
GPS data not found ?? ) in the python console.

The satellite count from the $GGPA output showing 03 ..
and the GPS data not found repeating randomly for intervals of seconds.
Any hints why it is missing the GPS data (randomly) ??

PS:-  The GPS device I placed outside  my window and connected to the PC
with a USB cable from the PICO  module. GPS device NEO6 light (Red LED
) blinking even though the "  GPS data not found" messages in th python
console.

Any hints ?? most welcome


If it works (correctly*) some of the time, and there is only one look-up 
in the code, it doesn't really sound like a problem with the Python.


* is it?

Does the unit also report the number of satellites it can 'see'? Is it 
always more than one?


Other data not-discussed: change of cable, reducing length of cable, ...

--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Setupfailure

2022-11-29 Thread Mats Wichmann

On 11/28/22 07:12, Kelvin Buuri wrote:

May python failed to install


Was there an antual question here? If so, give details when re-asking.



--
https://mail.python.org/mailman/listinfo/python-list


Re: NEO6 GPS with Py PICO with micropython

2022-11-29 Thread gene heskett

On 11/29/22 06:56, KK CHN wrote:

List ,
I am following this tutorial to  get latitude and longitude data  using
NEO6 GPS module and Py PICO  to read the GPS data from the device.

I followed the code specified in this tutorial.
https://microcontrollerslab.com/neo-6m-gps-module-raspberry-pi-pico-micropython/

I have installed thony IDE in my Desktop(windows PC) and  run the code
after the devices all connected and using USB cable connected to my PC.

When I ran the program I am able to see the output of  latitude and
longitude in the console of thony IDE.  But  between certain intervals of a
few seconds  I am getting the latitude and longitude data ( its printing
GPS data not found ?? ) in the python console.

The satellite count from the $GGPA output showing 03 ..
and the GPS data not found repeating randomly for intervals of seconds.
Any hints why it is missing the GPS data (randomly) ??

PS:-  The GPS device I placed outside  my window and connected to the PC
with a USB cable from the PICO  module. GPS device NEO6 light (Red LED
) blinking even though the "  GPS data not found" messages in th python
console.

Any hints ?? most welcome

Yours,
Krishane


From a retired broadcast engineer, intimately familiar with vswr:

std, wire only usb cables can get to acting flaky at 5 feet. If the 
cable to the receiver is more than that, a higher quality cable may be 
required. The better cable will probably have active electronics in the 
molded on ends that treats the cable as a transmission line,

Which if done right can go as much as ten meters at usb2 speeds.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 

--
https://mail.python.org/mailman/listinfo/python-list


Job positions at CMCC Foundation, Italy - Advanced Scientific Computing - ASC Division

2022-11-29 Thread CMCC Foundation

/Please, feel free to circulate //to anyone you think may be interested/
/Apologies for cross-posting
/
/--
/
_
_
The CMCC Foundation is a scientific research center on climate change 
and its interactions with the environment, the society, the world of 
business and policy makers.
Our work aims to stimulate sustainable growth, protect the environment 
and develop strategies for the adaptation and mitigation of climate change.
Our Division of Advanced Scientific Computing (ASC Division) is 
considering the possibility to hire a talented and proactive:_

_
_
_
*- POST DEGREE-Data Science skills*_
_
[Job Opening cod.12402]
*Deadline: December 16th, 2022*
More details and info about HOW TO APPLY:
https://cmccfoundation.applytojob.com/apply/gAKKckG5zF/12402-POST-DEGREEData-Science-Skills
_
_
*- POST DEGREE-HPC skills*_
_[Job Opening cod.12403]
*Deadline: December 16th, 2022*
More details and info about HOW TO APPLY:
https://cmccfoundation.applytojob.com/apply/CUso6CnoRt/12403-POST-DEGREEHPC-Skills
_
_
*- POST DEGREE-Machine Learning skills
*[Job Opening cod.12404]
*Deadline: December 16th, 2022*
More details and info about HOW TO APPLY:
https://cmccfoundation.applytojob.com/apply/c4A2a92Co7/12404-POST-DEGREEMachine-Learning-Skills


FOR FURTHER INFORMATION ON CMCC JOB OPPORTUNITIES, PLEASE VISIT OUR WEBSITE:
https://www.cmcc.it/work-with-us

-- Fondazione CMCC Centro Euro-Mediterraneo sui Cambiamenti Climatici
Via Marco Biagi, 5 - 73100 Lecce, Italy
i...@cmcc.it    - www.cmcc.it 

--
https://mail.python.org/mailman/listinfo/python-list


Bug report - Python 3.10 from Microsoft Store - IDLE won't start

2022-11-29 Thread Johan Gunnarsson via Python-list
Hello, IDLE won't start if ver. 3.10 is installed from Microsoft Store.
3.9 works just fine.

Thanks in advance!


Johan Gunnarsson
Lunds universitet
Medicinska fakulteten
Bibliotek & IKT
Box 118, 221 00 Lund
Besöksadress: Sölvegatan 19, 221 84 Lund
Telefon: +46 46 222 18 23
www.medicin.lu.se
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: NEO6 GPS with Py PICO with micropython

2022-11-29 Thread rbowman
On Tue, 29 Nov 2022 17:23:31 +0530, KK CHN wrote:


> When I ran the program I am able to see the output of  latitude and
> longitude in the console of thony IDE.  But  between certain intervals
> of a few seconds  I am getting the latitude and longitude data ( its
> printing GPS data not found ?? ) in the python console.

I would guess the 8 seconds in

timeout = time.time() + 8

is too short. Most GPS receivers repeat a sequence on NMEA sentences and 
the code is specifically looking for $GPGGA. Add

print(buff)

to see the sentences being received. I use the $GPRMC since I'm interested 
in the position, speed, and heading. It's a different format but if you 
only want lat/lon you could decode it in a similar fashion as the $GPGGA.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python script not letting go of files

2022-11-29 Thread Weatherby,Gerard





"Weatherby,Gerard"  writes:
>Do any of you Python folks see any blunders in the above code along the
>lines of not letting go of py files or static assets?

Er, no, I just replied to the original poster.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python script not letting go of files

2022-11-29 Thread Mike Dewhirst

Stefan

Thank you. I should have said this has been working fine for years and 
years until Ubuntu 2022.04 on a new droplet running Apache/2.4.52


I will refactor it one day - especially if the script is implicated. But 
I think I have to learn how to use lsof first!


Cheers

Mike

On 30/11/2022 1:44 am, Stefan Ram wrote:

"Weatherby,Gerard"  writes:

Do any of you Python folks see any blunders in the above code along the
lines of not letting go of py files or static assets?

   No, sorry. But I had to refactor it.

   *Warning* The following code is not intended to be executed,
   it is just intended to be read by humans. It was not tested
   and, therefore, it probably contains errors. If executed, it
   may cause destruction such as deletions of files etc. Stefan
   Ram (I) does not claim any copyright for his modifications.

def attempt( task, command ):
 if trycmd( command, log ):
 print( f'task "{task}" failed.'  )
 return False # failure
 else:
 return True # success

def main():
 with open( fetchlog, 'a' )as log_:
 global log
 log = log_
 remove_site()
 del log

def remove_site():
 log.write( f"\n\nFetching {tag}" )
 if attempt( "remove site", f"sudo rm -Rf {site_root}", log ):
 get_source()

def get_source():
 if attempt( "get source", f"sudo svn export --force --username {usr} --password 
{pw} {svn_repo} {site_root}" ):
 install_requirements()

def install_requirements():
 if attempt( "install requirements", f"sudo -H pip install -r {reqfile}" ):
 repo_migrations()

def repo_migrations():
 if attempt( "run any migrations shipped from the repo", f"sudo python3 
{site_root}/manage.py migrate --noinput --settings={settings}" ):
 makemigrations()

def makemigrations():
 # shouldn't find anything
 if attempt( "makemigrations", f"sudo python3 {site_root}/manage.py 
makemigrations --noinput --settings={settings}" ):
 migrate()

def migrate():
 # should already be done
 if attempt( "migrate 2", f"sudo python3 {site_root}/manage.py migrate --noinput 
--settings={settings}" ):
 remove_static()

def remove_static():
 if attempt( "remove all static files from their Apache dir", f"sudo rm -Rf 
{static_root}/*" ):
 copy_static()

def copy_static():
 if attempt( "copy all static files to the Apache location", f"sudo python3 
{site_root}/manage.py collectstatic --noinput --settings={settings}" ):
 set_permissions()

def set_permissions():
 if attempt( "set all permissions", f"sudo {scripts}/perms_{host}.sh" ):
 service_restart()

def service_restart():
 if attempt( "restart of Apache service", f"sudo service apache2 restart" ):
 log_success()

def log_success():
 log.write( f"\nFinish {tag}\n\n" )

# main()
# sys.exit()





--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.



OpenPGP_signature
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list