Fwd: PROBLEM IN LAUNCHING PYTHON...

2019-01-08 Thread Arshad Zama
-- Forwarded message -
From: Arshad Zama 
Date: Thu, Jan 3, 2019 at 10:27 PM
Subject: PROBLEM IN LAUNCHING PYTHON...
To: 


HELLO SIR,
I'm facing some issue while launching the python ide on windows 8.1 pro.
Kindly help me!!...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Peter Otten
Tim Chase wrote:

>   def all_equal(iterable):
> i = iter(iterable)
> first = next(i)
> return all(x == first for x in i)
> 
> It's undefined for an empty list (well, it throws a StopIteration
> but you can special-case that), but should hand the cases with
> 1 element and 2+ elements (both matching and where any item is not
> the same). It should work on an iterator as well but will consume the
> items in the process.
> 
> And I even like how nicely it reads :-)

If that's why you omitted the try...except use

first = next(i, None)

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


Re: Are all items in list the same?

2019-01-08 Thread Peter Otten
Bob van der Poel wrote:

> I need to see if all the items in my list are the same. I was using set()
> for this, but that doesn't work if items are themselves lists. So,
> assuming that a is a list of some things, the best I've been able to come
> up with it:
> 
> if a.count( targ ) == len(a):
> 
> I'm somewhat afraid that this won't scale all that well. Am I missing
> something?

a[1:] == a[:-1]

:)

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


EuroPython 2019: Kicking off the organization

2019-01-08 Thread M.-A. Lemburg
Today, we’re happy to announce our pre-launch website under the
official EuroPython 2019 URL:


  * https://ep2019.europython.eu/ *


Dates and Venues


EuroPython will be held from July 8-14 2019 in Basel, Switzerland, at
the Congress Center Basel (BCC) for the main conference days (Wed-Fri)
and the FHNW Muttenz for the workshops/trainings/sprints days
(Mon-Tue, Sat-Sun):

https://www.congress.ch/en-US.aspx
https://www.fhnw.ch/de/die-fhnw/standorte/muttenz

We will continue to list information on the FAQ & Info page as it
becomes available:

https://ep2019.europython.eu/faq



Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://www.europython-society.org/post/181832657135/europython-2019-kicking-off-the-organization

Tweet:

https://twitter.com/europythons/status/1082564855188602880


Thank you,
--
EuroPython Society
https://www.europython-society.org/

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


The following modules appear to be missing ['_sysconfigdata']

2019-01-08 Thread dude . jimbo
Hello,

first time using python groups (and long time since using any other group for 
that matter). This might not be the right group due to wx being involved.

Long story as short as possible. I have an old python script that I did ~10 
years ago, and have forgotten basically everything about Python since then 
(sorry!). Converted it to EXE way back when, and have kept using the EXE ever 
since then (on XP, and on Win7).

I've just gotten a new PC, Windows10 (!), needed to update the script, so 
needed to recompile the EXE, and now it no longer compiles/works. It was fine 
on Windows7 (I'm not specifically stating that the problem is with windows10 - 
I simply don't remember all the hoops I jumped through on my previous machine).

Here is the compile error:
The following modules appear to be missing
['_sysconfigdata']

And here is the runtime error:
Traceback (most recent call last):
  File "AutoArchive.py", line 3, in 
  File "wx\__init__.pyc", line 45, in 
  File "wx\_core.pyc", line 4, in 
  File "wx\_core_.pyc", line 12, in 
  File "wx\_core_.pyc", line 10, in __load
ImportError: DLL load failed: %1 is not a valid Win32 application.

Here is how I compile: python setup.py py2exe

And this is my setup.py:
from distutils.core import setup
import py2exe

setup(console=['AutoArchive.py'])

Yes, that says 'console' for a Windows EXE, but swapping it to 'window' didn't 
help. Besides which, the setup.py file is straight from the old computer, so 
'it used to work'.

What I have installed:
. python 2.7.13 (this in itself may be a problem - I don't even remember which 
version I was using earlier, other than knowing for sure it wasn't a 3.x 
release)
. wxpython  (since I also got an error that wx module was missing - that rang 
some bells, since the script uses a Windows pop-up window to inform me about 
its progress, and I remember using wx for that, so I installed it, but don't 
know how to get its' version. using "python -c "import wx;print wx.__version__" 
just gives runtime errors).

Any help would be appreciated.

And yes, I googled, but can't really find anything (well, d'Uh!, I wouldn’t be 
here then would I?) - there's ~some~ references, but usually it's about similar 
issues on Linux, with solutions that are not applicable at all. Except one I 
thought: I found some link stating that _sysconfigdata is part of sysconfig, 
and that this needed to be installed with pip, so I used the pip that came with 
my python distro and did 'pip install [[_]sys]config[data]' (all possible 
combo's) but pip claims it can't find said module, and TBH, I can't seem to 
find anything myself about said module.

Thx,
Jimbo
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: PROBLEM IN LAUNCHING PYTHON...

2019-01-08 Thread Rhodri James

On 08/01/2019 08:29, Arshad Zama wrote:

-- Forwarded message -
From: Arshad Zama
Date: Thu, Jan 3, 2019 at 10:27 PM
Subject: PROBLEM IN LAUNCHING PYTHON...
To:


HELLO SIR,
I'm facing some issue while launching the python ide on windows 8.1 pro.
Kindly help me!!...


What exactly is the problem?  If you sent a screenshot or similar 
attachment, I'm afraid the mailing list will have stripped that off. 
Please describe what you have done and what is going wrong, preferably 
cutting and pasting error messages rather than retyping them.  I'm not a 
Windows expert, but others here may be able to help if you give them 
enough information.


(The temptation to say "Installing Linux will fix most of your problems" 
is strong :-)


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Serhiy Storchaka

08.01.19 11:07, Peter Otten пише:

Bob van der Poel wrote:


I need to see if all the items in my list are the same. I was using set()
for this, but that doesn't work if items are themselves lists. So,
assuming that a is a list of some things, the best I've been able to come
up with it:

 if a.count( targ ) == len(a):

I'm somewhat afraid that this won't scale all that well. Am I missing
something?


a[1:] == a[:-1]

:)



Very clever! It is definitely the shortest solution.

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


Re: Kivy native GUI examples

2019-01-08 Thread Mario R. Osorio
On Monday, January 7, 2019 at 9:52:03 AM UTC-5, Dave wrote:
> I need to select a Python GUI.  It needs to cover all of the desktops 
> (Linux, Windows, Apple) and hopefully mobile (Android and Ios).  I'm 
> looking at Kivy, but have yet to find an example app. that has a native 
> looking GUI (Windows, Mac, Linux/Gnome/KDE).  Is that possible and 
> anyone know of some examples?
> 
> Thanks,
> Dave

You might want to take a look into this project: BeeWare (https://pybee.org/)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Scons-users] SCons Version 3.0.3 Released

2019-01-08 Thread Ryan Schmidt



On Jan 7, 2019, at 21:26, Bill Deegan wrote:

>   A new SCons release, 3.0.3, is now available on the SCons download page:
> 
>   https://scons.org/pages/download.html
> 
> 
>   Here is a summary of the changes since 3.0.1:

It would have been good to mention the changes since 3.0.2, which are:


RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400
  NOTE: 3.0.2 release was dropped because there was a packaging bug. Please 
consider all 3.0.2
content.

  From William Deegan:

- Fixes to packaging logic.  Ensuring the SCons.Tool.clangCommon module is 
added
  to the release packages.
- Modify scons.bat script to check for scons python script without .py 
extension if no file
  scons.py exists. This enables an all platform wheel to work.

  From Mats Wichmann:
- Update doc examples to work with Python 3.5+:  map() now returns an 
iterable instead of a list.


See https://github.com/SCons/scons/blob/rel_3.0.3/src/CHANGES.txt

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


Re: Are all items in list the same?

2019-01-08 Thread Neil Cerutti
On 2019-01-08, MRAB  wrote:
> On 2019-01-08 00:47, [email protected] wrote:
>> You might do something like
>> 
>>  if len(a) == 0 or all(i == a[0] for i in a[1:]):
>> 
> You don't need to check the length of the list because if the list is 
> empty, 'all' will return True anyway.

Neat! I expected that a[0] would be executed in that case,
but it is not.

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


Re: Are all items in list the same?

2019-01-08 Thread Bob van der Poel
Thanks guys for the help on this. As it turns out I have learned new
commands as a result of the question: all() and any() will work perfectly!
The other solutions, as always, are enlightening. And, no, Chris, this is
not homework :)

On Tue, Jan 8, 2019 at 9:31 AM Neil Cerutti  wrote:

> On 2019-01-08, MRAB  wrote:
> > On 2019-01-08 00:47, [email protected] wrote:
> >> You might do something like
> >>
> >>  if len(a) == 0 or all(i == a[0] for i in a[1:]):
> >>
> > You don't need to check the length of the list because if the list is
> > empty, 'all' will return True anyway.
>
> Neat! I expected that a[0] would be executed in that case,
> but it is not.
>
> --
> Neil Cerutti
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

 Listen to my FREE CD at http://www.mellowood.ca/music/cedars 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: [email protected]
WWW:   http://www.mellowood.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Alister via Python-list
On Tue, 08 Jan 2019 16:48:58 +0200, Serhiy Storchaka wrote:

> 08.01.19 11:07, Peter Otten пише:
>> Bob van der Poel wrote:
>> 
>>> I need to see if all the items in my list are the same. I was using
>>> set()
>>> for this, but that doesn't work if items are themselves lists. So,
>>> assuming that a is a list of some things, the best I've been able to
>>> come up with it:
>>>
>>>  if a.count( targ ) == len(a):
>>>
>>> I'm somewhat afraid that this won't scale all that well. Am I missing
>>> something?
>> 
>> a[1:] == a[:-1]
>> 
>> :)
>> 
>> 
> Very clever! It is definitely the shortest solution.

would that still not return true if the list was a palindrome?



-- 
Every young man should have a hobby: learning how to handle money is
the best one.
-- Jack Hurley
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Alister via Python-list
On Tue, 08 Jan 2019 17:15:17 +, Alister wrote:

> On Tue, 08 Jan 2019 16:48:58 +0200, Serhiy Storchaka wrote:
> 
>> 08.01.19 11:07, Peter Otten пише:
>>> Bob van der Poel wrote:
>>> 
 I need to see if all the items in my list are the same. I was using
 set()
 for this, but that doesn't work if items are themselves lists. So,
 assuming that a is a list of some things, the best I've been able to
 come up with it:

  if a.count( targ ) == len(a):

 I'm somewhat afraid that this won't scale all that well. Am I missing
 something?
>>> 
>>> a[1:] == a[:-1]
>>> 
>>> :)
>>> 
>>> 
>> Very clever! It is definitely the shortest solution.
> 
> would that still not return true if the list was a palindrome?
ignore me, just tried & ok




-- 
I'm not proud.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendations for a novice user.

2019-01-08 Thread Mario R. Osorio
On Wednesday, January 2, 2019 at 1:05:44 PM UTC-5, Hüseyin Ertuğrul wrote:
> I don't know the software language at all. What do you recommend to beginners 
> to learn Python.
> What should be the working systematic? How much time should I spend every day 
> or how much time should I spend on a daily basis.
> 
> Is there any such systematic implementation and success?
> 
>   İyi Çalışmalar...
>   Hüseyin ERTUGRUL
>   Teknik Servis Müdürü
>   Piramit Bilgisayar & Teknoloji
>   Sis. San. Tic. Ltd. Şti
> 
> 
> 
>   TEL:212-480 0 660
>   FAX:212-544 66 95
>   MOBILE:   543-328 68 15
>   E-MAİL:[email protected]
>   HTTP:  www.piramit.com.tr
> 
>   Topkapı-Maltepe cad.
>   Canayakın İş Merkezi
>   B/Blok No:11
>   Bayrampaşa/ İstanbul 34030 TURKIYE
> 
>   P Bu dokümanı yazıcıya göndermeden önce lütfen kağıt üretimi için kesilen 
> ağaçları bir kez daha düşünün!

I have bought a few courses from udemy (https://www.udemy.com/) on different 
matters. They are not necessarily the best but for $10 a course you are really 
getting your money's worth and in my experience, some of these courses are a 
great start.

In reviewing this courses, those by Jose Portilla are the best. The guy is a 
python professional. Of course, there are others.

Once you get acquainted with the language and the community (which is not 
perfect but still the best I've ever found); you will be able to discern your 
next steps

Good luck!

P.D.: I have not relationship or connection to udemy, other than being a 
satisfied customer
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread ike
On Tue, Jan 08, 2019 at 01:05:09PM +1100, Chris Angelico wrote:
> No, because the iteration would never happen. If the list is empty,
> a[1:] is also empty, and i==a[0] will never be evaluated. So it is
> safe. (But I agree that it's not instantly obvious.)

Oh yeah, you're right. I overthought it too much. :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Tobiah

On 1/8/19 9:20 AM, Alister wrote:

On Tue, 08 Jan 2019 17:15:17 +, Alister wrote:


On Tue, 08 Jan 2019 16:48:58 +0200, Serhiy Storchaka wrote:


08.01.19 11:07, Peter Otten пише:

Bob van der Poel wrote:


I need to see if all the items in my list are the same. I was using
set()
for this, but that doesn't work if items are themselves lists. So,
assuming that a is a list of some things, the best I've been able to
come up with it:

  if a.count( targ ) == len(a):

I'm somewhat afraid that this won't scale all that well. Am I missing
something?


a[1:] == a[:-1]

:)



Very clever! It is definitely the shortest solution.


would that still not return true if the list was a palindrome?

ignore me, just tried & ok






You were right the first time.  The above comparison should have been

a == a[::-1]

A palindrome will pass.


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


Re: Are all items in list the same?

2019-01-08 Thread Dan Sommers

On 1/8/19 2:31 PM, Tobiah wrote:> On 1/8/19 9:20 AM, Alister wrote:
>> On Tue, 08 Jan 2019 17:15:17 +, Alister wrote:
>>
>>> On Tue, 08 Jan 2019 16:48:58 +0200, Serhiy Storchaka wrote:
>>>
 08.01.19 11:07, Peter Otten пише:
> Bob van der Poel wrote:
>
>> I need to see if all the items in my list are the same. I was using
>> set()
>> for this, but that doesn't work if items are themselves lists. So,
>> assuming that a is a list of some things, the best I've been able to
>> come up with it:
>>
>>   if a.count( targ ) == len(a):
>>
>> I'm somewhat afraid that this won't scale all that well. Am I 
missing

>> something?
>
> a[1:] == a[:-1]
>
> :)
>
>
 Very clever! It is definitely the shortest solution.
>>>
>>> would that still not return true if the list was a palindrome?
>> ignore me, just tried & ok
>>
>
> You were right the first time.  The above comparison should have been
>
>  a == a[::-1]
>
> A palindrome will pass.

Let's find out (vertical space added for clarity):

Python 3.7.2 (default, Dec 29 2018, 21:15:15)
[GCC 8.2.1 20181127] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> a = [1, 1, 1, 1, 1]
>>> a[1:] == a[:-1]
True
>>> a == a[::-1]
True

>>> a = [1, 2, 3, 4, 3, 2, 1]
>>> a[1:] == a[:-1]
False
>>> a == a[::-1]
True

Looks like Peter's pretty clever after all.  :-)

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


Re: Are all items in list the same?

2019-01-08 Thread Cameron Simpson

On 08Jan2019 15:28, Dan Sommers <[email protected]> wrote:

   >>> a = [1, 1, 1, 1, 1]
   >>> a[1:] == a[:-1]
   True
   >>> a == a[::-1]
   True

   >>> a = [1, 2, 3, 4, 3, 2, 1]
   >>> a[1:] == a[:-1]
   False
   >>> a == a[::-1]
   True

Looks like Peter's pretty clever after all.  :-)


Except that his solution always scans then entire list. Twice.

For large dissimilar lists this gets needlessly expensive in a linear 
fashion with the length of the list.


It is succinct, but wasteful.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Karen Shaeffer
On 08Jan2019 15:28, Dan Sommers <[email protected]> wrote:

>>>>> a = [1, 1, 1, 1, 1]

>>>>> a[1:] == a[:-1]

>>True

>>>>> a == a[::-1]

>>True

>>

>>>>> a = [1, 2, 3, 4, 3, 2, 1]

>>>>> a[1:] == a[:-1]

>>False

>>>>> a == a[::-1]

>>True

>>

>> Looks like Peter's pretty clever after all.  :-)

>

> Except that his solution always scans then entire list. Twice.

>

> For large dissimilar lists this gets needlessly expensive in a linear
fashion

> with the length of the list.

>

> It is succinct, but wasteful.

>

I ran it with the timeit module for the specific case of a list:


tlst = [True for _j in range(int(1e8))]


# Very fast.

# all_equal(tlst) times = [9.820610110182315e-07, 9.798338289838284e-07,
9.83037088997662e-07,

#  9.824190249200911e-07] seconds.

def all_equal(alist) -> bool:

if len(alist) == 0 or all(i == a[0] for i in a[1:]):

return True

return False


# The variant: if alist == alist[::-1]:

# actually has a memory leak. And I eventually killed the process after
waiting about

# ten minutes, while watching the memory leak.

#

# This variant doesn't have a memory leak. I'm still waiting after 15
minutes. Might give up

# on it. The other solution is the way to go.

def all_equal_array_list(alist) -> bool:

if alist == alist[:-1]:

return True

return False


if __name__ == '__main__':

tae =
timeit.repeat(timeit_all_equal,repeat=4,number=100,globals=globals())

print(f"all_equal(tlst) times = {[_t/1e6 for _t in tae]} seconds.\n")


taeal =
timeit.repeat(timeit_all_equal_array_list,repeat=4,number=100,globals=globals())

print(f"all_equal_array_list(tlst) times = {[_t/1e6 for _t in taeal]}
seconds.\n")
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Karen Shaeffer
There were some issues with my test. After sending the email, I thought

those times couldn't be real. Here are better results:


all_equal(tlst) times = [6.719925760501064e-05] seconds.


all_equal_array_list(tlst) times = [4.2184268278069794e-06] seconds.


import timeit


def all_equal(alist) -> bool:

if len(alist) == 0 or all(i == alist[0] for i in alist[1:]):

return True

return False


def all_equal_array_list(alist) -> bool:

if alist == alist[:-1]:

return True

return False


tlst = [42 for _j in range(5000)]


def timeit_all_equal() -> bool:

return all_equal(tlst)


def timeit_all_equal_array_list() -> bool:

return all_equal_array_list(tlst)


if __name__ == '__main__':

tae =
timeit.repeat(timeit_all_equal,repeat=2,number=100,globals=globals())

print(f"all_equal(tlst) times = {[_t/1e6 for _t in tae]} seconds.\n")


taeal =
timeit.repeat(timeit_all_equal_array_list,repeat=2,number=100,globals=globals())

print(f"all_equal_array_list(tlst) times = {[_t/1e6 for _t in taeal]}
seconds.\n")

On Tue, Jan 8, 2019 at 3:11 PM Karen Shaeffer  wrote:

> On 08Jan2019 15:28, Dan Sommers <[email protected]>
> wrote:
>
> >>>>> a = [1, 1, 1, 1, 1]
>
> >>>>> a[1:] == a[:-1]
>
> >>True
>
> >>>>> a == a[::-1]
>
> >>True
>
> >>
>
> >>>>> a = [1, 2, 3, 4, 3, 2, 1]
>
> >>>>> a[1:] == a[:-1]
>
> >>False
>
> >>>>> a == a[::-1]
>
> >>True
>
> >>
>
> >> Looks like Peter's pretty clever after all.  :-)
>
> >
>
> > Except that his solution always scans then entire list. Twice.
>
> >
>
> > For large dissimilar lists this gets needlessly expensive in a linear
> fashion
>
> > with the length of the list.
>
> >
>
> > It is succinct, but wasteful.
>
> >
>
> I ran it with the timeit module for the specific case of a list:
>
>
> tlst = [True for _j in range(int(1e8))]
>
>
> # Very fast.
>
> # all_equal(tlst) times = [9.820610110182315e-07, 9.798338289838284e-07,
> 9.83037088997662e-07,
>
> #  9.824190249200911e-07] seconds.
>
> def all_equal(alist) -> bool:
>
> if len(alist) == 0 or all(i == a[0] for i in a[1:]):
>
> return True
>
> return False
>
>
> # The variant: if alist == alist[::-1]:
>
> # actually has a memory leak. And I eventually killed the process after
> waiting about
>
> # ten minutes, while watching the memory leak.
>
> #
>
> # This variant doesn't have a memory leak. I'm still waiting after 15
> minutes. Might give up
>
> # on it. The other solution is the way to go.
>
> def all_equal_array_list(alist) -> bool:
>
> if alist == alist[:-1]:
>
> return True
>
> return False
>
>
> if __name__ == '__main__':
>
> tae =
> timeit.repeat(timeit_all_equal,repeat=4,number=100,globals=globals())
>
> print(f"all_equal(tlst) times = {[_t/1e6 for _t in tae]} seconds.\n")
>
>
> taeal =
> timeit.repeat(timeit_all_equal_array_list,repeat=4,number=100,globals=globals())
>
> print(f"all_equal_array_list(tlst) times = {[_t/1e6 for _t in taeal]}
> seconds.\n")
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-08 Thread Matthew Lemon
Hi,

I would start from scratch with this.

1. You have latest Python 2 version.
2. Use virtualenv to create and activate a new virtual environment.
3. pip install wxPython and other dependencies.
4. Get your application running from the command line first and follow up any 
DLL exceptions.
5. Use pyinstaller (https://pyinstaller.readthedocs.io/en/stable/) to create a 
new exe file once you know everything works. 

Matt

On 8 January 2019 10:38:16 GMT, [email protected] wrote:
>Hello,
>
>first time using python groups (and long time since using any other
>group for that matter). This might not be the right group due to wx
>being involved.
>
>Long story as short as possible. I have an old python script that I did
>~10 years ago, and have forgotten basically everything about Python
>since then (sorry!). Converted it to EXE way back when, and have kept
>using the EXE ever since then (on XP, and on Win7).
>
>I've just gotten a new PC, Windows10 (!), needed to update the script,
>so needed to recompile the EXE, and now it no longer compiles/works. It
>was fine on Windows7 (I'm not specifically stating that the problem is
>with windows10 - I simply don't remember all the hoops I jumped through
>on my previous machine).
>
>Here is the compile error:
>The following modules appear to be missing
>['_sysconfigdata']
>
>And here is the runtime error:
>Traceback (most recent call last):
>  File "AutoArchive.py", line 3, in 
>  File "wx\__init__.pyc", line 45, in 
>  File "wx\_core.pyc", line 4, in 
>  File "wx\_core_.pyc", line 12, in 
>  File "wx\_core_.pyc", line 10, in __load
>ImportError: DLL load failed: %1 is not a valid Win32 application.
>
>Here is how I compile: python setup.py py2exe
>
>And this is my setup.py:
>from distutils.core import setup
>import py2exe
>
>setup(console=['AutoArchive.py'])
>
>Yes, that says 'console' for a Windows EXE, but swapping it to 'window'
>didn't help. Besides which, the setup.py file is straight from the old
>computer, so 'it used to work'.
>
>What I have installed:
>. python 2.7.13 (this in itself may be a problem - I don't even
>remember which version I was using earlier, other than knowing for sure
>it wasn't a 3.x release)
>. wxpython  (since I also got an error that wx module was missing -
>that rang some bells, since the script uses a Windows pop-up window to
>inform me about its progress, and I remember using wx for that, so I
>installed it, but don't know how to get its' version. using "python -c
>"import wx;print wx.__version__" just gives runtime errors).
>
>Any help would be appreciated.
>
>And yes, I googled, but can't really find anything (well, d'Uh!, I
>wouldn’t be here then would I?) - there's ~some~ references, but
>usually it's about similar issues on Linux, with solutions that are not
>applicable at all. Except one I thought: I found some link stating that
>_sysconfigdata is part of sysconfig, and that this needed to be
>installed with pip, so I used the pip that came with my python distro
>and did 'pip install [[_]sys]config[data]' (all possible combo's) but
>pip claims it can't find said module, and TBH, I can't seem to find
>anything myself about said module.
>
>Thx,
>Jimbo
>-- 
>https://mail.python.org/mailman/listinfo/python-list

-- 
Sent from my Android device
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are all items in list the same?

2019-01-08 Thread Karen Shaeffer
There was one more error. (smiles ;) Fixed below

def all_equal_array_list(alist) -> bool:

if alist[1:] == alist[:-1]:

return True

return False

def all_equal(alist) -> bool:

if len(alist) == 0 or all(i == alist[0] for i in alist[1:]):

return True

return False

all_equal(tlst) times = [1.3971288939937949e-05] seconds.

all_equal_array_list(tlst) times = [2.3801841149106623e-06] seconds.



Karen.

On Tue, Jan 8, 2019 at 9:01 PM Karen Shaeffer  wrote:

> There were some issues with my test. After sending the email, I thought
>
> those times couldn't be real. Here are better results:
>
>
> all_equal(tlst) times = [6.719925760501064e-05] seconds.
>
>
> all_equal_array_list(tlst) times = [4.2184268278069794e-06] seconds.
>
>
> import timeit
>
>
> def all_equal(alist) -> bool:
>
> if len(alist) == 0 or all(i == alist[0] for i in alist[1:]):
>
> return True
>
> return False
>
>
> def all_equal_array_list(alist) -> bool:
>
> if alist == alist[:-1]:
>
> return True
>
> return False
>
>
> tlst = [42 for _j in range(5000)]
>
>
> def timeit_all_equal() -> bool:
>
> return all_equal(tlst)
>
>
> def timeit_all_equal_array_list() -> bool:
>
> return all_equal_array_list(tlst)
>
>
> if __name__ == '__main__':
>
> tae =
> timeit.repeat(timeit_all_equal,repeat=2,number=100,globals=globals())
>
> print(f"all_equal(tlst) times = {[_t/1e6 for _t in tae]} seconds.\n")
>
>
> taeal =
> timeit.repeat(timeit_all_equal_array_list,repeat=2,number=100,globals=globals())
>
> print(f"all_equal_array_list(tlst) times = {[_t/1e6 for _t in taeal]}
> seconds.\n")
>
> On Tue, Jan 8, 2019 at 3:11 PM Karen Shaeffer 
> wrote:
>
>> On 08Jan2019 15:28, Dan Sommers <[email protected]>
>> wrote:
>>
>> >>>>> a = [1, 1, 1, 1, 1]
>>
>> >>>>> a[1:] == a[:-1]
>>
>> >>True
>>
>> >>>>> a == a[::-1]
>>
>> >>True
>>
>> >>
>>
>> >>>>> a = [1, 2, 3, 4, 3, 2, 1]
>>
>> >>>>> a[1:] == a[:-1]
>>
>> >>False
>>
>> >>>>> a == a[::-1]
>>
>> >>True
>>
>> >>
>>
>> >> Looks like Peter's pretty clever after all.  :-)
>>
>> >
>>
>> > Except that his solution always scans then entire list. Twice.
>>
>> >
>>
>> > For large dissimilar lists this gets needlessly expensive in a linear
>> fashion
>>
>> > with the length of the list.
>>
>> >
>>
>> > It is succinct, but wasteful.
>>
>> >
>>
>> I ran it with the timeit module for the specific case of a list:
>>
>>
>> tlst = [True for _j in range(int(1e8))]
>>
>>
>> # Very fast.
>>
>> # all_equal(tlst) times = [9.820610110182315e-07, 9.798338289838284e-07,
>> 9.83037088997662e-07,
>>
>> #  9.824190249200911e-07] seconds.
>>
>> def all_equal(alist) -> bool:
>>
>> if len(alist) == 0 or all(i == a[0] for i in a[1:]):
>>
>> return True
>>
>> return False
>>
>>
>> # The variant: if alist == alist[::-1]:
>>
>> # actually has a memory leak. And I eventually killed the process after
>> waiting about
>>
>> # ten minutes, while watching the memory leak.
>>
>> #
>>
>> # This variant doesn't have a memory leak. I'm still waiting after 15
>> minutes. Might give up
>>
>> # on it. The other solution is the way to go.
>>
>> def all_equal_array_list(alist) -> bool:
>>
>> if alist == alist[:-1]:
>>
>> return True
>>
>> return False
>>
>>
>> if __name__ == '__main__':
>>
>> tae =
>> timeit.repeat(timeit_all_equal,repeat=4,number=100,globals=globals())
>>
>> print(f"all_equal(tlst) times = {[_t/1e6 for _t in tae]} seconds.\n")
>>
>>
>> taeal =
>> timeit.repeat(timeit_all_equal_array_list,repeat=4,number=100,globals=globals())
>>
>> print(f"all_equal_array_list(tlst) times = {[_t/1e6 for _t in taeal]}
>> seconds.\n")
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list