Appending to and removing from numpy arrays

2020-06-10 Thread Urs Thuermann
Hi,

is it possible to append data to or remove data from numpy arrays like
Python lists?  I have some code where I currently use lists and often
do things like

a.append(elem)
a += b
del a[:-n]

I am thinking of changing to numpy arrays but it seems I cannot modify
numpy arrays like this in-place, but instead I need to create a new
array and assign that:

a = np.append(a, elem)
a = np.append(a, b)
a = a[-n:]

Or do I miss something here?

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


Turning pygame apps into add-ons

2020-06-10 Thread elisha hollander
I have a folder with my pygame apps, I want to build a program to have a
nice interface to access those apps from, I want it to be like an actual
computer, so, I need it to open the apps as rect of something not as
external apps.
Is there a way to do it without changing all the codes?
(I can import the app from the app file, but it won't open in the interface)
-- 
https://mail.python.org/mailman/listinfo/python-list


pyinstaller

2020-06-10 Thread Robin Becker

I'm sure this has come up before, but a tiny pyinstaller created exe is being 
seen as malware by windows 10.

Is there any way to create simple single file applications which don't get this 
treatment?

The intended users are unlikely to understand how to adjust the scanner to 
whitelist the application.
--
Robin Becker
--
https://mail.python.org/mailman/listinfo/python-list


Re: pyinstaller

2020-06-10 Thread Chris Angelico
On Wed, Jun 10, 2020 at 11:49 PM Robin Becker  wrote:
>
> I'm sure this has come up before, but a tiny pyinstaller created exe is being 
> seen as malware by windows 10.
>
> Is there any way to create simple single file applications which don't get 
> this treatment?
>
> The intended users are unlikely to understand how to adjust the scanner to 
> whitelist the application.

Tell them to install Python from an official source, and then
distribute your application as a single .py (or .pyw) file. Problem
solved.

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


Re: pyinstaller

2020-06-10 Thread Souvik Dutta
You might also try py2exe, in that way the user doesn't need to install
python in her/his computer.

Souvik flutter dev

On Wed, Jun 10, 2020, 7:18 PM Robin Becker  wrote:

> I'm sure this has come up before, but a tiny pyinstaller created exe is
> being seen as malware by windows 10.
>
> Is there any way to create simple single file applications which don't get
> this treatment?
>
> The intended users are unlikely to understand how to adjust the scanner to
> whitelist the application.
> --
> Robin Becker
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyinstaller

2020-06-10 Thread Robin Becker

On 10/06/2020 15:18, Souvik Dutta wrote:

You might also try py2exe, in that way the user doesn't need to install
python in her/his computer.

Souvik flutter dev

On Wed, Jun 10, 2020, 7:18 PM Robin Becker  wrote:


I'm sure this has come up before, but a tiny pyinstaller created exe is
being seen as malware by windows 10.

I think we used py2exe previously and I guess that will have the same 
problems as pyinstaller.
--
Robin Becker
--
https://mail.python.org/mailman/listinfo/python-list


Re: pyinstaller

2020-06-10 Thread Calvin Spealman
On Wed, Jun 10, 2020 at 10:06 AM Chris Angelico  wrote:

> On Wed, Jun 10, 2020 at 11:49 PM Robin Becker  wrote:
> >
> > I'm sure this has come up before, but a tiny pyinstaller created exe is
> being seen as malware by windows 10.
> >
> > Is there any way to create simple single file applications which don't
> get this treatment?
> >
> > The intended users are unlikely to understand how to adjust the scanner
> to whitelist the application.
>
> Tell them to install Python from an official source, and then
> distribute your application as a single .py (or .pyw) file. Problem
> solved.
>

This is in no way a solution or a reasonable way to distribute software to
end-users. Please don't give non-answers.

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

-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

[email protected]  M: +1.336.210.5107
[image: https://red.ht/sig] 
TRIED. TESTED. TRUSTED. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyinstaller

2020-06-10 Thread Chris Angelico
On Thu, Jun 11, 2020 at 12:51 AM Calvin Spealman  wrote:
>
>
>
> On Wed, Jun 10, 2020 at 10:06 AM Chris Angelico  wrote:
>>
>> On Wed, Jun 10, 2020 at 11:49 PM Robin Becker  wrote:
>> >
>> > I'm sure this has come up before, but a tiny pyinstaller created exe is 
>> > being seen as malware by windows 10.
>> >
>> > Is there any way to create simple single file applications which don't get 
>> > this treatment?
>> >
>> > The intended users are unlikely to understand how to adjust the scanner to 
>> > whitelist the application.
>>
>> Tell them to install Python from an official source, and then
>> distribute your application as a single .py (or .pyw) file. Problem
>> solved.
>
>
> This is in no way a solution or a reasonable way to distribute software to 
> end-users. Please don't give non-answers.
>

I'm sorry to have used this non-answer myself in the past. I must have
been hallucinating; all those end users that double-click on .py files
and successfully run applications must actually have been figments of
my imagination.



This IS a viable way to distribute software. Yes, it means you have to
package everything up into a single .py file, which restricts you a
bit; I'm not sure if it's viable to distribute a .zip file for
importing, but it wasn't last time I did this. But if you can manage
to make a single file out of it, it becomes - effectively - an
application.

Maybe this answer isn't applicable to everyone, but it's unfair to
call it a non-answer.

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


Re: pyinstaller

2020-06-10 Thread Souvik Dutta
I found this...
https://stackoverflow.com/questions/43777106/program-made-with-pyinstaller-now-seen-as-a-trojan-horse-by-avg
Might be usefull, might be useless.

Souvik flutter dev

On Wed, Jun 10, 2020, 7:18 PM Robin Becker  wrote:

> I'm sure this has come up before, but a tiny pyinstaller created exe is
> being seen as malware by windows 10.
>
> Is there any way to create simple single file applications which don't get
> this treatment?
>
> The intended users are unlikely to understand how to adjust the scanner to
> whitelist the application.
> --
> Robin Becker
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyinstaller

2020-06-10 Thread Robin Becker

On 10/06/2020 16:11, Souvik Dutta wrote:

I found this...
https://stackoverflow.com/questions/43777106/program-made-with-pyinstaller-now-seen-as-a-trojan-horse-by-avg
Might be usefull, might be useless.

Souvik flutter dev

On Wed, Jun 10, 2020, 7:18 PM Robin Becker  wrote:

.

thanks for the above. I might try to do a downgrade as that is suggested as one of the ways forward. I don't want to 
start compiling my own versions of the boostrap exe bits. Clearly most virus scanners only look at the obvious behaviour 
ie we execute a lot of python code which is probably impenetrable to the scanner and hence suspicious. I submitted my 
exe to the web based scanner in that answer and it came out clean, but windows 10 barks :(

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


Re: pyinstaller

2020-06-10 Thread Mats Wichmann
On 6/10/20 8:50 AM, Calvin Spealman wrote:
> On Wed, Jun 10, 2020 at 10:06 AM Chris Angelico  wrote:
> 
>> On Wed, Jun 10, 2020 at 11:49 PM Robin Becker  wrote:
>>>
>>> I'm sure this has come up before, but a tiny pyinstaller created exe is
>> being seen as malware by windows 10.
>>>
>>> Is there any way to create simple single file applications which don't
>> get this treatment?
>>>
>>> The intended users are unlikely to understand how to adjust the scanner
>> to whitelist the application.
>>
>> Tell them to install Python from an official source, and then
>> distribute your application as a single .py (or .pyw) file. Problem
>> solved.
>>
> 
> This is in no way a solution or a reasonable way to distribute software to
> end-users. Please don't give non-answers.

It's perfectly reasonable.  Now that Python is available as an install
from the Microsoft Store, telling people to install that is a far
simpler solution than trying to fight with various bundlers, or with a
virus/malware scanner.

The bundlers have, as far as I can tell, always been a bit problematic.
If they work for you, great, if not... oh, well.  Just look at the
history of "[insert bundler name] not working for me" type questions
over the last decade+ on the internet.

Virus/malware checkers on the hand are their own thing: they decide,
based on collected evidence, that certain attributes/bit patterns/etc.
indicate something nefarious. If you're unlucky enough, always a chance
with binary exe files, data files, etc, to match their heuristics,
you're (potentially) evil, and all you can do is argue with them that
your item is legitimate and they ought update their descriptions.

Microsoft is generally heading in the direction (along the lines of
mobile phone app stores, though it's still a configurable option at the
moment) to consider any installation that doesn't come from an approved
source as doubtful and/or forbidden, and in a corporate setting if they
decide to configure managed systems that way, you're unlikely to win an
argument to allow your little installer.




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


How to turn a defaultdict into a normal dict.

2020-06-10 Thread Antoon Pardon
The problem I face is that at the building face, I need a defaultdict 
because the values are lists that are appended too. So a 
defaultdict(list) is convenient in that new entries are treated as if

the value is an empty list.

However later when I actually use it, accessing a key that is not 
present, should raise KeyError.


Is that somehow possible?

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


Re: pyinstaller

2020-06-10 Thread Grant Edwards
On 2020-06-10, Souvik Dutta  wrote:

> You might also try py2exe, in that way the user doesn't need to
> install python in her/his computer.

I used to use py2exe for Windows apps, and it worked well for 2.x. A
couple years ago had to switch to cx_freeze due to issues with 3.x
support in py2exe (those issues may have been resolved since).

--
Grant


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


Re: pyinstaller

2020-06-10 Thread Grant Edwards
On 2020-06-10, Robin Becker  wrote:

> I think we used py2exe previously and I guess that will have
> the same problems as pyinstaller.

Why do you guess that?

--
Grant


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


Re: pyinstaller

2020-06-10 Thread Robin Becker

On 10/06/2020 15:02, Chris Angelico wrote:



The intended users are unlikely to understand how to adjust the scanner to 
whitelist the application.


Tell them to install Python from an official source, and then
distribute your application as a single .py (or .pyw) file. Problem
solved.

ChrisA

Thanks for the obvious suggestion, but if they have difficulty whitelisting the app then installing python is also 
probably beyond their abilities :( and I think it ought to be easier for the pyinstaller created executables to 'just work'.


The current exe works on very old versions of windows as well. Some people are reluctant to change old win 95/xp 
machines just to run a single app.


I had supposed there might be a simple mechanism to get these applications validated in some way, but it seems not. MS 
seems uninterested.

--
Robin Becker

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


Syntax Help

2020-06-10 Thread John Weller
Hi

 

I am trying to learn python.  Looking at an example on the web I found this
line:

 

def plot(*args, **kwargs):

 

What do the stars mean?

 

TIA

 

John Weller

01380 723235

07976 393631

 

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


repair modify uninstall

2020-06-10 Thread Silvia Aminul
   Hello

    

   I tried installing Python for windows 10 (the latest version of python for
   windows )

   And after downloading and trying to launch it keeps saying repair modify
   uninstall I tried looking for solution and it was suggested I might have
   downloaded python twice so I uninstalled python from the core (control
   panel )

   And tried installing python again however the same problems keep coming up
   (repair modify uninstall)

   Could you help me

   I’m not sure what I’m doing wrong

   Thank you in advance

   Silvia

    

    

   Sent from [1]Mail for Windows 10

    

References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyinstaller

2020-06-10 Thread Chris Angelico
On Thu, Jun 11, 2020 at 5:26 AM Robin Becker  wrote:
>
> On 10/06/2020 15:02, Chris Angelico wrote:
> 
> >>
> >> The intended users are unlikely to understand how to adjust the scanner to 
> >> whitelist the application.
> >
> > Tell them to install Python from an official source, and then
> > distribute your application as a single .py (or .pyw) file. Problem
> > solved.
> >
> > ChrisA
> >
> Thanks for the obvious suggestion, but if they have difficulty whitelisting 
> the app then installing python is also
> probably beyond their abilities :( and I think it ought to be easier for the 
> pyinstaller created executables to 'just work'.

Python can be installed from the app store, or from a python.org
downloader. If that's too much hassle for them, then they're going to
need help *whatever* you do.

> The current exe works on very old versions of windows as well. Some people 
> are reluctant to change old win 95/xp
> machines just to run a single app.

And a lot of us are reluctant to try to support XP. It's an operating
system that was released the same year as Python 2.2 - do you try to
support that? If not, why support an ancient OS?

> I had supposed there might be a simple mechanism to get these applications 
> validated in some way, but it seems not. MS
> seems uninterested.

And I can't blame them. How is MS going to know that you haven't
tampered with the Python binary before you packaged it up? How can end
users be expected to trust it?

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


Re: How to turn a defaultdict into a normal dict.

2020-06-10 Thread MRAB

On 2020-06-10 09:05, Antoon Pardon wrote:

The problem I face is that at the building face, I need a defaultdict
because the values are lists that are appended too. So a
defaultdict(list) is convenient in that new entries are treated as if
the value is an empty list.

However later when I actually use it, accessing a key that is not
present, should raise KeyError.

Is that somehow possible?


Pass the defaultdict to dict:

my_dict = defaultdict(list)
...
my_dict = dict(my_dict)
--
https://mail.python.org/mailman/listinfo/python-list


Re: repair modify uninstall

2020-06-10 Thread DL Neil via Python-list

On 10/06/20 11:26 PM, Silvia Aminul wrote:

I tried installing Python for windows 10 (the latest version of python for
windows )

And after downloading and trying to launch it keeps saying repair modify
uninstall I tried looking for solution and it was suggested I might have
downloaded python twice so I uninstalled python from the core (control
panel )


Please refer to the (extensive) Python documentation and advise if this 
page answers your question, or is insufficient for your purposes: 
https://docs.python.org/3/using/windows.html

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


Re: Turning pygame apps into add-ons

2020-06-10 Thread DL Neil via Python-list

On 11/06/20 1:32 AM, elisha hollander wrote:

I have a folder with my pygame apps, I want to build a program to have a
nice interface to access those apps from, I want it to be like an actual
computer, so, I need it to open the apps as rect of something not as
external apps.
Is there a way to do it without changing all the codes?
(I can import the app from the app file, but it won't open in the interface)



Exactly what you want is not clear - maybe a language-translation 
problem, and if so, please don't feel the need to apologise!


What do you mean by "actual computer"?

A rect[angle] is a basic shape for display in Pygame. Do you want the 
name of each app to appear inside a box?


Perhaps if you show us a portion of the code illustrating the import 
(and a portion of the code to be imported) - and then talk about what 
happened, and what you would prefer to be the result?
(remember that this list will only accept text-format attachments (no 
graphic screen-dumps!), so best to copy-paste code/results directly into 
the email message)

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


Re: Syntax Help

2020-06-10 Thread DL Neil via Python-list

On 11/06/20 4:56 AM, John Weller wrote:

I am trying to learn python.  Looking at an example on the web I found this
line:
def plot(*args, **kwargs):
What do the stars mean?



The Python "docs" are (surprisingly, for this day-and-age) 
comprehensive. Try https://docs.python.org/3/tutorial/controlflow.html 
and its several discussions about def[ining] functions and parameters.


Please also be aware that there is also a Python-Tutor Discussion List 
which has the specific objective of supporting learners (follow link, 
below).

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


Re: How to turn a defaultdict into a normal dict.

2020-06-10 Thread Peter Otten
Antoon Pardon wrote:

> The problem I face is that at the building face, I need a defaultdict
> because the values are lists that are appended too. So a
> defaultdict(list) is convenient in that new entries are treated as if
> the value is an empty list.
> 
> However later when I actually use it, accessing a key that is not
> present, should raise KeyError.
> 
> Is that somehow possible?

It never occured to me to try that, but:

>>> from collections import defaultdict
>>> d = defaultdict(list)
>>> d["x"]
[]
>>> d.default_factory = None
>>> d["y"]
Traceback (most recent call last):
  File "", line 1, in 
KeyError: 'y'


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


Re: Syntax Help

2020-06-10 Thread Terry Reedy

On 6/10/2020 12:56 PM, John Weller wrote:


I am trying to learn python.  Looking at an example on the web I found this
line:



def plot(*args, **kwargs):


This is function definition.


What do the stars mean?


The python docs have an index that has a Symbols page.
https://docs.python.org/3/genindex-Symbols.html
* and ** both have entries for 'function definition' which point to
https://docs.python.org/3/reference/compound_stmts.html#index-22

As a beginner, you might get more help from the tutorial, but the 
Symbols index is a way to find concise reminders for the different uses 
of different symbols.


--
Terry Jan Reedy

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


Re: repair modify uninstall

2020-06-10 Thread Michael Torrie
On 6/10/20 2:09 PM, DL Neil via Python-list wrote:
> On 10/06/20 11:26 PM, Silvia Aminul wrote:
>> I tried installing Python for windows 10 (the latest version of python 
>> for
>> windows )
>>
>> And after downloading and trying to launch it keeps saying repair modify
>> uninstall I tried looking for solution and it was suggested I might have
>> downloaded python twice so I uninstalled python from the core (control
>> panel )
> 
> Please refer to the (extensive) Python documentation and advise if this 
> page answers your question, or is insufficient for your purposes: 
> https://docs.python.org/3/using/windows.html

Since this comes up on a weekly basis, perhaps the installer should open
that web page to section 3.8.1 after a successful installation.  Maybe
users would read that short section and not try to run the installer
over and over again.  Or since that can be annoying, a prominent "how to
get started" link to click on.  I dunno.

I'm not sure why users think the installer is the python interpreter
after running it the first time, but apparently many do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: repair modify uninstall

2020-06-10 Thread Grant Edwards
On 2020-06-11, Michael Torrie  wrote:

> Since this comes up on a weekly basis, perhaps the installer should open
> that web page to section 3.8.1 after a successful installation.  Maybe
> users would read that short section and not try to run the installer
> over and over again.  Or since that can be annoying, a prominent "how to
> get started" link to click on.  I dunno.

Suggestions like this also get made regularly.  I'm baffled why the
Python installer doesn't display an initial screen that says something
like.

 This is the Python INSTALLER.  If you have installed Python,
 here's what you do to run it:



 Click the buttons below only if you want to INSTALL, UNINSTALL,
 or REPAIR Python. See the above instruction to use/run Python.

> I'm not sure why users think the installer is the python interpreter
> after running it the first time, but apparently many do.

Indeed.  Is the file name not clear that it's an installer?

--
Grant

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


Re: Syntax Help

2020-06-10 Thread Python

Le 10/06/2020 à 18:56, John Weller a écrit :

Hi

  


I am trying to learn python.  Looking at an example on the web I found this
line:

  


def plot(*args, **kwargs):

  


What do the stars mean?


That, respectively, positional arguments will be packed into a
sequence of references called args and that keywords argument
will be packed into a dictionary called kwargs.


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