Re: Error

2020-12-07 Thread Michael Torrie
On 12/7/20 11:07 AM, Barry Fitzgerald wrote:
> I did the pip install I did the pip install pygameThe pip install
> pgzero I get this error C:\Users\barol>pip install pgzeroDefaulting
> to user installation because normal site-packages is not
> writeableCollecting pgzero  Using cached pgzero-1.2-py3-none-any.whl
> (69 kB)Collecting numpy  Using cached
> numpy-1.19.4-cp39-cp39-win_amd64.whl (13.0 MB)Collecting
> pygame<2.0,>=1.9.2  Using cached pygame-1.9.6.tar.gz (3.2 MB)
> ERROR: Command errored out with exit status 1: command:
> 'c:\program files\python39\python.exe' -c 'import sys, setuptools,
> tokenize; sys.argv[0] =
> '"'"'C:\\Users\\barol\\AppData\\Local\\Temp\\pip-install-loo9yev7\\pygame_5aee70f17f294e14b6187b13f07afa31\\setup.py'"'"';
> __file__='"'"'C:\\Users\\barol\\AppData\\Local\\Temp\\pip-install-loo9yev7\\pygame_5aee70f17f294e14b6187b13f07afa31\\setup.py'"'"';f=getattr(tokenize,
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
> '"'"'\n'"'"');f.close();exec(compile(code, __file__,
> '"'"'exec'"'"'))' egg_info --egg-base
> 'C:\Users\barol\AppData\Local\Temp\pip-pip-egg-info-rdmw_7gl'
> cwd:
> C:\Users\barol\AppData\Local\Temp\pip-install-loo9yev7\pygame_5aee70f17f294e14b6187b13f07afa31\
> Complete output (17 lines):
> 
> WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
> Using WINDOWS configuration...
The problem is there is no pre-compiled PyGame Zero package yet for
Python 3.9.  So your system is trying to compile it from source.
Probably your best bet is to remove Python 3.9 and install Python 3.8.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error

2020-12-06 Thread Michael Torrie
On 12/5/20 11:41 AM, Barry Fitzgerald via Python-list wrote:
> Good day,"
> 
> I purchased a book for my son and followed the directions to a T.
> (Coding Games in Python) Whenever I got to the point of of moving the
> "hello" file over to pgzrun is where my trouble began. Its not
> finding a path because I'm getting this "pgzrun is not recognized as
> an internal or external command".
> 
> I've uninstall reinstall and tried to trouble shoot offline.  I'
> believe its a "path" issue but that is a little over my head.  At
> least this is what I've read.  Yes I selected all users and the
> variables options on custom install.
Looks to me like you have to do two things to get PyGame Zero going on
Windows.  First, install the latest stable Python 3 from python.org.  Be
sure to tell the installer to put Python in the system path so you can
get to it from the command prompt.

Second, from a command prompt, run:

py -m pip install pgzero

And then you must put the location pgzrun.exe in your path.  See below.

For example this is what you'd see:
C:\Users\torriem>py -m pip install pgzero
Collecting pgzero
  Using cached
https://files.pythonhosted.org/packages/48/e5/e5f14292373cb5fc7539aa01307b184c1e3c954d68945d8c44778669dd82/pgzero-1.2-py3-none-any.whl
Collecting numpy (from pgzero)
  Using cached
https://files.pythonhosted.org/packages/40/db/5060f18b0116f00ee73f8365efc9c95bd5496946290b0e7c97b6ee89dffe/numpy-1.19.4-cp38-cp38-win_amd64.whl
Collecting pygame<2.0,>=1.9.2 (from pgzero)
  Using cached
https://files.pythonhosted.org/packages/a8/1e/5da797179ce046decc7d6d57a9b1977218103ccfb099b959b7736aff5f73/pygame-1.9.6-cp38-cp38-win_amd64.whl
Installing collected packages: numpy, pygame, pgzero
  WARNING: The script f2py.exe is installed in
'C:\Users\torriem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts'
which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress
this warning, use --no-warn-script-location.
  WARNING: The script pgzrun.exe is installed in
'C:\Users\torriem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts'
which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress
this warning, use --no-warn-script-location.
Successfully installed numpy-1.19.4 pgzero-1.2 pygame-1.9.6
WARNING: You are using pip version 19.2.3, however version 20.3.1 is
available.
You should consider upgrading via the 'python -m pip install --upgrade
pip' command.

Note the WARNINGs about the scripts and path. You'll want to take that
directory (which will be different on your machine) and add that to the
path.  See
https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/
for an example of how to do that.

In my case, the path I need to add is
C:\Users\torriem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts

After that, pgzrun should run as the book says it will.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error

2020-12-06 Thread Michael Torrie
On 12/5/20 11:41 AM, Barry Fitzgerald via Python-list wrote:
> Good day,"
> 
> I purchased a book for my son and followed the directions to a T. (Coding 
> Games in Python)
> Whenever I got to the point of of moving the "hello" file over to pgzrun is 
> where my trouble began.
> Its not finding a path because I'm getting this "pgzrun is not recognized as 
> an internal or external command".
> 
> I've uninstall reinstall and tried to trouble shoot offline.  I' believe its 
> a "path" issue but that is a little over my head.  At least this is what I've 
> read.  Yes I selected all users and the variables options on custom install.

I think you're referring to PyGame Zero.  Where did you download the
installer from?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: GUI: I am also looking for a nudge into the best (GUI) direction.

2020-10-31 Thread Michael Torrie
On 10/31/20 5:42 PM, Greg Ewing wrote:
> On 1/11/20 9:44 am, Barry Scott wrote:
> 
>> It does not appear to me that use native widgets is important for a tool kit.
> 
> It's not strictly necessary. However, recreating the exact appearance
> and behaviour of native widgets is a lot of work, and difficult to do
> well -- most toolkits that attempt this don't manage to get all the
> details exactly right.
> 
> Moreover, a lot of maintenance effort is needed to keep up with
> changes to the native widgets which frequently happen with OS updates.
> And even if the toolkit is kept up to date, you need to install a
> new version of the toolkit when changes occur.

Maybe. However it seems like this is the route nearly everyone takes
these days, include MS themselves. See below.

> On the other hand, if the toolkit wraps the platform's native widgets,
> it gets all the correct appearance and behaviour, and automatically
> tracks changes.
> 
> For these reasons I regard "uses native widgets" as a mark of quality
> for a toolkit.

In C# world, WinForms is often used, but it's not "native" win32
widgets.  Widgets are implemented in managed code (according to
Wikipedia) that draw themselves using the theming dll so they look
native, or at least look somewhat consistent with regards to button
styles, fonts, colors, etc.

With the introduction of UWP apps, "native" has further lost meaning.
Going forward, perhaps MS intends UWP to be the new native. I don't know
and I'm not sure MS knows.

MS Office hasn't used native win32 widgets for many years now (since
Office 2000 I think, perhaps before).  In fact I know of very few
Windows applications that use exclusively the basic native widget set
from win32.  Nearly all apps use some kind of GUI framework, from MS or
elsewhere, that implement their own widgets, often using the Theming
system to draw them and get the colors right.  Some apps don't even
bother trying to look native--and yes those tend to be low-quality apps
like antivirus programs.  Shudder.

I think notepad.exe, regedit.exe, etc, are probably the only apps I've
used recently that actually use "native" win32 widgets.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: GUI (tkinter) popularity and job prospects for

2020-10-22 Thread Michael Torrie
On 10/22/20 12:58 PM, Lammie Jonson wrote:
> 
> I have been a rails developer as well as JS/react. I had wanted to
> look at python a bit due to it's popularity.
> 
> I looked at tkinter which seems to have quite a few examples out
> there, but when I searched indeed.com for tkinter and wxpython it
> appeared that there was hardly any job listings mentioning those. Why
> is that ? It's a bit of a demotivating factor to get very serious
> with tk etc. 

I doubt you'll find any jobs connected a particular Python GUI toolkit.
Except maybe at Red Hat. Most likely you'll find Python used in web app
development, back-end server system programming, scripting, etc.

Of course Python can be used with a variety of GUI toolkits including
Tk, wx, GTK+, and Qt, to make desktop applications of course, but it's
not commercially common and I wouldn't ever expect to see that on a job
posting.

> I was going to look at something like tensorflow perhaps, though I am
> not sure if machine learning is that easy to pickup or not

Not sure anything difficult and worthwhile, even if it is popular and in
demand, is something you can just "[easily] pick up."  But good luck to
you.  If you can find some fun side projects to do with with it while
gaining experience, I'm sure that will look good on a resume.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with the best practice to learn python

2020-10-19 Thread Michael Torrie
On 10/19/20 9:12 AM, Azhar Ansari wrote:
> Hello Python Community,
> Kindly help me with the best practice to learn python.
> Lots of material over net but its very confusing.

What is your goal?  Python is a tool.  What do you want to do with it?
If you don't have any particular thing in mind, it's much harder to
learn any language.  But of course if you don't have anything particular
in mind, you could enroll in an on-line courses in Python programming.
The lesson plan would at least provide you with exercises to do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Michael Torrie
On 10/18/20 5:37 PM, Mladen Gogala via Python-list wrote:
> On Sun, 18 Oct 2020 12:19:18 -0600, Michael Torrie wrote:
> 
>> Python certainly is procedural.  A script starts at the top and executes
>> through to the bottom and ends, barring any flow control in the middle.
>>  Like Perl you can use it in many different ways and paradigms including
>> OO if you desire.
> 
> That's not the point. 

But it is.

Yes I can see why this devolves so quickly for you! :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Michael Torrie
On 10/18/20 11:07 AM, Mladen Gogala via Python-list wrote:
> The fundamental 
> difference between the two languages is that Perl is procedural while 
> Python is a fully OO language. Discussion of Perl vs Python necessarily
> devolves into the discussion of procedural vs OO paradigms.

Python certainly is procedural.  A script starts at the top and executes
through to the bottom and ends, barring any flow control in the middle.
 Like Perl you can use it in many different ways and paradigms including
OO if you desire.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for Windows

2020-10-14 Thread Michael Torrie
On 10/14/20 11:29 AM, Ana María Pliego San Martín wrote:
> I've tried to install Python a couple of times on my computer. Although it
> works fine when first downloaded, every time I turn off my computer and
> then back on Python says it has a problem that needs fixing. After "fixing"
> it, I still encounter some issues and have the need to uninstall it and
> install it again. Do you know what the problem is?

You are running the installer again, not the Python interpreter. Kindly
delete the installer file so this won't happen again.  Please see this
on-line documentation:  https://docs.python.org/3/using/windows.html.

Note that Python is an interpreter. It's not a GUI app, and it's not an
IDE. It requires a python script (program) to do anything. Again, see
the link above. Python does ship with a program called IDLE, which does
provide an editor and means of running scripts without using the command
prompt.  It should be in your start menu.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python's carbon guilt

2020-10-11 Thread Michael Torrie
On 10/10/20 9:58 AM, Peter Pearson wrote:
> Python advocates might want to organize their thoughts on
> this subject before their bosses spring the suggestion:
> 
> From 
> https://www.sciencemag.org/news/2020/10/we-re-part-problem-astronomers-confront-their-role-and-vulnerability-climate-change
>  :
> 
> . . . Astronomers should also abandon popular programming languages
> such as Python in favor of efficient compiled languages. Languages
> such as Fortran and C++, Zwart calculates, are more than 100 times
> more carbon efficient than Python because they require fewer
> operations.

Most of the math heavy lifting is done by compiled code that is merely
called from Python.  I seriously doubt there is anything to save by
abandoning Python for something that is harder to use, slower, and
probably burns way more electricity with all those compile cycles that
they'd be forced to do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem

2020-09-30 Thread Michael Torrie
On 9/29/20 4:31 PM, Ron Villarreal via Python-list wrote:
> Tried to open Python 3.8. I have Windows 10. Icon won’t open.

Did you read the documentation? https://docs.python.org/3/using/windows.html

Seems like this comes up several times a week. Perhaps the installer
should automatically open this page.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your confirmation is required to join the Python-list mailing list

2020-09-10 Thread Michael Torrie
On 9/10/20 10:48 AM, LZ Lian wrote:
> Dear Python Team,
> 
> I've subscribed as requested. I've attached the subscription email
> for your reference too
> 
> Now, for the issue I’ve tried to download and install the latest
> version of Python software a few times. However, each time I run the
> application, the window showing “Modify / Repair / uninstall” will
> pop out. I’ve tried all the options on that pop-up and nothing works.
> I’ve tried googling for solutions and none are really helpful. Pls
> assist. Thanks

Did you read the documentation at
https://docs.python.org/3/using/windows.html?  Is there something in
this document that is lacking?  Seems like this identical question comes
up on a weekly basis.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: newbie

2020-09-09 Thread Michael Torrie
On 9/8/20 7:24 PM, Grant Edwards wrote:
> On 2020-09-08, Don Edwards  wrote:
> 
>> I may need. My aim is to write a program
>> that simulates croquet - 2 balls colliding with the strikers (cue) ball
>> going into the hoop (pocket), not the target ball. I want to be able to
>> move the balls around and draw trajectory lines to evaluate different
>> positions. Is there a package for this or maybe one to draw and one to
>> move? Any help much appreciated.
> 
> Is pygame still a thing?

Yes. https://www.pygame.org/.  Should be in most Linux distributions'
repositories.

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


Re: Replacement for pygtk?

2020-09-05 Thread Michael Torrie
On 9/4/20 3:24 PM, Grant Edwards wrote:
> I assume that difference is because pygtk was hand-written and gi is
> built auto-magically using SWIG or something like that?

Essentially, yes.  Although pygobject does not use a tool like swig to
generate static wrappers. Rather it uses the GTK introspection API to
ask gobject's for their methods and attributes, and then marshalls and
calls them at runtime. So you can use pygobject with any GObject-based
binary library, not just GTK+.  Hope that makes sense.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Replacement for pygtk?

2020-09-03 Thread Michael Torrie
On 9/3/20 1:17 PM, Grant Edwards wrote:
> On 2020-09-03, Grant Edwards  wrote:
>> [...]
>>
>> Is pygobject the replacement for pygtk?
> 
> It seems to be.  I've started porting my pygtk app, and it's going
> pretty smoothly.  I've already got my two custom widgets working.
> Oddly, the main module provided by the gobject package is called "gi".

It stands for "gobject introspection." The nice thing about the gi
module is it can wrap any gobject-based library, not just GTK+ proper.
So if someone made a custom widget in Vala, for example, you could
access it via gi.  It's a neat idea. My only problem with it is the
resulting Python API is not always as pythonic as pygtk code was.  I
can't think of any specific examples at the moment, however.  It's
pretty much good enough to not care too much.  Similar arguments can be
made against PyQt as well.  Especially with PyQt the end result feels a
bit like writing C++ with a python syntax.

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


Re: Another 2 to 3 mail encoding problem

2020-08-26 Thread Michael Torrie
On 8/26/20 9:27 AM, Alexa Oña wrote:
> Don’t send me more emails
>
> https://mail.python.org/mailman/listinfo/python-list
^
Please unsubscribe from the mailing list. Click on the link above.

Thank you.



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


Re: Program chaining on Windows

2020-08-24 Thread Michael Torrie
On 8/24/20 1:30 AM, Rob Cliffe via Python-list wrote:
>> Hmm. Python isn't really set up to make this sort of thing easy.
> I guess this sentence pretty well answers my whole post. :-(

After reading Eryk Sun's posts, it doesn't appear that Python is the
issue here, but rather Windows does not make it possible to do what you
want to do.  But his suggestions for emulating the behavior you seek are
good ones.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: LittleRookie

2020-08-18 Thread Michael Torrie
On 8/18/20 4:26 PM, Jamelaumn wrote:
> i would say i'm new at programing i have a year of experience in python(but 
> i'm tottaly a noob) i guess i'm starting to learn SQL now.What should i do to 
> learn better and faster?

The only way is to build something with it. Solve a problem with Python.
 Make a web site with Django or another popular Python web framework.
Write a script that processes some data you need.  Could be anything.

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


Re: Need to 'import gtk' on Ubuntu 20.04, what do I need?

2020-07-25 Thread Michael Torrie
On 7/23/20 2:41 PM, Chris Green wrote:
> I have recently upgraded my desktop system from ubuntu 19.10 to ubuntu
> 20.04.  I have some Oki printer/scanner driver software that is
> written in Python 2 and, although python 2 is still installed on my
> system it's no longer the default python and the Oki software no
> longer runs.
> 
> The error I am getting is:-
> 
> chris@esprimo$ ./scantool.py
> Traceback (most recent call last):
>   File "./scantool.py", line 52, in 
> import gtk
> ImportError: No module named gtk
> 
> So what do I need to install on my Ubuntu 20.04 system to provide the
> gtk module?  

Someone has made a PPA with the python2 pygtk2 package:

https://launchpad.net/~nrbrtx/+archive/ubuntu/python2-stuff

sudo add-apt-repository ppa:nrbrtx/python2-stuff
sudo apt-get install python-gtk2

I can't vouch for the source, so use at your own risk.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-03 Thread Michael Torrie
On 7/3/20 10:57 AM, Jon Ribbens via Python-list wrote:
> On 2020-07-03, Ethan Furman  wrote:
>> On 07/02/2020 07:42 PM, Jon Ribbens via Python-list wrote:
>>> She didn't - you did.
>>
>> Please keep the discourse civil.  Petty taunts are not helpful.
> 
> Sorry, I don't understand what you are getting at. My comment was not
> a "petty taunt", it was an important factual correction, and perfectly
> civil - more so than the post it was a response to.
> 
> (I'll concede my second post repeating it in response to "Come again?"
> was somewhat facetious though ;-) )

All you needed to say was, "No, she did not conflate 'White' with race."
 To say "[I] did," is a very odd thing, and certainly inaccurate. I
definitely did not conflate White with race.  Why do you think that?  As
others helpfully pointed out, the context for her comments was out of
band (not on this list).  Thus she was not conflating anything.  If we
want to go in circles, sure I did conflate that she conflated.

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


Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-02 Thread Michael Torrie
On 7/2/20 4:46 PM, Random832 wrote:
> It's possible that this wasn't explained clearly enough in the commit
> message itself (though I would argue it was definitely adequately
> explained in the ensuing on-list discussion, and wonder how much of
> that discussion you've actually read), but the point is that the
> *whole idea* of "standard English" is tied to white supremacy, not
> any particular standard whether via its authors or otherwise.

Good to know.  Nothing at all was explained in the commit message
justifying that particular sentence, leaving one unfamiliar with the
background to wonder what she was referring to.

I definitely agree the words "standard English" are pretty meaningless
to would-be python developers anyway and the new phrase in the PEP 8 is
much better.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: FW: Pycharm Won't Do Long Underscore

2020-07-02 Thread Michael Torrie
On 7/2/20 2:55 PM, Danilo Coccia wrote:
> Il 30/06/2020 23:46, Joe Pfeiffer ha scritto:
>> "Peter J. Holzer"  writes:
>>> I agree. Although there are some fonts with special ligatures for
>>> programming. I have never used one, but that seems like an interesting
>>> concept.
>>
>> I've never heard of that before.  I'd be curious to try one.
>>
> 
> I've been using this one, and I like it:
>   https://github.com/tonsky/FiraCode
>   https://www.fontsquirrel.com/fonts/fira-code
> 
> Works well with PyCharm.

Hmm. That is... interesting.  I'm not at all sure how I feel about that.
 On the one hand it partly appeals, but on the other hand it quite
repulses me.  I don't find the FireCode samples any easier to read than
a normal font. In fact I find it slightly more difficult to read, since
my brain is not used to looking for those symbols.  Hmmm.  Yeah I dunno
about this one!  Very interesting. Thanks for sharing it.

I tried it, and it's definitely not for me!


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


Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-02 Thread Michael Torrie
On 7/2/20 1:26 PM, Jon Ribbens via Python-list wrote:
> On 2020-07-02, Michael Torrie  wrote:
>> Agreed. She just needs to fix her commit message to remove the sentence
>> about the relics of white supremacy.  The fact she would conflate an
>> author's name with some kind of race-related thing is a bit
>> embarrassing, frankly.
> 
> She didn't - you did.

Come again?  I can see no other link in the verbage with the "relics of
white supremacy" that she referred to.  If there are other links, they
should be included in the commit message.  I agree with Rhodri that an
explanation would be interesting.  Far be it from me to demand one.  So
whatever.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-02 Thread Michael Torrie
On 7/2/20 11:11 AM, Dieter Maurer wrote:
> In the replaced sentence
> `When writing English, follow Strunk and White`
> I interpret "Strunk and White" as a reference to some
> document containing rules for readable English and "Strunk and White"
> are likely the authors of this document. I do not associate "White"
> with "white" in contrast to "black" (or some other colour).
> However, I do not know this document nor "Strunk and White". Thus,
> the PEP text should get improved. If it is refers to a standard,
> it should be be an online standard and the PEP should include its URL.
> Otherwise, non-english people are indeed at a disadvantage.

Yes Strunk and White is a well-known book on writing style.  That's the
names of the authors. William Strunk and EB White.
https://en.wikipedia.org/wiki/The_Elements_of_Style

> In contrast, The replacement is well understandable and applicable
> to all languages.

Agreed. She just needs to fix her commit message to remove the sentence
about the relics of white supremacy.  The fact she would conflate an
author's name with some kind of race-related thing is a bit
embarrassing, frankly.

> Thus, in my view, the change is really an improvement.
> One could motivate it differently, however.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pycharm Won't Do Long Underscore

2020-06-25 Thread Michael Torrie
On 6/24/20 7:38 PM, Grant Edwards wrote:
> On 2020-06-24, Peter J. Holzer  wrote:
> 
>> There is U+FF3F Fullwidth Low Line.
>>
>>> If there were, Python would not know what to do with it
>>
>> You can use it in variable names, but not at the beginning, and it isn't
>> equivalent to two underscores, of course:
> 
> Ouch.  Anybody caught using that should be fed to a large snake.

Even allowing unicode letters in variable names period is questionable,
but that loud debate was over years ago.  Fortunately I have never seen
any python code in the wild with non-latin characters for variable
names.  Would make editing code very painful for developers from
different locales and keyboards. Even if it might seem novel at first to
have π be a variable name.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problems with python383.dll

2020-06-17 Thread Michael Torrie
On 6/16/20 11:18 AM, Manuel Fernandez - Università wrote:
> Dear Sirs,
> I tried to install the software Python 3.8.3 (32 bit), but after it 
> finished and I tried to start it, there appeared a message in which it 
> was written that it couldn't find the file python383.dll and stopped.
> What can I do? Do you have this file so that I can insert it manually.
> I thank you for your help.
> Best wishes,
> Manuel Fernandez

Which version of Windows?  32-bit or 64-bit? Where did you download the
installer from?  How did you try to start it? Normally python is a
command-line tool, so you run it from a command prompt, not from the
start menu.  Read through this page and see if it helps at all:
https://docs.python.org/3/using/windows.html
-- 
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: ctypes & allocated memory

2020-06-07 Thread Michael Torrie
On 6/7/20 2:25 PM, Barry wrote:
>> Does ctypes, when using restype, frees allocated memory?
>>
>> For example, will the memory allocated by "strdup" be freed after the "del" 
>> statement? If not, how can I free it?
> 
> See https://linux.die.net/man/3/strdup that tells you to use free() to delete 
> memory allocated by strdup.
> 
> You must remember the result of strdup and free it at an appropriate time.

But the problem is that by specifying the type as ctypes.c_char_p,
ctypes will hide that pointer from you and return a Python object
instead.  I'm not sure how ctypes is doing it under the hood, but I
suspect ctypes is doing it's own strdup of the string on conversion, and
managing that memory, but the original pointer ends up being lost and
leaking memory.  The stack exchange link I posted suggests that have
ctypes give you a void * pointer, and then cast that to give you a
python string while still having the original pointer to free.  Is this
correct?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ctypes & allocated memory

2020-06-07 Thread Michael Torrie
On 6/7/20 7:15 AM, Miki Tebeka wrote:
> Hi,
> 
> Does ctypes, when using restype, frees allocated memory?
> 
> For example, will the memory allocated by "strdup" be freed after the "del" 
> statement? If not, how can I free it?

I don't think so.  I did a quick google search and came up with this
discussion, which may be relevant:

https://stackoverflow.com/questions/13445568/python-ctypes-how-to-free-memory-getting-invalid-pointer-error

> 
> ---
> import ctypes
> 
> libc = ctypes.cdll.LoadLibrary('libc.so.6')
> strdup = libc.strdup
> strdup.argtypes = [ctypes.c_char_p]
> strdup.restype = ctypes.c_char_p
> 
> out = strdup(b'hello').decode('utf-8')
> print(out)  # hello
> del out
> ---
> 
> Thanks,
> Miki
> 

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


Re: Fwd: How can I build embeddable zip python on Linux

2020-06-04 Thread Michael Torrie
On 6/4/20 2:47 AM, Filip Bascarevic wrote:
> When I tried to build GDB with Python support on Linux, I realized I
> couldn’t find embeddable python for Linux. 
>
> Please, can you give me some instructions how can I build embeddable Python
> from source in Linux? Is it possible in the Linux environment?

What does "embeddable python" mean?  Do you mean the libpython shared
library and C API?  If so it's just a matter of installing the correct
-devel or -dev package on your distro. On Debian this would likely be
libpython#.#-dev where # is the version. For example, libpython3.8-dev.
On Fedora that might be python-devel (or on CentOS, python36-devel).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Division issue with 3.8.2 on AIX 7.1

2020-06-04 Thread Michael Torrie
On 6/3/20 10:37 PM, Sherry L. West wrote:
> I need off this list please. I don’t even have this.

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


Re: Python not running

2020-05-20 Thread Michael Torrie
On 2020-05-20 8:22 a.m., Supriyo Roy wrote:
> I have installed the latest version of python which is 3.8.3. However, when
> I try to run a sample program, a small python icon appears on my taskbar
> for a split second and then disappears. Nothing else happens. Please advise
> me on how to get python up and running.
> Thank you in advance. Regards.

Always state your operating system!

Python is simply an interpreter, not a graphical application, and is
normally run from the command prompt.  Your program is in fact running,
but after it finishes, the window goes away, as it does for all console
programs.  If you run it from a command prompt you will see the complete
output from your program.  Please read the link that DL Neil helpfully
provided to get you up and running on Windows.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help Problem with python : python-3.8.3rc1-amd64

2020-05-11 Thread Michael Torrie
On 5/11/20 9:25 PM, Michael Torrie wrote:
> On 5/11/20 8:33 PM, Buddy Peacock wrote:
>> I am trying to install python on my surface with windows 10, version 1903,
>> build 18362.778.  The installer seems to think everything worked. But there
>> is no Python folder anywhere on the system.  I looked in the root directory
>> as well as "Program Files" and "Program Files (x86)" and not in any users
>> folders either.  I have uninstalled and re-installed twice.  Once after
>> shutting down and restarting.  Your help would be appreciated as I am
>> taking an on-line programming class.
> 
> Unless you specifically selected "install for all users" it's probably
> going to be installed to your home directory under the hidden folder
> "AppData," specially "AppData\Local\Programs\Python."  Be sure to tell
> the installer to put python in your path--that way no matter where it
> is, from the command prompt you can just run "python" and it will fire
> up the interpreter.  Additionally, "Idle" (the integrated development
> environment) will probably be in your start menu.

Hmm, actually I think the AppData install path is if you install from
the Microsoft Store, which you could try.

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


Re: Help Problem with python : python-3.8.3rc1-amd64

2020-05-11 Thread Michael Torrie
On 5/11/20 8:33 PM, Buddy Peacock wrote:
> I am trying to install python on my surface with windows 10, version 1903,
> build 18362.778.  The installer seems to think everything worked. But there
> is no Python folder anywhere on the system.  I looked in the root directory
> as well as "Program Files" and "Program Files (x86)" and not in any users
> folders either.  I have uninstalled and re-installed twice.  Once after
> shutting down and restarting.  Your help would be appreciated as I am
> taking an on-line programming class.

Unless you specifically selected "install for all users" it's probably
going to be installed to your home directory under the hidden folder
"AppData," specially "AppData\Local\Programs\Python."  Be sure to tell
the installer to put python in your path--that way no matter where it
is, from the command prompt you can just run "python" and it will fire
up the interpreter.  Additionally, "Idle" (the integrated development
environment) will probably be in your start menu.

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


Re: phyton hata

2020-05-04 Thread Michael Torrie
On 5/4/20 4:15 AM, HÜSEYİN KOÇ wrote:
> Phyton 3.8.2 versiyonu bilgisayarıma indirdim fakat sorunlar ile 
> karşılaştınız diyerek hata veriyor
> 
> 
> Windows 10 için Posta ile 
> gönderildi
> 

Please ensure Windows is up to date using Windows Update. That will
solve most installation problems.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Sorry, but . . .

2020-04-28 Thread Michael Torrie
On 4/28/20 2:41 PM, Ganesha Sharma wrote:
> When I was installing Python 3.8.2, The installer gave me a BSoD. Is there
> a way to fix that? I tried 3.6.2 but with Add to Path, with
> environment variables off, it did not work. I just want the full Python,
> but can you ask the developers to fix that in Python 3.9? That would be
> great, or I just have to use repl.it to program. Python is my favorite
> programming language and I love it.
> I can't even use Pip! It's just adding python to the path manually is so
> scary.

Sorry to hear you got a BSoD while running the installer. This is not a
usual occurrence, and is not generally happening to other users (on
Windows of course).  It's impossible to say what's causing this BSoD.
With modern versions of Windows, this is usually because of a hardware
fault or a bad driver.  There's really nothing Python developers can do
about this. This isn't a bug in the installer.  Rather the installer is
triggering something on your Windows system that isn't quite right.

You did not state where you got the installer from, or the operating
system version and hardware you were installing on.  Getting the
official installer from python.org is always recommended.  Have you
tried it on other machines?

When you say you tried 3.6.2 and it "did not work," what do you mean by
that?  Please describe the problem, and include copy and pasted error
messages (not screenshots) from the command prompt.

Glad you enjoy Python. Yes, it is a great language.

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


Re: Function to avoid a global variable

2020-04-27 Thread Michael Torrie
On 4/27/20 10:39 AM, Bob van der Poel wrote:
> Thanks Chris!
> 
> At least my code isn't (quite!) as bad as the xkcd example :)
> 
> Guess my "concern" is using the initialized array in the function:
> 
>def myfunct(a, b, c=array[0,1,2,3] )
> 
> always feels like an abuse.
> 
> Has anyone seriously considered implementing  a true static variable in a
> function? Is there a PEP?

There's actually no need. You can create attributes on the function
itself, just like a regular object:

def foo():
if not 'bar' in foo.__dict__:
foo.bar = 5

print (foo.bar)


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


Re: pytube problem

2020-04-15 Thread Michael Torrie
On 4/14/20 11:22 PM, Abhi Bajpai wrote:
> Respected sir or mam.. I am facing issue related to pytube there is
> always problem with youtube module please look into this and try to
> solve it... I have to submit project.. and now all depends on you.

This is a mailing list for general Python help, and help with the parts
of the Python standard library.

If you have problems with a specific third-party module, you will want
to contact the developers of that module.  Be sure to state clearly what
the problem is, provide a short, self-contained example that illustrates
the problem, and provide a complete text copy (not an image) of the
traceback.  Actually do this for posts to this mailing list also for all
Python problems.

Also, most developers welcome patches to fix problems, as they are only
donating their time. They don't owe you anything, and certainly it does
not "all [depend] on [them/us]."  It might depend on you of course!

If you search with google I think you'll probably find the github page
for pytube and can open an issue there perhaps.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What variable type is returned from Open()?

2020-04-15 Thread Michael Torrie
On 4/15/20 5:47 PM, dcwhat...@gmail.com wrote:
> So in the case of Python, whenever the type information is available,
> I want to make it explicit rather than inferred.  Whether the A.I. is
> running a simulation of the software in an IDE, or analyzing them as
> text documents, they should be able to glean as much as possible.
> They should also be able to infer the type, via a Hungarian syntax
> variation.

Hungarian syntax is definitely an acquired taste, and better suited to
statically-typed languages.

In this specific case of dealing with open(), keep in mind that most
things that work with files (including something like, for example,
csvreader) only require a file-like object. That can be something that
open() returns, or some other object that implements the semantics. This
is important because anything that can work with files can also work
with any other implementation, provided it speaks the same protocol.
For example you could feed it a stream from a zip archive.  Or a network
stream. Or something else of your own design.  No need for "interface"
classes (although Zope does implement and use them for some reason), or
a special class hierarchy.

In my opinion, the first line of documentation should be decent
docstrings that document the parameters and return values for functions.
I can think of some cases when type hinting would be desired and
recommended.  But storing the result of open() isn't one of them.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python programs to track bitcoins

2020-04-10 Thread Michael Torrie
On 4/9/20 11:16 PM, dreamyladyg...@gmail.com wrote:
> I`m looking if there any programs out there to track bitcoins and those 
> programs were made by python

You can use Google search as well as any of us, or some other search
engine.  What have you found so far?

> >
> it`s kinda urgent

In the future, please leave this off your messages.  Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Troubling running my Python

2020-04-08 Thread Michael Torrie
On 4/8/20 1:12 PM, Lorraine Healy wrote:
> Hi,
> 
> I have downloaded the 3.8 64 bit python program to my PC but the
> interpreter will not run. It seems to have 'repaired' itself when I ran the
> setup again but the interpreter still  won't run.
> Is there a reason for this? Do you require a screenshot?

Assuming Windows here.

The Python interpreter does nothing without a python program to run (to
interpret).  Thus if you simply double click on python.exe it will do
nothing.  Instead you need to create python programs using a text
editor, which you can then run from a command prompt.

Usually included with the Python install is a program called "Idle"
which is an integrated editor, debugger, and runtime environment.  Look
for it in your start menu.

Most python programmers prefer to use a text editor they like, and run
programs from the command prompt.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A PDF journey to find all python PDF

2020-04-04 Thread Michael Torrie
On 4/4/20 9:08 AM, anson freer wrote:
> Thanks, I'll check them out.
> tutor sent "The reason it is being held:
> 
> Post by non-member to a members-only list".
> 
> could I be on both lists? I did unsubscribe

Yes you can subscribe to both lists of course. But you have to subscribe
to each list individually.  Always be sure to post to a list from the
same email address that you signed up.

> I am trying learn how to use a PDF text editor

Okay, but what is your goal and purpose? What problem are you trying to
solve.  If you just want to edit a PDF file, I can think of far easier
methods than using any Python module. For example LibreOffice can import
and edit PDFs using the Draw component.

If you want to parse data from a PDF then one of the modules you mention
below could work.

> The info I have states I need:
> 
> pdfminer PyPI python3 only
> 
>  PDFParser
> 
> PDFDocument
> 
> PDFPageInterpreter
> 
>  PDFDevice
> 
> They all look the same

They may all do similar things with PDFs. Which one is appropriate for
your use depends on your needs, which still are not clear.

I also repeat my earlier suggestion that before you can use any of these
modules, you must learn Python first, at least to the degree where you
are comfortable creating code in Python to manipulate variables, if
statements, functions, etc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A PDF journey to find all python PDF

2020-04-03 Thread Michael Torrie
On 4/3/20 1:02 PM, anson freer wrote:
> This forum mentioned the Tutor forum so I signed up
> I waited a day or 2 heard nothing so I sent msg
> got  Post by non-member to a members-only list
> replied to apologized and
> received auto msg
> part of which gave do's and don't's of forum
> then I realized I asked a really lame question
> Might take years for a answer

Did you sign up for the Tutors list?  Just head on over to
https://mail.python.org/mailman/listinfo/tutor and sign your email
address up, just like you did for this list.  Once you do that you won't
get any more moderator messages saying you're posting to a members-only
list.

Unfortunately your question was very unclear.  What exactly are you
trying to accomplish?

Python is a wonderful language, but for it to be useful to you, even in
working with existing code, you have to learn how to code in it
generally, like you did with VBA.  You may wish to google for some
Python tutorials to work through to learn the language first.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fw: Python installation problem

2020-04-01 Thread Michael Torrie
On 4/1/20 11:09 AM, HERNANDEZ AGUIRRE JOSE GABRIEL DE LA DOLOROSA wrote:
> Para: python-list@python.org
> 
> I  installed  the Python software , but I could not find the python.exe file 
> with the Unscramble software

Actually in windows 10, Idle shows up in the start menu under the "I"s,
not in a python  folder.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fw: Python installation problem

2020-04-01 Thread Michael Torrie
On 4/1/20 11:09 AM, HERNANDEZ AGUIRRE JOSE GABRIEL DE LA DOLOROSA wrote:
> I  installed  the Python software , but I could not find the python.exe file 
> with the Unscramble software

What is this "Unscramble software?"

After Python is installed, you probably will find the "Idle" integrated
development environment in your start menu under "Python."

Looks like recent versions of Python default to installing into your
home directory under AppData\Local\Programs\Python-38-32 (or -64).  Look
in there for python.exe and pythonw.exe.  Please note that Python is not
like Visual Studio. It's an interpreter that is meant to be run from the
command line with python script files you create in an editor.

It may also be helpful to click the option in the installed to add
Python to the PATH. That way you can just run python.exe from any
command prompt.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to uninstall Python3.7 in Windows using cmd ?

2020-03-29 Thread Michael Torrie
On 3/29/20 6:41 PM, Mike Dewhirst wrote:
> I would first determine whether it is the 32 or 64 bit version which is 
> installed. I would then visit www.python.org and download the exact same 
> python executable installer. Don't know what msi is but it doesn't 
> matter. I think it just means microsoft installer.

I think you misread both Terry and the original poster.

What Terry was trying to say is that there is no MSI installer available
for python, so you cannot use the Microsoft MSI command line tool
(msiexec), which was what the original poster was asking about.  Thus
you cannot use msiexec.exe to remove Python by way of a batch file or
script. He'll have to do it a different way.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Michael Torrie
On 3/27/20 3:28 PM, Dan Stromberg wrote:
> Back when I was a kid, and wordprocessors were exemplified by WordStar, I
> heard about a study the conclusion of which was that aligned right edges
> were harder to read - that it was better to align on the left and leave the
> right ragged.
> 
> But one study doesn't establish truth.

I've read poorly-typeset, self-published books that were really hard to
read due to the way the full justification worked out.  Not sure if
that's just due to the poor typesetting job (a word processor probably
did it), or the font, or what.  There must be some tricks that
publishers use to both justify and keep the text looking good and
readable.  At one point in the print world, the majority of what I read
is fully justified, yet still quite readable.  Even now I think most
published books I've seen recently are fully justified. These days,
seems like more and more is ragged-right, such as magazines, which is
probably due to the prevalence of digital media where it's probably
easier to generate and easier to read on small screens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to build python binaries including external modules

2020-03-18 Thread Michael Torrie
On 2020-03-18 5:06 p.m., James via Python-list wrote:
> When you build python binaries from source, how to add external modules?
> For example, to install cython, conventional method is building python first, 
> then running setup.py for cython.
> I'd like to combine the 2-step into one.

Cython requires a working Python interpreter to run the setup.py.  How
would that work when building python itself?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-13 Thread Michael Torrie
On 3/12/20 4:19 PM, Mike Dewhirst wrote:
> I'm not sure I understand what you are saying. How is gmail
> behaviour breaking things?

The problem is if I post to a mailing list from gmail (either the web
interface or Thunderbird via Google's SMTP servers), Google will
silently discard my own message when the list serv echos it back to me.
In the web-based "conversation" view, Google puts my own sent message in
the conversation. However via IMAP I see nothing.  Thus when looking at
my list mail on Thunderbird, my own messages to the list never show up.

Does that make sense?  There was a lot of fuss about this when gmail
first started doing this, but Google ignored it and continues to ignore
this issue. They regard this sort of email use as "legacy."

Here's an old message describing the problem and showing Google's
non-response:
https://support.google.com/mail/forum/K7un8RUduyrfxS01ac/?hl=en

The only way to prevent this is to send your message via a non-Gmail
SMTP server, and not to put those messages in your Gmail Sent folder.
This runs the risk of messages being flagged as untrustworthy, but as
long as Python's smtp server accepts them, it works.  Of course python's
list messages going out are often flagged as suspicious because they
have our own "from" addresses on them but come through Python's servers.

> I do have a gmail account but don't use it.
> 
> As background, I signed up to the Django google-group list and
> traffic there arrives in my Thunderbird client. I also occasionally
> use Roundcube web client for my accounts when travelling. I think
> that might be a php thing.
> 
> Maybe there is a case for developing a gmail-like web client?

No the problem has nothing to do with the web interface or the client.
It's a bug/feature of the Google back end.


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


Re: Python question

2020-03-12 Thread Michael Torrie
On 3/11/20 8:47 PM, DL Neil via Python-list wrote:
> Didn't someone once claim "do no harm"?
> 
> There are two sides to every story! Rather than changing the (Discussion 
> List) server, which affects everyone; ask those who don't like Google's 
> tactics/behavior to change their (email) client!

In Gmail's case it's a matter of not using gmail at all, as their
mailing list -breaking behavior happens whether you use IMAP and
thunderbird.  I work around gmail's breakage right now by using my own
SMTP server for sending messages to the list, so gmail won't recognize
my messages and discard them.

I could leave gmail, but it's not worth it for me at this point.  Python
is the only mailing list left of all the open source projects I used to
follow. It's pretty sad how they all abandoned a format that works very
well for web based formats.

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


Re: Python question

2020-03-10 Thread Michael Torrie
On 3/10/20 6:49 PM, Souvik Dutta wrote:
> What about moving on to a social media app completely made in pythoj for
> python?

No thanks. I don't want to be on yet another web forum.  I don't need
"social media" or a "social media app."  Email works exceedingly well
for this sort of thing, despite Google's antics.

Sadly a lot of open source projects are abandoning the good old list and
moving to awkward web forums like Discourse.

With e-mail lists, everything is right here in my email client
(Thunderbird), separated out into folders with procmail (or whatever
filtering system you want), and with proper nesting of messages.  No web
forum I've seen offers this convenience or proper nesting.  Electronic
communication is fraught enough. "Social media" (whatever that means)
seems to just make it harder.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-10 Thread Michael Torrie
On 3/10/20 6:40 AM, Chris Angelico wrote:
> On Tue, Mar 10, 2020 at 11:22 PM Marco Sulla via Python-list
>> I would reply, but I was already too much off topic. I want only to
>> write what Gmail reports to me about the last message of the person
>> that started this discussion:
>>
>>> This message seems dangerous
>>> Many people marked similar messages as phishing scams, so this might 
>>> contain unsafe content. Avoid clicking links, downloading attachments or 
>>> replying with personal information.
>>
>> I never saw this message before in Gmail. Didn't your Gmail warned
>> about this, Souvik Dutta?
>>
> 
> I'm also reading this in Gmail, and I didn't get any such warning. I'm
> going to call that a spurious warning, a false positive.

Gmail often reports this about Python list messages because they are
being sent through Python's mailing list servers but have the From
address showing up as the poster's email address.

Shows that Google's "my way or the highway" approach to security is
problematic when it comes to traditional internet services like
listservs.  To say nothing of how they break mailing lists by throwing
out your own messages to the list. Google products are definitely
getting more and more frustrating for us traditional users.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using zipfile to create a zip file with directories and files

2020-03-07 Thread Michael Torrie
On 3/7/20 1:08 AM, mus...@posteo.org wrote:
> On Fri, 6 Mar 2020 20:06:40 -0700
> Michael Torrie  wrote:
>
>> The documentation talks about writing files from
>> disk, but I'm interested in creating these files from within Python
>> directly in the zip archive.
>
> But you have seen writestr(), haven't you?

Yes, that's what I was using.  Turns out I didn't look closely enough at the 
exception I was getting.  What i thought was zipfile complaining about a '/' 
character was really Python complaining about a bad string formatting string I 
was using!

Thanks for confirming that zipfile indeed should work the way I hoped it wood. 
I'm in business now.

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


Using zipfile to create a zip file with directories and files inside

2020-03-07 Thread Michael Torrie
I am trying to do something very simple but having no success in finding out 
how to do it. I just want to use the Python zipfile module to create a zip file 
with a specific directory structure and create and write to files inside those 
subdirectories (not files already on disk).  The documentation talks about 
writing files from disk, but I'm interested in creating these files from within 
Python directly in the zip archive. I've read over the docs several times but 
nothing speaks to this, and none of the examples I've searched for show this 
either.

I thought that in zip files, directories are really just part of the name of 
the file, and if unless you tell unzip not to, it creates them as files are 
extracted. So I naively thought I could use the "open" method of zipfile, 
giving it a relative path describing the relative path and file name that I 
want to then write bytes to.  But seems I am mistaken.  Is this a limitation of 
the zip format that cannot allow that sort of thing?  Must I resort to 
temporary files?

Plenty of examples on how to create an archive from existing files and 
directories on disk of course, which isn't what I want to do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using zipfile to create a zip file with directories and files inside those directories

2020-03-07 Thread Michael Torrie
On 3/7/20 1:08 AM, mus...@posteo.org wrote:
> On Fri, 6 Mar 2020 20:06:40 -0700
> Michael Torrie  wrote:
> 
>> The documentation talks about writing files from
>> disk, but I'm interested in creating these files from within Python
>> directly in the zip archive.
> 
> But you have seen writestr(), haven't you?

Yes, that's what I was using.  Turns out I didn't look closely enough at
the exception I was getting.  What i thought was zipfile complaining
about a '/' character was really Python complaining about a bad string
formatting string I was using!

Thanks for confirming that zipfile indeed should work the way I hoped it
wood. I'm in business now.

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


Using zipfile to create a zip file with directories and files inside those directories

2020-03-06 Thread Michael Torrie
I am trying to do something very simple but having no success in finding
out how to do it. I just want to use the Python zipfile module to create
a zip file with a specific directory structure and create and write to
files inside those subdirectories (not files already on disk).  The
documentation talks about writing files from disk, but I'm interested in
creating these files from within Python directly in the zip archive.
I've read over the docs several times but nothing speaks to this, and
none of the examples I've searched for show this either.

I thought that in zip files, directories are really just part of the
name of the file, and if unless you tell unzip not to, it creates them
as files are extracted. So I naively thought I could use the "open"
method of zipfile, giving it a relative path describing the relative
path and file name that I want to then write bytes to.  But seems I am
mistaken.  Is this a limitation of the zip format that cannot allow that
sort of thing?  Must I resort to temporary files?

Plenty of examples on how to create an archive from existing files and
directories on disk of course, which isn't what I want to do.

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


Re: Application setup like windows msi

2020-03-04 Thread Michael Torrie
On 3/4/20 4:51 PM, J A wrote:
> I was wondering g if there was a way to distribute an application that took
> advantage of user input like a windows .msi does. On linux of course.

Several installer frameworks can make interactive installers for Linux.
There's the NullSoft installer and InstallerVICE.  And quite a few
commercial packages have rolled their own installers. Although I find
installers of any kind of annoying on Linux and don't seem all that
necessary.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: insert data in python script

2020-02-18 Thread Michael Torrie
On 2/18/20 2:41 AM, alberto wrote:
> Il giorno martedì 18 febbraio 2020 09:34:51 UTC+1, DL Neil ha scritto:
>> The first instruction (immediately above) imports the module preos.py. 
>> That works (no error message!).
>>
>> The second instruction refers to a Python class called Molecule. That 
>> fails. The error message says that 'Molecule' is not defined.
>>
>> Yet we can 'see' it. It *has* been defined! What is going on???
>>
>> In this case, we need to tell Python that Molecule is part of the preos 
>> module. So back to your original code (top):
>>
>> methane = preos.Molecule("methane", -82.59 + 273.15, 45.99, 0.011)
^^
He explicitly told you what to do.

The problem was "Molecule" is part of the "preos" module, so you have to
refer to it by the module name first.

>> Please refer to earlier message. If Module were called from code in the 
>> preos.py file, then the "preos." prefix would not be necessary.
>>
>> The formal term for this situation is "namespaces". Because Molecule is 
>> defined within the preos.py module's namespace we need to tell Python 
>> exactly where Molecule can be found. In the same way that we might say: 
>> if someone in Antarctica wants to see Alberto, (s)he will have to go to 
>> Italy to find him...
>>
>>
>> Don't hesitate to say if you think my reply is too complicated/advanced. 
>> People here are happy to help...
>> -- 
>> Regards =dn
> 
> hi
> honestly i don't understand what i have to do.
> I have been using python for too little time.
> could you help me understand

Did you read everything DL Neil said?  He told you what to do, including
giving you the line of code you need to replace, but also explained why.
 I don't know how one could make it more clear than what he said.

Spend some time to really try to understand what DL Neil is saying.
this is essential Python knowledge he's trying to impart.  Learning to
work with modules and namespaces in Python is pretty much required when
learning and using Python.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-12 Thread Michael Torrie
On 2/12/20 7:44 AM, Ethan Furman wrote:
> On 02/11/2020 04:38 PM, Michael Torrie wrote:
> 
>> It's all just different ways of accounting for the same things. In
>> the olden days before the term "technical debt" was invented, we
>> called this "total cost of ownership."
> 
> TCO is not a fixed number.  For example, if a loan is taken to help
> fund a project, then the "interest debt" will be a portion of the
> TCO, but its amount will vary depending on the interest rate: 15%
> will be more interest debt than 4%.  Likewise, the technical debt for
> a project will be higher or lower depending on the quality of the
> code written.

True.  Costs can be calculated and planned for. But Technical debt is
often impossible to quantify in a real, meaningful, business sense,
other than the that we "know" it's going to cost big time in the future.
 In some senses, it's theoretical future cost.  That's what I was having
a hard time with, and still do to a large degree.

> I think an oft overlooked aspect of technical debt is the affect on
> the programmers dealing with it:  frustration, burn-out, and
> job-seeking.

Yeah for sure.  A programmer may not love dealing with technical debt,
and certainly he may want to chase greener fields.  But there are lots
of things about lots of jobs that are less pleasant than other things.
Personally I tend to get way caught up trying to get a perfect design
that avoids technical debt, but often get not much done (on my personal
projects). Whereas another guy just cranks out code that isn't always
the best but serves his needs at the time. Guess who is more productive
overall? Not me.

More on topic, I feel like the technical debt issue might be over used
to push folks to upgrade from Python 2, or to do promote certain
technologies.

Without knowing the details of how and why they used it, it's impossible
for me to say that it will cost them a lot in the future.  It very well
could cost nothing.  Or it might be expensive enough to sink an enterprise.

In the case of the original poster, it could well be that the
maintenance he's doing to the code is minor and of no real cost, nor any
maintenance burden in the future.  He might not need security patches or
any other on-going development of the Python 2 interpreter.  His app
might have no attack surface.  The script does its internal job and
that's that.  As long as a Python2 interpreter runs he's golden. I
suspect a lot of Python 2 use falls into that sort of category.  Sort of
like the company I know that still uses an MS-DOS billing system.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 6:15 PM, Chris Angelico wrote:
> On Wed, Feb 12, 2020 at 12:13 PM Michael Torrie  wrote:
>>
>> On 2/11/20 5:55 PM, Chris Angelico wrote:
>>> But you CAN rewrite code such that it reduces technical debt. You can
>>> refactor code to make it more logical. You can update things to use
>>> idioms that better express the concepts you're trying to represent
>>> (maybe because those idioms require syntactic features that didn't
>>> exist, or simply because you didn't know about them when you first
>>> wrote the code). Maybe you'll still have SOME debt, but that doesn't
>>> mean it's never reduced.
>>>
>>> Debt is not a binary state.
>>
>> I agree with that. But your reply to my other comment didn't say that.
>> it said "it CAN be paid off" which is a binary thing.  Debt is paid off
>> (no longer existing) or it's not.  Debt can be paid down and reduced of
>> course.
> 
> Ahh, that might be a regional difference then, because around here,
> it's possible to pay off some of a debt. That would be why we were
> talking past each other.

Yup I just came to that conclusion while typing a reply to your other
post!  My apologies.

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


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 5:53 PM, Python wrote:
> If your hypothetical project was implemented perfectly from the
> beginning, in Python2.x, it may never need updating, and therefore
> there may well never be any reason to port it to python3.  So doing so
> would be neither "debt" nor "cost" but rather "waste."

I would agree generally, except eventually Python2 will be unavailable
in your distro and may no longer be build-able on current OS's.  However
if the program is working as well as you state, then the cost of
converting to the current version of Python (whatever that will be) is
not going to increase significantly.  Whatever the case, technical debt
belongs to the entity that owns the code.

I know some folks still running an MS-DOS system for billing.  Thanks to
things like DosBox, this system will live on for a long time yet. It
works, and they don't have any real need for anything beyond it.  It's
never needed much updating or maintenance beyond maintenance they would
do anyway like backups.  Insane amounts of technical debt?  Maybe.  Or
maybe just the cost of buying a new off-the-shelf system, which would be
the same cost (or more likely a lot more with upgrades and service
plans) had they done this years ago.

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


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 5:55 PM, Chris Angelico wrote:
> But you CAN rewrite code such that it reduces technical debt. You can
> refactor code to make it more logical. You can update things to use
> idioms that better express the concepts you're trying to represent
> (maybe because those idioms require syntactic features that didn't
> exist, or simply because you didn't know about them when you first
> wrote the code). Maybe you'll still have SOME debt, but that doesn't
> mean it's never reduced.
> 
> Debt is not a binary state.

I agree with that. But your reply to my other comment didn't say that.
it said "it CAN be paid off" which is a binary thing.  Debt is paid off
(no longer existing) or it's not.  Debt can be paid down and reduced of
course.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 5:42 PM, Chris Angelico wrote:
> Yes, if you consider the term to be synonymous with TCO, then
> naturally you'll see it as useless. But it isn't. Technical debt is a
> very specific thing and it CAN be paid off.

We'll agree to disagree on the last bit. And I'm not the only one that
believes technical debt can never be paid off.  Microsoft got fabulously
wealthy incurring vast amounts of technical debt.  We can argue that
Windows is the result (it is), but what's killing Windows isn't the
technical debt. It's the cloud and the web.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 5:37 PM, Chris Angelico wrote:
> On Wed, Feb 12, 2020 at 11:32 AM Michael Torrie  wrote:
>>
>> On 2/11/20 2:25 PM, Barry Scott wrote:
>>> At Chris said moving to python3 will *reduce* your technical debt.
>>> You are paying off the debt.
>>
>> While at the same time incurring new debt.
> 
> That's not an intrinsic part of the rewrite, and will only happen if
> you do the job sloppily.
> 
> Perhaps you're completely misunderstanding the meaning of the term?
> 
> https://en.wikipedia.org/wiki/Technical_debt
> https://thedailywtf.com/articles/technical-debt

Yes I understand the meaning.  Getting code out the door now, at the
expense of maintenance later.  But really all code is technical debt.
That's my main point.  No one writes good enough code to be completely
free of this technical debt.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 1:09 PM, Chris Angelico wrote:
> What you're talking about is costs in general, but "debt" is a very
> specific term. You accrue technical debt whenever you "borrow" time
> from the future - doing something that's less effort now at the
> expense of being worse in the future. You pay off that debt when you
> sink time into something in order to make it easier to work on in the
> future. The most common form of technical debt is legacy code, where
> you often end up paying interest on the debt every time you dip your
> toes into the code to make a small change, avoiding the work of
> actually refactoring things and fixing the problems.

It's all just different ways of accounting for the same things. In the
olden days before the term "technical debt" was invented, we called this
"total cost of ownership." This not only included the up front cost, but
the on-going (and potentially increasing) cost of maintenance, and often
even the future cost of migrating to a new solution.  So in the end it's
all the same: cost.  And it's never paid off.  Ever.  That's why I've
recently come to question the usefulness of the term "technical debt."

> Porting to Python 3 should *improve* your codebase, so it should be a
> way of shedding technical debt. (Unless you do it by running 2to3 on
> your code and hoping for the best. But that's a bad idea for many
> other reasons.)

But see, this is the thing.  There's brand new technical debt accrued
with the move to Python 3.  The cost of the debt is lower, but it's
still there.  Because maintenance is still going to cost.  Versions
still bump and require hopefully minor tweaks.  Eventually the bigger
jumps come. New ideas come along also. New frameworks, new paradigms.


I think it's a fallacy to think we can pay down technical debt.

I'm sure we probably disagree.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 2:25 PM, Barry Scott wrote:
> At Chris said moving to python3 will *reduce* your technical debt.
> You are paying off the debt.

While at the same time incurring new debt.

> Not to mention that its harder to hire people to work on tech-debt legacy 
> code.
> 
> Given the choice between a legacy python2 job and a modern python3 job
> what would you choose?

If this was an income job, it would entirely depend on what it paid.  In
this day and age of the so-called "gig economy" it really doesn't
matter. I likely wouldn't be around long enough to have to personally
deal with the long-term consequences (pay the debt as you say).

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


Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Michael Torrie
On 2/11/20 4:05 AM, Chris Angelico wrote:
> Or just the recognition that, eventually, technical debt has to be
> paid. 

Speaking about technical debt is certainly fashionable these days.  As
if we've somehow discovered a brand new way of looking at things.  But
it doesn't matter what you do, there's always real cost, and therefore
always technical debt. Moving to Python 3 incurs technical debt.
Staying with Python 2 incurs technical debt.  Thus I wonder if the term
is actually that useful.

I know what you mean, though.  The cost of staying with Python2 is
increasing rapidly compared to the cost of porting to Python3.  Unlike
the nebulous term, "technical debt," the cost of staying with Python2 vs
porting to Python3 can be quantified in real dollar amounts.  I've no
doubt that the calculus is in favor of Python2 a while longer for many
people.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make a cross platform python app with pyinstaller??

2020-02-04 Thread Michael Torrie
On 2/4/20 8:33 PM, Chris Angelico wrote:
> On Wed, Feb 5, 2020 at 2:32 PM Souvik Dutta  wrote:
>>
>> Hi,
>> I made a python gui with pyqt5 and packed it with pyinstaller. It is
>> running well in my computer but when I gave it to a friend who doesn't have
>> any python version installed and it didn't run. The message was "This app
>> cannot be run on your pc.". How can I solve this???
> 
> Distribute the .py file instead. It can then run on any computer with
> Python installed.

And PyQt5 installed of course.  And Qt5.  None of which is likely to be
a commonly installed software package.  Asking someone to install Python
separately to run your app is a tall order, to say nothing of PyQt5.  So
while this answer is technically correct, the larger issue of
distributing Python programs remains.

Furthering Chris's answer a bit, there really is no way to simply
distribute a Python app and all its dependencies in any simple, portable
way.  If the dependencies already exist on the target system, then Chris
is absolutely right. You just give him the py file and he double-clicks
on it and it runs.  That may work some of the time.

The reality is that this is often insufficient.  Your best bet may be to
build an installer that either installs everything you need into a
Program Files directory, or also runs the Python, and PyQt5 installers
to install them system-wide before installing your app and your bundled
shortcuts and program launcher.  Building installers isn't too awful
using a number of free tools, but it's an entire programming domain in
and of itself.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help on PyQt5 !!

2020-01-30 Thread Michael Torrie
On 1/30/20 4:38 AM, Souvik Dutta wrote:
> Hey guys. I might be asking the most childish question. I have a window in
> pyqt5 (a file in python). Let's call it win1.
> I have another pyqt5 (another file in python). Let's call it win2. Now win2
> is called when add button in win1 is clicked. So far no problem. But win2
> has another button called save. When this is called I want a label to
> appear in win1. How can I do this?? And how can I have a number of labels
> like this when a certain condition is fulfilled?? Thank you in advance for
> your help.

There are some additional resources you might consider using, and will
likely get faster responses with regards to Qt questions.  First is the
PyQt5 mailing list.
https://www.riverbankcomputing.com/mailman/listinfo/pyqt .  Also there
are the normal Qt forums: https://forum.qt.io/

As to your question, you can add a label to a window the same way you
would add the label in the first place.  Likely you'll want a QBoxLayout
widget to place the label(s) into, with the addWidget() method.  Take a
look at the Qt docs for signal, methods, etc.
https://doc.qt.io/qt-5/qboxlayout.html .  For the most part, PyQt5's
method calls, signals, and slots, are the same in Python as they are in C++.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyQt5 QLineEditor help!!!

2020-01-29 Thread Michael Torrie
On 1/29/20 6:11 PM, Souvik Dutta wrote:
> Hi guys I just started to learn PyQt5 and was wondering if like kivy we can
> delete the text in a textbox after taking the input. That is I want to make
> the textbox blank after the text is read. Also can you suggest a way to
> connect a cancel button with a function so that when the cancel button is
> clicked it exists a window. Tank you in advance.

How do you know when the input is done (taken)?  If it's from pressing
Enter, then you'll probably have to capture that keystroke somehow (is
there a signal defined in QWidget that might do that?).  If it's from a
button press that activates something, then from the button click
callback handler you would call clear() on the QLineEditor instance.

You can definitely close a window on a cancel button click.  If you just
want to hide the window for displaying in the future, call
setVisible(false) on the window object.  If you want to destroy the
window object, you would probably call the "destroy()" method of the
window, and then delete the python reference to it (either let it go out
of scope, or use del on it).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help on dictionaries...

2020-01-29 Thread Michael Torrie
On 1/29/20 6:14 PM, Souvik Dutta wrote:
> Hey I was thinking how I can save a dictionary in python(obviously) so that
> the script is rerun it automatically loads the dictionary.

You could use the pickle module for that. See the python.org
documentation on pickle.

Alternatively you could use a json library to write the dict to disk.  I
think this might be preferable to pickle in many situations.

Or serialize the data yourself to a file.

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


Re: Python-list Digest, Vol 196, Issue 26

2020-01-27 Thread Michael Torrie
On 1/27/20 12:03 AM, אורי wrote:
> Please don't reply to digest.

Replying to a digest is just fine. Just make sure to change the subject
line in the future so people know what it's referring to.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Clarification on Immutability please

2020-01-21 Thread Michael Torrie
On 1/21/20 6:52 PM, Ethan Furman wrote:
> On 01/21/2020 10:55 AM, Michael Torrie wrote:
> 
>> Slicing
>> returns a new object whether one is slicing a tuple, list, or a string,
>> the latter two are mutable objects.
> 
> Strings are not mutable.

Yup I got my items in the wrong order. I meant to say list, tuple, or a
string, the latter two are immutable objects.  Thanks for correcting me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Clarification on Immutability please

2020-01-21 Thread Michael Torrie
On 1/21/20 11:38 AM, Chris Angelico wrote:
> Are you sure that it does? I can't reproduce this. When you slice the
> first two from a tuple, you create a new tuple, and until the
> assignment happens, both the new one and the original coexist, which
> means they MUST have unique IDs.

And furthermore this has nothing to do with immutability. Slicing
returns a new object whether one is slicing a tuple, list, or a string,
the latter two are mutable objects.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Debian Buster: ModuleNotFoundError: No module named 'mysql'

2020-01-18 Thread Michael Torrie
On 1/18/20 9:03 AM, ^Bart wrote:
>> What could I do to fix this issue?! :\
> 
> I understood I have Python 2.7 and Python 3 but I can't install modules 
> on Python 3... :\
> 
> ^Bart

pip is probably defaulting to Python 2.7. Try using pip3, or this more
explicit syntax:

python3 -m pip install 


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


Re: Floating point overflow and underflow

2020-01-07 Thread Michael Torrie
On 1/7/20 8:46 PM, Shashank Tiwari wrote:
> Yes, I tried this and it worked. I was wondering if I could use the output
> of pow (or math.pow).

Sure:

pow(Decimal('2.2'), Decimal('0.45'))

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


Re: Floating point overflow and underflow

2020-01-07 Thread Michael Torrie
On 1/7/20 8:18 PM, Shashank Tiwari wrote:
> Thanks Chris. What if it's pow(2.2,0.45)?

Why not do some more experimentation:

>>> import decimal
>>> a = decimal.Decimal('2.2')
>>> b = decimal.Decimal('0.45')
>>> a ** b
Decimal('1.425903734234490793207619170')

Is this what you mean? I'm sure there are other ways as well.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, Be Bold! - The Draft

2020-01-06 Thread Michael Torrie
On 1/6/20 6:33 PM, Abdur-Rahmaan Janhangeer wrote:
> No, i did not write that, it's not Abdur-Rahmaan Janhangeer wrote rather

My mistake. I see now that it was something you forwarded to the list
from someone else.

Doesn't change my reply, though.  Whoever said it, it's not very
relevant.  Who's "us" and what is it the Python gives them that Julia
will soon take over?

Python is lots of things to lots of different people.  I'm not surprised
it fits some people's needs more than others.  Julia is a fine language
and I encourage the original poster to explore it if it fits his or her
needs.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re:

2020-01-06 Thread Michael Torrie
On 1/6/20 10:06 AM, AAKASH JANA wrote:
> Julia is a rapidly progressing language directly attacking python's sweet
> spot in a.i , m.l and other computational areas. I love python and want it
> to remain undefeated . I think its time we create a compiler for python .
> So that python can be compiled and interpreted at will . Its time we make
> our snake go faster than the world.(and most importantly Julia)

Why is it so important for "python to remain undefeated?" Furthermore
what do you suppose Python is "undefeated" at?  If Julia is better
suited to certain computational areas, then more power to it.  As I
posted just a few minutes ago, languages come and go, and specialize in
certain things.  Python certainly is popular right now and good at lots
of things, but something else might come along and relegate it to a fond
memory.

Besides, for obvious reasons, Python doesn't lend itself to compiling.
It's too dynamic.  Either you get slow executables where some code can
be compiled and other bits are interpreted (nuitka), or you get a
language that is a subset of python that compiles to a very fast
executable or library (Cython).

Honestly, for what most people use Python for, compiling is of little
value.  Even math people who use Python, rely on numpy or similar
high-speed libraries which are written in a compiled language and used
from Python.  This is, in my opininon, what Python excels at.  It's an
easy-to-use glue for connecting parts.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, Be Bold! - The Draft

2020-01-06 Thread Michael Torrie
On 1/6/20 10:24 AM, Abdur-Rahmaan Janhangeer wrote:
> Maybe but if you know or have heard of Julia the language. You will realise
> its going to take over what python gives us. So i think there is urgent
> need for upgrades to newer versions of python to make basic tasks on python
> way quicker.

No it sure won't.  You can't possibly make such a blanket statement.
Julia might replace python for some users, perhaps those involved in
data science, but Python stands on its own merits. And currently that
standing is pretty good.  If that changes in the future, oh well.
Languages come and go.  Besides all that, if some users find Julia fits
their need better, why is that a bad thing?  You talk like it's a zero
sum game. It's not.  I don't see where this urgency is coming from.

Put in another way, Python fills the needs of many users at present.
This isn't going to magically change because you see something that is
deficient in your opinion.


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


Re: Error in python installation - was Re: Python, Be Bold!

2020-01-05 Thread Michael Torrie
On 1/5/20 7:59 AM, Kishor Soni wrote:
> After proceeding installation, few minutes later such error appears 
> "0x80072f7d - unspecified error"
> A log file is generated and attached herewith

I prefer to keep communication on the list.  Where did you download the
installer from?  Python.org or some other distribution like Anaconda?
Are you installing for all users, or just for your current user?  What
has google found about this error message and python?  Does google tell
you whether anyone else has seen this error message while installing
Python before?

I don't have Windows, so I can only speculate, and do the same google
searches you can do.

Finally, have you tried installing Python through the Microsoft Store on
Windows 10?  It's officially released by python.org core devs and should
always be free.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re:

2020-01-04 Thread Michael Torrie
On 1/4/20 3:29 PM, William Johnsson wrote:
> Hello! My name is William and im 14 years old and live in sweden.  Im
> pretty new to programing in python and i need some help with code,
> (That’s why i’m here). But i couldn’t really find what i was
> searching for on the internet. I’m trying to write code that can
> check only the first line in a .txt file and check if it’s the same
> as the int 1000.   I preferably want it to be an if satement but
> anything works, i just don’t know how i should write it. I’ve been
> browsing the internet for a solution but sadly can’t seem to find a
> solution to it.
> 
> I don’t really know if this is the right way to get help or even if
> this email is for something else. Hopefully i will get some kind of
> response.
> 
> Best regards, William

Welcome, William.  Another mailing list you might want to post to is the
Python Tutor list (https://mail.python.org/mailman/listinfo/tutor) which
is focused on people learning Python.

Seems like your problem can be broken down into a few steps:
1. Open a file
2. Read the first line
3. look for "1000" in that line.

Learning how to read from a text file would probably be the first thing
to look into.  See in particular chapter 7.2 in this section of official
tutorial.  https://docs.python.org/3/tutorial/inputoutput.html

You may also google for other examples of opening and reading lines from
a text file in Python.

Once you've been able to read in a line, you can do a simple search in
that line using the "in" keyword (mentioned part way down the page
https://docs.python.org/3/library/stdtypes.html in the section called
"Common Sequence Operations").

Hopefully you'll find this useful rather than just giving you a complete
little program (where's the fun in that!).


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


Re: Python, Be Bold!

2020-01-03 Thread Michael Torrie
On 2020-01-03 5:44 p.m., Abdur-Rahmaan Janhangeer wrote:
> .jar provides more than just compression. It provides app info and has
> signing ability

This is the first time you've mentioned signing ability in this very
long thread.  At this point I have no idea what point you are even
making anymore.  It's all over the place!

If you coded up something concrete to share with the list, and described
it in the form of a PEP, and then it could be debated on its merits
rather than some ever-changing feature wish list.  Your ideas may well
be good.  But they will need an implementation behind them.  Python core
developers have a lot on their hands; pie in the sky wishes are unlikely
to get on their radar.

Several people have suggested utilities to look at. I suggest you start
there and see if you can modify them to suit your needs.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, Be Bold!

2020-01-02 Thread Michael Torrie
On 1/2/20 2:11 PM, Abdur-Rahmaan Janhangeer wrote:
> But single file are better suited for distribution.

Maybe.  Most windows applications are distributed with installers.  I've
made several bundles over the years with Nullsoft's installer builder.
That's how commercial companies, including those that use Python,
distribute their applications.  Here's a popular open source application
build on Python, and it's installer (a single msi file):
https://calibre-ebook.com/download_windows

I haven't seen very many single-exe windows applications ever.

Anyway we can argue forever about what ought to be.  But until someone
does it and proves that it's important, it's not going to happen.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, Be Bold!

2020-01-02 Thread Michael Torrie
On 1/2/20 1:42 PM, Abdur-Rahmaan Janhangeer wrote:
> I am not proposing native executables, but a .jar like executable. The term
> executable refers to one click run.

But a jar file is not executable on Windows and never has been.  You
can't go to the cmd.exe window and type "myprogram.jar."  Maybe it can
be opened with a file association linking it to a Java runtime
executable. But it's certainly not a Windows executable.  And I've never
ever seen anyone launch a java jar file by double clicking on it.  Most
people provide .bat files to start it, or a lnk file that contains the
necessary java flags.

As Chris said with file associations you can already double-click on a
py file (or pyw without a console window by convention).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, Be Bold!

2020-01-02 Thread Michael Torrie
On 1/2/20 1:33 PM, Chris Angelico wrote:
> Using a package manager means you have ONE copy of the Python
> interpreter, and all your scripts depend on it. If you update that
> interpreter, ALL scripts benefit from the update. This is a solved
> problem.

Except that it's not actually a solved problem.  We thought it was but
then found the limitations.  Linux distros are actually moving away from
a pure packager dependency model, especially for applications. System
components, yes. Makes a lot of sense. Makes less sense for user-facing
things.  That's why there's a lot of movement going with regards to
solutions like flatpak, snap, and even AppImage.  RPMs and debs are
never going to go away, but they do have limitations for the kind of
thing the OP is talking about.  Right now in Fedora land, a very
appropriate way to bundle a python application is in a flatpak, bundled
with the appropriate versions of Python and the libraries you depend on.
 More and more apps on Ubuntu are being delivered via snaps too.
Especially ones that move fast like Firefox, or even LibreOffice.

I use several apps that are flatpaks because my distro is old and stable
(CentOS 7) and doesn't have a lot of the dependent shiny libs modern
apps require. Flatpak lets me run them while keeping the core system
very conservative and stable.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, Be Bold!

2020-01-02 Thread Michael Torrie
On 1/2/20 2:41 AM, Abdur-Rahmaan Janhangeer wrote:
> i wonder who uses windows

If this kind of thing is important to a user , what you propose would
probably be the responsibility of the entity that is producing a Python
distribution, such as Anaconda.  Usually in such cases these
distributions are not targeted at developers per se, but scientific
users who write small programs to solve particular problems.  And it may
be appropriate in that case.

Python is just a language specification and some tools (including a
reference implementation of the interpreter and standard library). It's
not an IDE and it's not a software distribution.  I know that other
languages have turned themselves into such things.  Particularly node.js
with npm, and that has been a real mess on occasion.  I haven't heard
anything about Java being like this, though.  I guess Visual Studio has
added a package manager.  However that's separate from the language
itself (C#, C++, etc).

How would you determine what should be updated? The core libraries are
already updated with the interpreter version, and have some dependency
on the interpreter version.  You seem to be suggesting that third-party
libraries from PyPi or other places should automatically update, and
that seems like a bad idea to me, as they each operate under their own
standards of API compatibility, quality, and so forth.  All you have to
do is look at the mess that is npm in node.js to see what this idea has
some real problems if you were to update everything in one swoop in a
semi-automated fashion.

Personally if I were working on a large Python project that I wanted to
release to clients involving a few third-party packages, I would not be
interested in any sort of automatic updating.  Without testing, such
automatic updates could easily break my program.  And the last thing I'd
want is a client or customer to be updating dependencies on his own!

How would you address these issues?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: urllib unqoute providing string mismatch between string found using os.walk (Python3)

2019-12-21 Thread Michael Torrie
On 12/21/19 2:46 PM, Ben Hearn wrote:
> These 2 paths look identical, one from the drive & the other from an xml url:
> a = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate! 
> _PromoMix_.wav'
   ^^
> b = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate! 
> _PromoMix_.wav'
   ^^
They are actually are different strings.  The name is spelled
differently between the two.  Móchate vs Móchate (the former seems to
be the correct spelling according to my inline spell checker).  Is this
from your own program? I wonder how it got switched?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Troubleshooting

2019-12-12 Thread Michael Torrie
On 12/12/19 8:03 PM, Python wrote:
>> Just when I think Windows 10 is a pretty decent system, I encounter
>> something inexplicable like this.
> 
> We've gone through that before, haven't we?

Yup, Several times.  The good news is her son finally got it installed
by launching the installer from explorer.  So must have been some stupid
MS Edge thing interfering with running the installer. Trying to be
intelligent I'm sure.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Troubleshooting

2019-12-12 Thread Michael Torrie
On 12/12/19 6:33 PM, Python wrote:
> catherine morris wrote:
>> Good evening,
>>
>> My son is trying to download python 3.8.0 on my PC, which has Windows 10,
>> and it won't install properly. I'm not tech savvy and have no idea where to
>> start.
> 
> What happened exactly? Did you download the official installer from
> python.org, then click on next, next, next, checking the box (if it's
> still there about updating PATH)? There is nothing more to do.

I communicated more with the original poster off list and will try to
relate what is happening here.  This type of thing I've never
encountered before and is hard to describe in just plain text,
especially for a non-technical person.  Essentially trying to launch the
official, downloaded installer from Python.org causes a message to pop
up warning about installing third-party applications and opens the
Microsoft Store and apparently points at the Python installation there.
Unfortunately installing through the store fails for some reason.

I've seen github bug reports about Windows launching the store when
trying to run Python, but those appear to be after a successful
installation, and the solution there is making sure the installed
version of Python is set in the $PATH.  It's possible this is the issue
here.  If so she'll have to get someone locally to take a look at her
machine. Not sure about talking her through debugging the PATH.

Another possibility is that she's running a laptop with Windows 10S,
which limits what can be installed. That would explain why the Windows
Store installation fails.  But I don't know.

Just when I think Windows 10 is a pretty decent system, I encounter
something inexplicable like this.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Troubleshooting

2019-12-12 Thread Michael Torrie
On 12/12/19 5:40 PM, catherine morris wrote:
> Good evening,
> 
> My son is trying to download python 3.8.0 on my PC, which has Windows 10,
> and it won't install properly. I'm not tech savvy and have no idea where to
> start.
> 
> Catherine Morris

I just learned today that Python is officially available in the
Microsoft Store app in Windows 10.  If you run the Windows Store and
search for Python, you should find Python 3.8.0 and it will be listed as
free.  Click install (if it asks you to log in, click no thanks).  After
it downloads and installs you should find "Idle" in the start menu,
which is probably where your son will want to start.  Idle is a code
editor and and an environment in which to run the python programs.  See
this url for an introduction to Idle.  https://realpython.com/python-idle/

Hope this helps!

Michael

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


Re: Python3 - How do I import a class from another file

2019-12-10 Thread Michael Torrie
On 12/10/19 2:08 PM, R.Wieser wrote:
> You might know a thing or two about Python, but you (and a number of others
> here) positivily stink as teachers, incapable or even unwilling to place
> themselves in the shoes of a newbie.

As it happens, I've heard Chris speak about teaching Python to students.
 I suspect they learn rather well from him.  Chris is a very articulate
and great explainer.

It's a two-way street.  It's hard to teach someone that won't be taught.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python3 - How do I import a class from another file

2019-12-10 Thread Michael Torrie
On 12/10/19 11:47 AM, R.Wieser wrote:
> Who did I call stupid ?I mentioned that the language doing it as Chris 
> thinks it happens would be stupid, and I gave a reason for that (race 
> conditions everywhere).  But odd: Neither him nor you nor anyone else who 
> complains about me thinking for myself has even /tried/ to shoot holes in my 
> example (or explain, let alone underbuild their own stance).  Do you have 
> /any/ idea to what that makes me think ?  Yeah, exactly that. :-((

You said it by implication.

quote:  "And as I do not think the designers of the language where that
stupid I must therefore reject your claim to what you think happens."

Since the language does behave as Chris described (calling __del__ does
not always happen when you want or think it does, hence the "with"), you
have implied that Guido and friends are stupid and that you are not.

You can imply that I'm stupid all you want because I can't "shoot holes
in your example" to your satisfaction.  Doesn't change the fact that
what we've told you are facts about Python's operation.  I'm stupid
about many things but not this one.

>> Doesn't reflect well on you, who by your own admission is still learning
>> the language.
> 
> True, I'm a newbie learning /Python/.   But it is far from the first 
> language I've used.  Experience /does/ count for something you know. :-)

In this case your experience is perhaps leading you astray when it comes
to Python.

>> And that's exactly what Chris and others did.  They explained the facts
> 
> No, they didn't.  They just TOLD me /their/ "facts".  Not an explanation 
> anywhere. :-(

There's no such thing as "their facts."  There are facts, lies, and just
opinions.  What Chris said was fact.  Even if it isn't supported by your
brief and incomplete testing.

I was quite happy to see your posts up until this point. It appeared
that you were making great headway and maybe even enjoying Python. But
now I fear you're going to end up in a lot of awesome contributors'
killfiles.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python3 - How do I import a class from another file

2019-12-10 Thread Michael Torrie
On 12/10/19 5:44 AM, R.Wieser wrote:
>> Well, that's exactly what happens.
> 
> So, only the reference count gets lowered.  Yep, thats daft.

Why?  Consider:

a = someobject
b = a

How many references for someobject?  After "del a" what should be be?
It's still someobject (the same object).

Or the example Antoon provided:

def foo()
   b = Bar()
   return b
   # b reference is deleted automatically


> ... unless you explain why it can only be done that way.

That is how a ref-counting resource management system works.

> I tend to go with logic.   No logic => it most likely doesn't work that way.

Interestingly I just saw a podcast recently titled, "Why too much logic
leads to irrationality."  In this case your logic is faulty because, as
you say, you lack information, which others have tried to provide.

> Choosing to go with a delayed action like you say will, as I already 
> explained, create problems later on (race conditions everywhere).  And as I 
> do not think the designers of the language where that stupid I must 
> therefore reject your claim to what you think happens.

No, that is exactly what happens.  And for good reasons.  Google for
reference-counting garbage collection.  This is not just some brand new
Python thing.  Be careful who you call stupid.  Seriously.  Doesn't
reflect well on you, who by your own admission is still learning the
language.  Python is not C++; don't code like it is.  If you need
semantics that are like RAII, then as Chris has said, you need to look
at the "with" statement and context handlers.


> But, as you mentioned, I do not know (all) the facts.  Please do present 
>them.   Maybe there is a logic in there I do not yet see.

And that's exactly what Chris and others did.  They explained the facts
and how relying on "del" to release the GPIO pin only works because you
got lucky.

>> Check out the 'with' statement.
> 
> I'm sorry, but nope.

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


Re: Aw: Re: stuck on time

2019-12-08 Thread Michael Torrie
On 12/8/19 11:47 AM, RobH wrote:
> Err, excuse me, I was not attempting to hack into someone else's code.
> As the code is in the public domain, I wanted it to work as is, like it 
> did for the author, without changing anything.

No worries, you're totally fine.  The word "hack" means something
different.  To hack means to work on, learn, modify, etc.  It's a
positive word in this context.  I was hacking on python code myself
yesterday.

> So why should I now start to learn how python works.

Well if you learn how Python works, then a lot of what you are trying to
do will become easier and make more sense.  For example, knowing how
Python works will tell you why your print_time() function returns
nothing (hint, the code you posted does not show a "return" statement,
hence the function will not return anything).

> If the code doesn't work for me after a fair trial, I'll move on to 
> something else.

I can sense that you are frustrated, and I can also sense frustration on
the part of those trying to assist you. I hope you will give it a fair
trial as the entire endeavor, and Python in particular, can be really
fun once you grasp it!

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


Re: IOError: cannot open resource

2019-12-07 Thread Michael Torrie
On 12/7/19 9:48 AM, RobH wrote:
> On 07/12/2019 16:00, Dan Sommers wrote:
>> On 12/7/19 9:43 AM, RobH wrote:
>>> When I run a python project with an oled display on a rasperry pi zero,
>>> it calls for the Minecraftia.ttf font. I have the said file in
>>> home/pi/.fonts/
>>
>> Do you mean /home/pi/.fonts (with a leading slash, an absolute path
>> rather than a relative one)?
>>
>> Dan
> 
> Not sure how you mean, but it is just as I typed it, with a forward or 
> leading slash.
> I have it solved now, with a different font.

What he means is that according to the stack trace you were asking for:
   home/pi/.fonts/Minecraftia.ttf

instead of
   /home/pi/.fonts/Minecraftia.ttf

If you cut and paste the traceback then that is what happened.  Likely
when you tried a different font you added the missing / and all was well.

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


Re: Error getting data from website

2019-12-07 Thread Michael Torrie
On 12/7/19 3:53 AM, Peter Otten wrote:
> 
> ... because Amazon doesn' like what you do. You can cheat or play by their 
> rules and use the API.

Yup and although I have no love for Amazon, I can understand why they
don't want bots on the site. Already they have enough trouble with bots
buying up merchandise that gets resold on the grey market later.  And
also fake reviews.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error getting data from website

2019-12-06 Thread Michael Torrie
On 12/6/19 5:31 PM, DL Neil via Python-list wrote:
> If you read the HTML data that the REPL has happily splattered all over 
> your terminal's screen (scroll back) (NB "soup" is easier to read than 
> is "content"!) you will observe that what you saw in your web-browser is 
> not what Amazon served in response to the Python "requests.get()"!

Sadly it's likely that Amazon's page is largely built from javascript.
So scraping static html is probably not going to get you where you want
to go.  There are heavier tools, such as Selenium that uses a real
browser to grab a page, and the result of that you can parse and search
perhaps.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Developers are advised to purge these malicious packages

2019-12-04 Thread Michael Torrie
On 12/4/19 10:59 AM, David Lowry-Duda wrote:
> I notice that "python3-dateutil" is in over 4000 github repositories 
> [1]. That sounds like a disaster.
> 
> [1]: https://github.com/search?q=python3-dateutil=Code

It's clearly not, as Christian has already said. In fact it would be
very difficult to determine from a github search whether this bad
package was actually deployed anywhere. Since it presents a fake
"dateutil" module, imports would look the same and proper as using the
correct one.  The only way this package comes into play is if someone
pip installed it, or had an install script that installed it, or if it
were bundled in the source tree.

So this is very bad indeed, but not as bad as you suggest. We're not
nearly as much at risk as node.js npm users are yet.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: increasing the page size of a dbm store?

2019-12-02 Thread Michael Torrie
On 12/1/19 7:50 PM, Tim Chase wrote:
> After sparring with it a while, I tweaked the existing job so that it
> chunked things into dbm-appropriate sizes to limp through; for the
> subsequent job (where I would have used dbm again) I went ahead and
> switched to sqlite and had no further issues.

How did you replace a key/value store with a relational database?  Is a
SQLite database fast enough at this sort of thing that it wasn't really
designed for?
-- 
https://mail.python.org/mailman/listinfo/python-list


<    1   2   3   4   5   6   7   8   9   10   >