AuckPUG's last (virtual) Coding Evening for 2022

2022-11-30 Thread dn

Wednesday 7 December, 1800 for 1830 NZDT/0530 UTC

We will continue the "Crafting Software" series, gradually developing 
Monty's Python Supermarket. The evening's aim is to move the 
product-prices from their hard-coded dict[ionary] into a flat-file 
(introducing Python I/O), and then to do same with the Accountant's 
favorite tool - a Workbook or Spreadsheet (Python's library to interact 
with LibreOffice-Calc and MS-Excel). You can treat it as a 
code-along-at-home exercise or just watch the fun. The Web-conference 
URL and a QuickStart Guide (for those who didn't attend last time) will 
be provided upon RSVP. All welcome!


https://www.meetup.com/nzpug-auckland/events/hgxmwsydcqbkb/



The Smart Iterators Challenge has finished (after five Challenge-weeks). 
Congratulations to all who participated (and if you didn't have time to 
complete, you're welcome to continue at your own pace). Particular pride 
for those who hung-in-there right to the end, making astute discoveries 
and learning ideas which have already been adopted into 
professional-practice. Well done! A "Retrospective, Review, and 
Reflection Wrap-up" document is available to participants/upon request. 
Advice and assistance will continue to be available - please email off-list.


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


Re: Vb6 type to python

2022-11-30 Thread Weatherby,Gerard
Look at struct package: https://docs.python.org/3/library/struct.html


From: Python-list  on 
behalf of luca72.b...@gmail.com 
Date: Wednesday, November 30, 2022 at 11:48 AM
To: python-list@python.org 
Subject: Vb6 type to python
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

Hello i have a byte file, that fill a vb6 type like:
Type prog_real
codice As String * 12'hsg
denom  As String * 24'oo
codprof As String * 12   'ljio
note As String * 100
programmer As String * 11
Out As Integer
b_out As Byte'TRUE = Sec   FALSE= mm
asse_w As Byte   '3.zo Asse --> 0=Z  1=W
numpassi  As Integer 'put
len As Long  'leng
p(250) As passo_pg
vd(9) As Byte'vel.
qUscita(9) As Integer'quote
l_arco As Long   'reserved
AxDin As Byte'dime
End Type

How i can convert to python
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!ky-bqK3l3Sbj0O_n3_x6Yo2wFaF5xABKKYgjbIPH49rdLZ2W_vQlW2gGbSQ7uRplRBZn_wS4h4evqcYQZaR1aSNJaTXnRQ$
-- 
https://mail.python.org/mailman/listinfo/python-list


python: setup.py: how NOT to install C extensions used only by tests

2022-11-30 Thread Bartosz Golaszewski
I have a module that has a tests/ directory which contains a C
extension that's only used by test cases. I don't want to install it.
I'm building it as a setuptools.Extension() added to setup() using the
ext_modules argument. The test directory is not added to setup's
packages argument. Even though none of the python sources from the
tests/ directory gets installed when running setup.py install, the
extension binary (and nothing else) is installed into
site-packages/tests/. How can I prohibit setuptools from doing it?

Best Regards,
Bartosz Golaszewski
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Vb6 type to python

2022-11-30 Thread DFS

On 11/30/2022 1:07 PM, DFS wrote:

On 11/30/2022 6:56 AM, luca72.b...@gmail.com wrote:




I don't do Python OO so someone else can answer better, but a simple 
port of your VB type would be a python class definition:


class prog_real:
     codice, denom, codprof, note, programmer
     AxDin, b_out, asse_w, vd, Out, numpassi, qUscita
     len, l_arco, p



Sorry for bad advice - that won't work.  The other class definition that 
initializes the variables does work:


class prog_real:
# strings
codice, denom, codprof, note, programmer = '', '', '', '', ''

# bytes
AxDin, b_out, asse_w, vd = 0, 0, 0, 0

# ints
Out, numpassi, qUscita = 0, 0, 0

# longs
len, l_arco = 0, 0

# misc
p = ''
--
https://mail.python.org/mailman/listinfo/python-list


Re: Vb6 type to python

2022-11-30 Thread DFS

On 11/30/2022 6:56 AM, luca72.b...@gmail.com wrote:


Hello i have a byte file, that fill a vb6 type like:
Type prog_real
 codice As String * 12'hsg
 denom  As String * 24'oo
 codprof As String * 12   'ljio
 note As String * 100
 programmer As String * 11
 Out As Integer
 b_out As Byte'TRUE = Sec   FALSE= mm
 asse_w As Byte   '3.zo Asse --> 0=Z  1=W
 numpassi  As Integer 'put
 len As Long  'leng
 p(250) As passo_pg
 vd(9) As Byte'vel.
 qUscita(9) As Integer'quote
 l_arco As Long   'reserved
 AxDin As Byte'dime
End Type

How i can convert to python



You don't need to declare variable types in Python.

I don't do Python OO so someone else can answer better, but a simple 
port of your VB type would be a python class definition:


class prog_real:
codice, denom, codprof, note, programmer
AxDin, b_out, asse_w, vd, Out, numpassi, qUscita
len, l_arco, p

important: at some point you'll have trouble with a variable named 
'len', which is a Python built-in function.


For a visual aid you could label the variables by type and assign an 
initial value, if that helps you keep track in your mind.


class prog_real:
# strings
codice, denom, codprof, note, programmer = '', '', '', '', ''

# bytes
AxDin, b_out, asse_w, vd = 0, 0, 0, 0

# ints
Out, numpassi, qUscita = 0, 0, 0

# longs
len, l_arco = 0, 0

# misc
p = ''

But it's not necessary.

To restrict the range of values in the variables you would have to 
manually check them each time before or after they change, or otherwise 
force some kind of error/exception that occurs when the variable 
contains data you don't want.



# assign values
prog_real.codice = 'ABC'
print('codice: ' + prog_real.codice)
prog_real.codice = 'DEF'
print('codice: ' + prog_real.codice)
prog_real.codice = 123
print('codice: ' + str(prog_real.codice))


And as shown in the last 2 lines, a variable can accept any type of 
data, even after it's been initialized with a different type.


b = 1
print(type(b))

b = 'ABC'
print(type(b))



Python data types:
https://www.digitalocean.com/community/tutorials/python-data-types

A VB to python program:
https://vb2py.sourceforge.net

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


Re: pip issue

2022-11-30 Thread Thomas Passin

On 11/30/2022 1:49 PM, Gisle Vanem via Python-list wrote:

Dieter Maurer wrote:


Otherwise no issues. But where is this text "-arkupsafe" stored
and how to get rid it it? I've searched through all of my .pth
files and found no such string.


Have you looked at the content of the folder mentioned
in the warnings (e.g. `...\site-packages`).


I had 2 folders named:
   site-packages\~arkupsafe\
   site-packages\~arkupsafe-2.1.1.dist-info\

Removing those, the problem was gone.

So perhaps this tilde '~' means something special
for pip?



I've seen things like this before.  Those directories - the ones 
starting with "~" - seem to be used for backing up a package (it could a 
dependency that is required by the package you are installing) before 
installing a newer version.  I think that somehow pip applies wrong file 
permissions that prevent it from removing the backup directory at the 
end.  The issue does not affect the successful installation of the newer 
version.  I have been able to remove these directories myself afterwards 
with no problems.


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


Re: pip issue

2022-11-30 Thread Gisle Vanem via Python-list

Dieter Maurer wrote:


Otherwise no issues. But where is this text "-arkupsafe" stored
and how to get rid it it? I've searched through all of my .pth
files and found no such string.


Have you looked at the content of the folder mentioned
in the warnings (e.g. `...\site-packages`).


I had 2 folders named:
  site-packages\~arkupsafe\
  site-packages\~arkupsafe-2.1.1.dist-info\

Removing those, the problem was gone.

So perhaps this tilde '~' means something special
for pip?

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


Re: pip issue

2022-11-30 Thread Dieter Maurer
Gisle Vanem wrote at 2022-11-30 10:51 +0100:
>I have an issue with 'pip v. 22.3.1'. On any
>'pip install' command I get warning like this:
>   c:\> pip3 install asciinema
>   WARNING: Ignoring invalid distribution -arkupsafe 
> (f:\gv\python310\lib\site-packages)
>   WARNING: Ignoring invalid distribution -arkupsafe 
> (f:\gv\python310\lib\site-packages)
>   Collecting asciinema
> Downloading asciinema-2.2.0-py3-none-any.whl (92 kB)
>   ...
>
>Otherwise no issues. But where is this text "-arkupsafe" stored
>and how to get rid it it? I've searched through all of my .pth
>files and found no such string.

Have you looked at the content of the folder mentioned
in the warnings (e.g. `...\site-packages`).
-- 
https://mail.python.org/mailman/listinfo/python-list


Vb6 type to python

2022-11-30 Thread luca72.b...@gmail.com
Hello i have a byte file, that fill a vb6 type like:
Type prog_real
codice As String * 12'hsg
denom  As String * 24'oo
codprof As String * 12   'ljio
note As String * 100
programmer As String * 11
Out As Integer
b_out As Byte'TRUE = Sec   FALSE= mm
asse_w As Byte   '3.zo Asse --> 0=Z  1=W
numpassi  As Integer 'put
len As Long  'leng
p(250) As passo_pg
vd(9) As Byte'vel.
qUscita(9) As Integer'quote 
l_arco As Long   'reserved
AxDin As Byte'dime
End Type

How i can convert to python
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: NEO6 GPS with Py PICO with micropython

2022-11-30 Thread Barry Scott



> On 30 Nov 2022, at 10:58, KK CHN  wrote:
> 
> List,
> 
> Just commented the // gpsModule.readline() in the while loop,  (
> refer the link
> https://microcontrollerslab.com/neo-6m-gps-module-raspberry-pi-pico-micropython/
> )
> 
> 
> while True: # gpsModule.readline() // This line commented out and the "GPS
> not found message disappeared". buff = str(gpsModule.readline()) parts =
> buff.split(',')
> 
> 
> The GPS not found error which appears intermittently in the output python
> console for few seconds ( say 7 to 8 seconds  its printing the lines   "
> GPS data not found" )   now  disappears.
> 
> Any thoughts?  How the above line comment made it vanish the  "GPS data
> not found" error output.

Show the full text of the error that you see. Is it a traceback?

What I would do then is read the code that raised the "GPS data not found"
error and find out why it reports that error.

Barry
p.s. Please reply in line, do not top post.

> 
> Krishane
> 
> On Wed, Nov 30, 2022 at 3:58 AM rbowman  wrote:
> 
>> 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
>> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Re: NEO6 GPS with Py PICO with micropython

2022-11-30 Thread KK CHN
List,

Just commented the // gpsModule.readline() in the while loop,  (
refer the link
https://microcontrollerslab.com/neo-6m-gps-module-raspberry-pi-pico-micropython/
)


while True: # gpsModule.readline() // This line commented out and the "GPS
not found message disappeared". buff = str(gpsModule.readline()) parts =
buff.split(',')


The GPS not found error which appears intermittently in the output python
console for few seconds ( say 7 to 8 seconds  its printing the lines   "
GPS data not found" )   now  disappears.

 Any thoughts?  How the above line comment made it vanish the  "GPS data
not found" error output.

Krishane

On Wed, Nov 30, 2022 at 3:58 AM rbowman  wrote:

> 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
>
-- 
https://mail.python.org/mailman/listinfo/python-list


pip issue

2022-11-30 Thread Gisle Vanem via Python-list

Hello list.

I have an issue with 'pip v. 22.3.1'. On any
'pip install' command I get warning like this:
  c:\> pip3 install asciinema
  WARNING: Ignoring invalid distribution -arkupsafe 
(f:\gv\python310\lib\site-packages)
  WARNING: Ignoring invalid distribution -arkupsafe 
(f:\gv\python310\lib\site-packages)
  Collecting asciinema
Downloading asciinema-2.2.0-py3-none-any.whl (92 kB)
  ...

Otherwise no issues. But where is this text "-arkupsafe" stored
and how to get rid it it? I've searched through all of my .pth
files and found no such string.

I assume this is an entry for an orphaned package "MarkupSafe"
since a 'pip list | grep markup' will list 'MarkupSafe 2.1.1'.


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