New computer, new Python

kermit at polaris.net kermit at polaris.net
Fri Dec 9 12:13:16 EST 2022


 
Hello.  I've downloaded the new Python to my new Computer,  and the new Python mystifies me.
 
Instead of an editor, it looks like a Dos executable program.
 
How can I write my own Python Functions and subroutines in the new Python?
 
It is version 3.11 (64 bit).
 
Kermit
 
 
 
 
-----Original Message-----
From: python-list-request at python.org
Sent: Friday, December 9, 2022 12:00pm
To: python-list at python.org
Subject: Python-list Digest, Vol 231, Issue 9



Send Python-list mailing list submissions to
 python-list at python.org

To subscribe or unsubscribe via the World Wide Web, visit
 https://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body 'help' to
 python-list-request at python.org

You can reach the person managing the list at
 python-list-owner at python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Python-list digest..."


Today's Topics:

 1. Re: How to convert a raw string r'\xdd' to '\xdd' more
 gracefully? (Jach Feng)
 2. Re: Nonuniform PRNG? (Stefan Ram)
 3. Panoptisch - A way to understand your project's dependencies
 and find malicious packages (Aarnav Mahavir Bos)
 4. MinecraftEdu (Jelena Ili?)
 5. Re: MinecraftEdu (Cameron Simpson)
 6. Re: How to convert a raw string r'\xdd' to '\xdd' more
 gracefully? (Jach Feng)
 7. Re: Panoptisch - A way to understand your project's
 dependencies and find malicious packages (Axy)
 8. Re: How to convert a raw string r'\xdd' to '\xdd' more
 gracefully? (Weatherby,Gerard)
 9. Re: Panoptisch - A way to understand your project's
 dependencies and find malicious packages (Dan Kolis)


----------------------------------------------------------------------

Message: 1
Date: Thu, 8 Dec 2022 00:56:42 -0800 (PST)
From: Jach Feng <jfong at ms4.hinet.net>
To: python-list at python.org
Subject: Re: How to convert a raw string r'\xdd' to '\xdd' more
 gracefully?
Message-ID: <a3d9c9b0-aa3a-431a-9275-6f0489f458d6n at googlegroups.com>
Content-Type: text/plain; charset="UTF-8"

Jach Feng ? 2022?12?7? ?????10:23:20 [UTC+8] ??????
> s0 = r'\x0a' 
> At this moment it was done by 
> 
> def to1byte(matchobj): 
> ....return chr(int('0x' + matchobj.group(1), 16)) 
> s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0) 
> 
> But, is it that difficult on doing this simple thing? 
> 
> --Jach
I find another answer on the web.

>>> s0 = r'\x0a'
>>> s0.encode('Latin-1').decode('unicode-escape')
'\n'


------------------------------

Message: 2
Date: 8 Dec 2022 12:17:22 GMT
From: ram at zedat.fu-berlin.de (Stefan Ram)
To: python-list at python.org
Subject: Re: Nonuniform PRNG?
Message-ID: <random-20221208131657 at ram.dialup.fu-berlin.de>
Content-Type: text/plain; charset=UTF-8

"Robert E. Beaudoin" <rbeaudoin at acm.org> writes:
>One thing you could do is to apply von Neumann de-biasing to convert a
>string of output bits from your biased PRNG to an unbiased string, and
>test the de-biased output.

 Some non-uniform generators are based on uniform generators
 whose output then is warped by the application of some function.

 If one has access to the underlying uniform generator used,
 one can test this with the algorithms for uniform generators.




------------------------------

Message: 3
Date: Thu, 8 Dec 2022 18:52:29 +0100
From: Aarnav Mahavir Bos <aarnav.bos at code.berlin>
To: python-list at python.org
Subject: Panoptisch - A way to understand your project's dependencies
 and find malicious packages
Message-ID:
 <CAGKp6MyQYVrxmYr4gNzuSNx53v=XU1uEOaJV65f2qAGN6GgoQw at mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hello all,

I would like to share Panoptisch, a FOSS(Free and Open Source Software)
tool I've been working on.

We all may have encountered the issue of not having a clear dependency tree
or not being sure of the modules our dependencies and sub-dependencies are
using.

Some of us may have also heard of supply chain attacks, where open source
projects are hijacked to distribute malicious code masquerading as the
original package. This can happen deep down in the dependency chain.

Panoptisch was born out of the need to accurately verify the modules used
in my project.
It recursively scans a Python module or file to find modules used and
exports a report in JSON which can be parsed for analysis.

For example, should your yaml parser, or it's sub-dependencies import
socket/os? should your markdown renderer or it's sub-dependencies import
sys/importlib? *Probably not.*

Panoptisch is in early stages, has known limitations and is looking for
help! I would love feedback, contributions, and most important of all,
rigorous testing!

I would also love to help you integrate this tool in your workflow to write
more secure software.

Link: https://github.com/R9295/panoptisch
Short Demo: https://www.youtube.com/watch?v=bDJWl_odXx0

Thanks and Regards,
aarnav


------------------------------

Message: 4
Date: Thu, 8 Dec 2022 12:12:47 -0800 (PST)
From: Jelena Ili? <ilicjelena3105 at gmail.com>
To: python-list at python.org
Subject: MinecraftEdu
Message-ID: <60a744d6-4994-41c3-a3bc-635cc7d665c3n at googlegroups.com>
Content-Type: text/plain; charset="UTF-8"

Hello,
I'm new to MinecraftEDU programming with Python. I'm wondering if anyone can recommend how to get started with creating lessons and how to get started programming in MinecraftEDU?


------------------------------

Message: 5
Date: Fri, 9 Dec 2022 08:26:12 +1100
From: Cameron Simpson <cs at cskk.id.au>
To: Jelena Ili? <ilicjelena3105 at gmail.com>
Cc: python-list at python.org
Subject: Re: MinecraftEdu
Message-ID: <Y5JWdImqGO2m5C6q at cskk.homeip.net>
Content-Type: text/plain; charset=utf-8; format=flowed

On 08Dec2022 12:12, Jelena Ili? <ilicjelena3105 at gmail.com> wrote:
>I'm new to MinecraftEDU programming with Python. I'm wondering if 
>anyone can recommend how to get started with creating lessons and how 
>to get started programming in MinecraftEDU?

Had you started here? 
https://education.minecraft.net/en-us/resources/computer-science-subject-kit/python-101

That's just from a web search, I've not used it.

Cheers,
Cameron Simpson <cs at cskk.id.au>


------------------------------

Message: 6
Date: Thu, 8 Dec 2022 18:05:02 -0800 (PST)
From: Jach Feng <jfong at ms4.hinet.net>
To: python-list at python.org
Subject: Re: How to convert a raw string r'\xdd' to '\xdd' more
 gracefully?
Message-ID: <ce66cc3c-1361-4611-8314-bec0a3ca7abdn at googlegroups.com>
Content-Type: text/plain; charset="UTF-8"

Jach Feng ? 2022?12?7? ?????10:23:20 [UTC+8] ??????
> s0 = r'\x0a' 
> At this moment it was done by 
> 
> def to1byte(matchobj): 
> ....return chr(int('0x' + matchobj.group(1), 16)) 
> s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0) 
> 
> But, is it that difficult on doing this simple thing? 
> 
> --Jach
The whold story is,

I had a script which accepts an argparse's positional argument. I like this argument may have control character embedded in when required. So I make a post "How to enter escape character in a positional string argument from the command line? on DEC05. But there is no response. I assume that there is no way of doing it and I have to convert it later after I get the whole string from the command line.

I made this convertion using the chr(int(...)) method but not satisfied with. That why this post came out.

At this moment the conversion is done almost the same as Peter's codecs.decode() method but without the need of importing codecs module:-)

def to1byte(matchobj):
....return matchobj.group(0).encode().decode("unicode-escape")


------------------------------

Message: 7
Date: Fri, 9 Dec 2022 03:49:58 +0000
From: Axy <axy at declassed.art>
To: python-list at python.org
Subject: Re: Panoptisch - A way to understand your project's
 dependencies and find malicious packages
Message-ID: <146e747f-bb2b-29e6-b8df-93698495c46a at declassed.art>
Content-Type: text/plain; charset=UTF-8; format=flowed

On 08/12/2022 17:52, Aarnav Mahavir Bos wrote:
> Hello all,
>
> I would like to share Panoptisch, a FOSS(Free and Open Source Software)
> tool I've been working on.

Hi there,

I added your project to my watch list, keep on your work.

A couple of points:

First, I glanced at the code and in the very first file I opened, 
https://github.com/R9295/panoptisch/blob/master/panoptisch/__init__.py, 
I see main(). I usually place such a code in __main__.py

Second, in addition to AST analysis it would be nice to implement a 
sandbox with import hooks.

Axy.



------------------------------

Message: 8
Date: Fri, 9 Dec 2022 13:29:06 +0000
From: "Weatherby,Gerard" <gweatherby at uchc.edu>
To: Jach Feng <jfong at ms4.hinet.net>, "python-list at python.org"
 <python-list at python.org>
Subject: Re: How to convert a raw string r'\xdd' to '\xdd' more
 gracefully?
Message-ID:
 <SA1PR14MB5855E3DF0336F514B506CAF9B91C9 at SA1PR14MB5855.namprd14.prod.outlook.com>

Content-Type: text/plain; charset="iso-2022-jp"

That?s actually more of a shell question than a Python question. How you pass certain control characters is going to depend on the shell, operating system, and possibly the keyboard you?re using. (e.g. https://www.alt-codes.net).

Here?s a sample program. The dashes are to help show the boundaries of the string

#!/usr/bin/env python3
import argparse
import logging


parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('data')
args = parser.parse_args()
print(f'Input\n: -{args.data}- length {len(args.data)}')
for c in args.data:
 print(f'{ord(c)} ',end='')
print()


Using bash on Linux:

./cl.py '^M
'
Input
 -
- length 3
13 32 10


From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of Jach Feng <jfong at ms4.hinet.net>
Date: Thursday, December 8, 2022 at 9:31 PM
To: python-list at python.org <python-list at python.org>
Subject: Re: How to convert a raw string r'xdd' to 'xdd' more gracefully?
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

Jach Feng ? 2022?12?7? ?????10:23:20 [UTC+8] ??????
> s0 = r'\x0a'
> At this moment it was done by
>
> def to1byte(matchobj):
> ....return chr(int('0x' + matchobj.group(1), 16))
> s1 = re.sub(r'\\x([0-9a-fA-F]{2})', to1byte, s0)
>
> But, is it that difficult on doing this simple thing?
>
> --Jach
The whold story is,

I had a script which accepts an argparse's positional argument. I like this argument may have control character embedded in when required. So I make a post "How to enter escape character in a positional string argument from the command line? on DEC05. But there is no response. I assume that there is no way of doing it and I have to convert it later after I get the whole string from the command line.

I made this convertion using the chr(int(...)) method but not satisfied with. That why this post came out.

At this moment the conversion is done almost the same as Peter's codecs.decode() method but without the need of importing codecs module:-)

def to1byte(matchobj):
....return matchobj.group(0).encode().decode("unicode-escape")
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!hcg9ULzmtVUzMJ87Emlfsf6PGAfC-MEzUs3QQNVzWwK4aWDEtePG34hRX0ZFVvWcqZXRcM67JkkIg-l-K9vB$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!hcg9ULzmtVUzMJ87Emlfsf6PGAfC-MEzUs3QQNVzWwK4aWDEtePG34hRX0ZFVvWcqZXRcM67JkkIg-l-K9vB$>


------------------------------

Message: 9
Date: Fri, 9 Dec 2022 07:38:57 -0800 (PST)
From: Dan Kolis <dankolis at gmail.com>
To: python-list at python.org
Subject: Re: Panoptisch - A way to understand your project's
 dependencies and find malicious packages
Message-ID: <8903c97c-26a0-486b-a1b8-f4330659f2a3n at googlegroups.com>
Content-Type: text/plain; charset="UTF-8"

I think it needs a built in viewer or at least a human readable output, or nobody will go through the trouble to use it.

Other that that, maybe a pretty good idea, sure



------------------------------

Subject: Digest Footer

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


------------------------------

End of Python-list Digest, Vol 231, Issue 9
*******************************************


More information about the Python-list mailing list