Re: Keeping a list of records with named fields that can be updated

2022-12-19 Thread songbird
Peter Otten wrote:
...
> I recommend that you use a dataclass /instead/ of a namedtuple, not
> both. However, for a dataclass with the same fields in the same order as
> in your namedtuple the conversion is trivial:
>
> Create compatible namedtuple and dataclass types:
>
> >>> NTRow = namedtuple("NTRow", ["alpha", "beta", "gamma"])
> >>> DCRow = make_dataclass("DCRow", NTRow._fields)
>
> Build the namedtuple:
>
> >>> ntrow = NTRow(1, "two", 3.0)
> >>> ntrow
> NTRow(alpha=1, beta='two', gamma=3.0)
>
> Convert to dataclass:
>
> >>> dcrow = DCRow(*ntrow)
> >>> dcrow
> DCRow(alpha=1, beta='two', gamma=3.0)

  thanks, once i get the data in from the file i only have
to reference it, but for the rest of the code i can use
the dataclass instead and that will be easier to read than
dicts.  :)

  your help is appreciated.  :)


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


Re: Keeping a list of records with named fields that can be updated

2022-12-18 Thread songbird
Peter Otten wrote:
...
> While I think what you need is a database instead of the collection of
> csv files the way to alter namedtuples is to create  a new one:
>
> >>> from collections import namedtuple
> >>> Row = namedtuple("Row", "foo bar baz")
> >>> row = Row(1, 2, 3)
> >>> row._replace(bar=42)
> Row(foo=1, bar=42, baz=3)

  namedtuple is easier to use as that will use the csv and
csvreader and create the records without me having to do any
conversion or direct handling myself.  it's all automagically
done.  my initial version works, but i'd like it to be a bit
more elegant and handle descriptions it hasn't seen before
in a more robust manner.


> An alternative would be dataclasses where basic usage is just as easy:
>
> >>> from dataclasses import make_dataclass
> >>> Row = make_dataclass("Row", "foo bar baz".split())
> >>> row = Row(1, 2, 3)
> >>> row
> Row(foo=1, bar=2, baz=3)
> >>> row.bar = 42
> >>> row
> Row(foo=1, bar=42, baz=3)

  i do like that i can directly reference each field in a
dataclass and not have to specify a _replace for each change.

  is there an easy way to convert from namedtuple to dataclass?
i can see there is a _asdict converter, but don't really like
how that turns out as then i have to do a bunch of:
rec['fieldname'] = blah

rec.fieldname is much easier to understand.


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


Re: Keeping a list of records with named fields that can be updated

2022-12-15 Thread songbird
Peter Otten wrote:
>
> While I think what you need is a database instead of the collection of
> csv files the way to alter namedtuples is to create  a new one:

  the files are coming from the web site that stores the
accounts.  i already have manually created files from many
years ago with some of the same information but to go back
and reformat all of those would be a lot of work.  it is
much easier to just take the files as supplied and process
them if i can do that instead.

  i do know database stuff well enough but this is fairly
simple math and i'd like to avoid creating yet another
copy in yet another format to have to deal with.


> >>> from collections import namedtuple
> >>> Row = namedtuple("Row", "foo bar baz")
> >>> row = Row(1, 2, 3)
> >>> row._replace(bar=42)
> Row(foo=1, bar=42, baz=3)
>
> An alternative would be dataclasses where basic usage is just as easy:
>
> >>> from dataclasses import make_dataclass
> >>> Row = make_dataclass("Row", "foo bar baz".split())
> >>> row = Row(1, 2, 3)
> >>> row
> Row(foo=1, bar=2, baz=3)
> >>> row.bar = 42
> >>> row
> Row(foo=1, bar=42, baz=3)

  thanks, i'll give these a try.  :)


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


Keeping a list of records with named fields that can be updated

2022-12-14 Thread songbird


  I'm relatively new to python but not new to programming in general.

  The program domain is accounting and keeping track of stock trades and other 
related information (dates, cash accounts, interest, dividends, transfers of 
funds, etc.)

  Assume that all data is CSV format.  There are multiple files.

  Assume there is a coherent starting point and that all data is in order.

  Assume each line contains a description.  The description determines what the 
line is.  The number of fields in the line does not change within the data file 
but it may happen that later lines in other files may be different other than 
the fact that they all must contain a description.

  All descriptions are deterministic (none are recursive or referencing things 
from the future).  All things referenced in the description which do not 
already exist are added to a list (or perhaps more than one in a few cases) and 
may contain some basic information (the date, how many and for how much, or a 
total amount or a fee or ...)  If the field of the line isn't a number it is 
either a symbol or a description.

  A default action is simply to keep most parts of the line and to adjust any 
totals of a previously seen description that matches by whatever amounts are on 
the line.  The key is the description.

  I've already written one program based upon the files I already have which 
works but what happens is that new descriptions are added (new accounts, new 
stocks, etc.) and I don't want to have to write new code manually every time a 
description changes.

  I started using named tuples (it works for reading in the files and accessing 
the fields) but I cannot update those so I need to use something else to give 
me the list of unique descriptions and fields that I need to update.  I've not 
gotten beyond that yet as I'm still learning.

  Suggestions?

  Thanks!  :)


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


my python progress

2021-09-01 Thread songbird
olor[3]) / x_border
step_y_alpha = (self.border_color[3] - self.color[3]) / y_border

# bottom and top row(s)
red_x = self.border_color[0]
green_x = self.border_color[1]
blue_x = self.border_color[2]
alpha_x = self.border_color[3]
for x in range(x_border):
for y in range(width-(x*2)):
indx_lower = (x*width*4)+((y+x)*4)
indx_upper = ((height-(x+1))*width*4)+((y+x)*4)
data[indx_lower] = int(red_x)
data[indx_upper] = int(red_x)
data[indx_lower+1] = int(green_x)
data[indx_upper+1] = int(green_x)
data[indx_lower+2] = int(blue_x)
data[indx_upper+2] = int(blue_x)
data[indx_lower+3] = int(alpha_x)
data[indx_upper+3] = int(alpha_x)

red_x -= step_x_red
green_x -= step_x_green
blue_x -= step_x_blue
alpha_x -= step_x_alpha

# left and right col(s)
red_y = self.border_color[0]
green_y = self.border_color[1]
blue_y = self.border_color[2]
alpha_y = self.border_color[3]
for x in range(y_border):
for y in range(height-(x*2)):
indx_left = (((y+x)*height)+(x))*4
indx_right = (((y+x)*height)+(width-x-1))*4
data[indx_left] = int(red_y)
data[indx_right] = int(red_y)
data[indx_left+1] = int(green_y)
data[indx_right+1] = int(green_y)
data[indx_left+2] = int(blue_y)
data[indx_right+2] = int(blue_y)
data[indx_left+3] = int(alpha_y)
data[indx_right+3] = int(alpha_y)

red_y -= step_y_red
    green_y -= step_y_green
blue_y -= step_y_blue
alpha_y -= step_y_alpha

img_data = ImageData(width, height, 'RGBA', bytes(data))
return img_data

=

  so never give up hope of teaching an old dog some new tricks.  :)


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


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread songbird
Christian Gollwitzer wrote:
> Am 13.01.21 um 06:24 schrieb Greg Ewing:
>> On 13/01/21 4:18 am, Grant Edwards wrote:
>> 
>>> AFAIK, Python can't be used to write device drivers for any popular OS
>> 
>> At least not until some crazy person embeds Python in the
>> Linux kernel...
>
>
>   What do you mean, "until" ?
>
> https://medium.com/@yon.goldschmidt/running-python-in-the-linux-kernel-7cbcbd44503c
>
> http://www.kplugs.org/

  yes!  haha!  :)  love it!  wish i had time to play now.


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


conceptual problem (was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread songbird
Chris Angelico wrote:
...projects that fade...
> That's not really something Python can ever control, but I can say
> with some confidence that the big libraries like Qt and GTK are going
> to adapt, one way or another. And perhaps more importantly: Neither
> input()/print() nor web applications is going *anywhere*. You are
> ALWAYS going to have those two as options.

  :)  i hope so. :)

  at the moment i've only done things with GTK and pyglet.
since i am way too new at python i can't say the code is
pretty, but it does work.

  my momentary conceptual problem is that to me OOP means
being able to encapsulate data structures and code from
other parts of the program, but to me it doesn't look like
that is how python is designed.  this is probably a complete
aside to this whole thread and perhaps even this newsgroup
so i'll subthread this.


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


Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread songbird
DonK wrote:
>
> Hi, I'm thinking about learning Python but I'm 74 years old and will
> very likely not ever have a programming job again. I used to program
> in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe"
> languages. It's been about 18-19 years since my last programming job.
> I do understand programming concepts but I'm really not up on any of
> the more modern programming languages.

  hi Don,

  you sound like you have a similar perspective to my own
except i'm a bit younger.  :)


> I've installed Python 3.7, the PyCharm IDE and watched some Youtube
> tutorials but it's been stretched out over about 1.5 years so I'll
> probably need to go back to the beginning. My problem is that I don't
> understand how Python programs are used. (i.e user input and output)
> Is Python mainly used for backends?

  it can be used for pretty much anything except perhaps
high pressure real time things, but i bet someone else will
know that is being done too, i've just not heard of it.  :)


> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
> look kinda like adding a family room onto a 1986 double wide mobile
> home, and they look even more complicated than creating a GUI from
> scratch in C++ with a message loop, raising events . . .

  i tried pyglet just because it was the first one that i
could figure out without it being too complicated.


> So, what do you folks use Python for?

  for me i used it to learn python and wrote a simple game
which adapted an already existing game written in C to python.
since i don't really understand python and have issues with
some concepts it hasn't gone much further lately and i'm
ok with that.


> Nowdays I mainly just use programming for rather small utilities for
> my personal use. Currently I'd like to write something to iterate
> through open windows and save them to different folders depending on
> if the titlebar contains certain strings. In the past I would probably
> have used Excel's VBA to do this but I no longer have Excel installed
> on my main computer. I'd like a bit of a challenge but I don't want to
> spin my wheels trying to learn something that will be a dead end for
> me.

  i am so familiar with Bash shell script language and C 
that either of those would normally be my first choice
because i already have tools done for enough things and
i know what i'm doing.

  for python i just spend too much time fumbling around
and i don't really know what is current and if i'm using
something that will be kept up for the future or if the
project is going away or in a direction that i won't like
(both KDE and Gnome desktops messed me up with what they
did after i spent a lot of time finding them, getting
them set up and then they changed and i switched only to
have the other do the same to me so i switched again to
Mate and that at least has been more stable to my style of
doing things).

  uh, so, i think i do understand your aims and perspective
and hope you can get further in your goals.  :)


> I know that this probably seems like a stupid post but your input will
> be useful.
>
> Thank you.
>
>Don
>
> I know that Python is a very popular language so I'm sorry if it
> sounds like I'm being critical. I really don't know enough about it to
> be critical.

  heh, well, if you go back and read some of my previous posts
here you'd see a lot of dumb things i've said too.  don't worry.
i'm sure i'll make other dumb posts too, but at the moment i'm
mostly in a holding pattern for a while.  i have a few other
big projects i need to finish before i get back to python again.


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


Re: Debian testing and virtual environment error message

2020-12-27 Thread songbird
Chris Angelico wrote:
> On Mon, Dec 28, 2020 at 2:56 AM songbird  wrote:
...needed to pull a few more things from unstable...
> Ah, yep, that makes sense. I was a tad concerned about the mismatch of
> versions, but honestly, I don't think I've ever installed Python from
> testing or unstable (unless I'm running the entire distro on testing).
> It's much much easier and safer to keep the system Python untouched,
> and then build my own from source; my "python3" command, at the
> moment, runs 3.10 pre-alpha.

  it seems that if there is a dependency between these than it
should have be declared so they won't migrate to testing 
independently.  i'm not sure it is worth filing a bug about
since the transition is not completed yet anyways.

  i run testing on my day to day system because i do want to find
bugs before they make it to stable, especially for the things i
use every day.

  i'm not using the testing distribution for hard production tasks 
so if it breaks and i do need to get on-line i have a few other 
different bootable partitions or even a USB stick just in case.


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


Re: Debian testing and virtual environment error message

2020-12-27 Thread songbird
Chris Angelico wrote:

  ok, i got it to work.  i noticed that there was a 3.8
version of distutils that was not upgraded to 3.9 so once
i specifically pulled that in from the unstable Debian
distribution then it upgraded and my creation of a new
virtual environment would work without errors.

  so for some reason there are some python packages in
unstable that had not get gotten to testing.

  thanks for replying.  :)

  for the record this was what i did:

 apt-get install python3-distutils -t unstable
Reading package lists... Done
Building dependency tree   
Reading state information... Done
The following additional packages will be installed:
   libpython3-all-dbg (3.9.1-1)
   libpython3-all-dev (3.9.1-1)
   libpython3-dbg (3.9.1-1)
   libpython3-dev (3.9.1-1)
   libpython3-stdlib (3.9.1-1)
   python3 (3.9.1-1)
   python3-all (3.9.1-1)
   python3-all-dbg (3.9.1-1)
   python3-all-dev (3.9.1-1)
   python3-dbg (3.9.1-1)
   python3-dev (3.9.1-1)
   python3-lib2to3 (3.9.1-1)
   python3-minimal (3.9.1-1)
   python3-venv (3.9.1-1)
Suggested packages:
   python3-doc (3.9.1-1)
   python3-tk (3.9.1-1)
The following packages will be upgraded:
   libpython3-all-dbg (3.9.0-4 => 3.9.1-1)
   libpython3-all-dev (3.9.0-4 => 3.9.1-1)
   libpython3-dbg (3.9.0-4 => 3.9.1-1)
   libpython3-dev (3.9.0-4 => 3.9.1-1)
   libpython3-stdlib (3.9.0-4 => 3.9.1-1)
   python3 (3.9.0-4 => 3.9.1-1)
   python3-all (3.9.0-4 => 3.9.1-1)
   python3-all-dbg (3.9.0-4 => 3.9.1-1)
   python3-all-dev (3.9.0-4 => 3.9.1-1)
   python3-dbg (3.9.0-4 => 3.9.1-1)
   python3-dev (3.9.0-4 => 3.9.1-1)
   python3-distutils (3.8.6-1 => 3.9.1-1)
   python3-lib2to3 (3.8.6-1 => 3.9.1-1)
   python3-minimal (3.9.0-4 => 3.9.1-1)
   python3-venv (3.9.0-4 => 3.9.1-1)
15 upgraded, 0 newly installed, 0 to remove and 222 not upgraded.


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


Re: Debian testing and virtual environment error message

2020-12-26 Thread songbird
songbird wrote:
...
>   The package mentioned is installed:
>
>
>=
>
> $ dpkg -l | grep python3-venv
> ii  python3-venv 3.9.0-4amd64 
>pyvenv-3 binary for python3 (default python3 version)
>

  here is something i missed including in my first post, but i don't
know if this matters:

ii  python3.9-venv   3.9.1-1amd64   
 Interactive high-level object-oriented language (pyvenv binary, version 
3.9)


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


Re: Debian testing and virtual environment error message

2020-12-26 Thread songbird
Chris Angelico wrote:
...
> $ which python


  /usr/bin/python  for both user and root


  looking at /usr/bin it looks like:

lrwxrwxrwx 1 root   root   7 Nov  3 03:20 python -> python3
lrwxrwxrwx 1 root   root   9 Dec  6 05:36 python3 -> python3.9
-rwxr-xr-x 1 root   root 5479736 Dec  8 02:51 python3.9


  thanks,


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


Debian testing and virtual environment error message

2020-12-26 Thread songbird


  Simlar to Rich's asking about how to deal with python3.9
I'm not able to to get my virtual environment set up to work
now and I'm not sure how to go about fixing this.

  As it is testing I may have broken it somehow but I do not
know how to fix this.

  I asked on the Debian user mailing list and nobody had any
response/ideas.

  Note, this isn't a production system and I don't mind it
being temporarily broken, but I also would like to know what
is going on and how to fix this sort of thing.

  I do have python-is-python3 package installed and there are 
no python2 programs anywhere on this system that I know of.


  When i run the command:

=
$ cd /home/me/src/salsa
$ python -m venv env

  setting up virtual environment /home/me/src/salsa/env
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/home/me/src/salsa/env/bin/python', '-Im', 'ensurepip', 
'--upgrade', '--default-pip']

=


  The package mentioned is installed:


=

$ dpkg -l | grep python3-venv
ii  python3-venv 3.9.0-4amd64   
 pyvenv-3 binary for python3 (default python3 version)

=

  Also the following looks interesting but I'm not sure why there
is no 3.9 version available:

=
$ dpkg -l | grep python-is
ii  python-is-python33.8.6-3all 
 symlinks /usr/bin/python to python3
# su -
  entered password
# apt-get install python-is-python3 -t unstable
Reading package lists... Done
Building dependency tree   
Reading state information... Done
python-is-python3 is already the newest version (3.8.6-3).
0 upgraded, 0 newly installed, 0 to remove and 250 not upgraded.

=

  any ideas?  :)  thanks!


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


Re: songbird's ngfp

2020-11-06 Thread songbird
flaskee wrote:
...
> I look forward to seeing your game.
>
> Thanks!

  unfortunately the system needs a bit more complicated 
things to be installed for ngfp to also be installed.

  pkg-config and the cairo/pycairo stuff and a compiler...

  note, i have not had any chance to look into this
further.  some time ago i did see mention of wheels provided 
by the cairo/pycairo github project, but since it is still
gardening season i've been a bit too busy to poke at this 
more to find out what has happened and how that might change 
the installation of ngfp.

  still, thank you again for trying and for the feedback.  :)


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


Re: Best way to determine user's screensize?

2020-11-02 Thread songbird
Grant Edwards wrote:
> On 2020-11-01, songbird  wrote:
>
>> to keep a program simple i made it to open in the center.
>
> That's not simple: it actually takes _extra_ work to do that.

  this was the first python3 program i wrote, i certainly
do not know python3 or desktop application standards or
much of the other stuff i did, but the program does work
and i'm fine with it as what it is.

  by no means is any program the final statement on any
problem - they are all iterations.  some fail, some go
further.  mayhaps, i'll get further, i can't say at the
present, mainly because my time for programming is not 
that much during the spring/summer/fall.  i'm only taking
a look at this thread because it does touch on issues i'm
curious about and i'm gradually getting more time so 
perhaps there's a chance it will get some updates and 
changes this winter.

  someone commented to me that if that is my attitude then
perhaps nobody will play it.  that's ok, i didn't write it
for anything other a learning experience.  that experience
will perhaps continue...  i may also perhaps get run over
by a mad cow tomorrow and the future will then be left for 
someone else to determine.  :)


>> if i ever get back to it i'll have to figure out how to ask
>> the windowing system what it wants to do for placement
>
> I've never heard of doing that before. I've written lots of desktop
> GUI apps in the past 30 years, and I've never written one line of code
> dealing with the location of the top-level window. I just let the
> toolkit and window manager handle it.

  if there are answers to the following questions this
would go in my file for future efforts.

  1. i'm running Debian testing, lightdm and MATE desktop.

  2. i don't know anything about how those things provide
 information to an application.  pointers would be
 appreciated.

  3. the application is written in python3, using gtk3
 and pyglet.

  it is a very rotten first attempt, i admit that.  :)
but also, for what it is it does work.  note, it does not
work on Windows because i don't have a windows machine
for development and testing nor do i have the inclination
to do that right now (which is why that's not done yet).

  i've posted links to it here before but just so anyone
doesn't have to search for it i'll put the link here too:

  https://github.com/flowerbug/ngfp

  have fun, cheers, etc.  :)


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


Re: Best way to determine user's screensize?

2020-11-01 Thread songbird
Mats Wichmann wrote:
> On 10/30/20 6:47 PM, songbird wrote:
...
>>   do you object to a window being put in the approximate
>> center of the screen?
>
> Absolutely!  I'm fighting that on a system which, after an update,
> insists on opening new terminal windows centered - some recent policy
> change is now doing that instead of where the same thing was placed the
> last time it was open (I assume I'll find the knob for that eventually).
>  As others have said, there's no one-size-fits-all; on a big screen you
> certainly don't want the same things as on a phone, where "take over the
> whole screen" might indeed be the only thing that makes sense.

  to keep a program simple i made it to open in the center.
if i ever get back to it i'll have to figure out how to ask
the windowing system what it wants to do for placement and
then store that location as part of the configuration if the
person moves it.

  i don't use multiple screens yet nor do i mind moving an
item once when i'm starting up, but i could see where if 
there are a lot of windows that it would be annoying to 
have to move all of them.


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


Re: Best way to determine user's screensize?

2020-11-01 Thread songbird
Grant Edwards wrote:
> On 2020-10-31, songbird  wrote:
...
>> do you object to a window being put in the approximate
>> center of the screen?
>
> YES. I've configured my window manager so windows start up where I
> want them to start up. It's none of the application's business where
> it's window is.
>
> When developing an application, try to remember IT'S NOT YOUR
> COMPUTER.

  certainly it isn't but it is my game and i kept it
simple.  if people don't like it then they can find
something else to play.  i'm good with that, but the
next time i get back to making changes i'll see what
i can figure out for saving the location where someone
has moved it.


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


Re: Best way to determine user's screensize?

2020-10-30 Thread songbird
Chris Angelico wrote:
...
> I add my voice to those who detest applications that think they know
> best and decide that they own the entire screen. It is incredibly
> annoying.

  do you object to a window being put in the approximate
center of the screen?


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


Re: 1 line demo

2020-01-14 Thread songbird
Sam Olyk wrote:

...

  while all of this is interesting to a point please
use a suitable nntp test group available instead of 
spamming this group.

  optimally the best would be to set up your own
local server and then test using that.

  thanks


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


Re: PyInstaller needs Funding by your Company

2020-01-08 Thread songbird
Christian Gollwitzer wrote:
> Am 07.01.20 um 15:09 schrieb Hartmut Goebel:
>> Maintianing PyInstaller at a proper level requires about 4 to 5 days per
>> month. Which means about 4,000 to 5,000 € per month and about 50,000 to
>> 60,000 € per year.
>
> these numbers sound odd to me. 4000€ - 5000€ per month or equivalently 
> 60,000€ per year is the level of academic full-time jobs in Germany, 
> i.e. that would be 4-5 days per week, not per month.

  it is the demand of a volunteer to be paid.

  if people want to pay him that's their business, but
i think a larger company may just instead fork their
own copy or fund an internal developer to track this
project IF it is that important to them.

  he may resign or limit his participation in the future
as with any other volunteer effort.

  it is GPL code.


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


Re: python 2 to 3 converter

2019-12-10 Thread songbird
Chris Angelico wrote:
> On Tue, Dec 10, 2019 at 4:41 PM songbird  wrote:
>>
>> Chris Angelico wrote:
>> ...
>> > What if neither works, because there are assumptions that don't work?
>>
>>   then you get stuck doing it by hand, but you would have
>> been stuck doing it before for sure by hand so if you can
>> write something which might get some of the easy cases
>> done then at least you're saving your efforts for the
>> harder stuff.
>
> The easy cases are easy for anything, and don't need AI.

  i consider calling a statistical approach to conversion
"AI" is like calling snobol AI.  it is pattern matching
and applying tests to see what happens.  that's all, it
might even be brute forced.


>> > I get the very strong impression that you've never tried this.
>>
>>   of course not!  i don't have that kind of pipeline
>> or machine power and i'm several years away from being
>> where i'd like to be in terms of understanding the
>> language itself.  i hope to have the time over the
>> next few years to learn enough but i don't know how
>> that will go.
>>
>>   i'm glad in looking around more the past few evenings
>> that the conversion effort is making progress and
>> things are not as dire as some have made it out to be.
>> i just hope the lessons have been learned going
>> forwards.
>
> Never even done it manually, I mean. It's very difficult to try to
> design an AI to do something that you can't do yourself and don't even
> understand the problem.

  for me it would be a way of learning python 2 and python
3 better.  i have enough understanding of how compilers 
work so those parts of the project wouldn't be scary to me
at all.  the statistical aspects i'd need help with and
the generating of tests and how to run them would be new
to me.  but that tests already exist and that they are 
intended to be simple bits of code should be a goldmine 
for conversion scripts to look at IMHO.  so perhaps 
someone who's facing a huge conversion problem might find
this as a worthwhile thing to ponder.

  personally, if i were working again full time and 
facing several million lines of code and a lot of 
recalcitrant workers, well, i'd be stuck trying to do
something to get it done.

  i have gone through conversions before (a major one
at a university where we went from an inhouse system to
a vendor supplied system).  we didn't do the conversion
automatically and it didn't happen overnight, but it did
get done on schedule and i think we also came in under
budget.  i was only part of the team involved as a
general systems person as i still supported the mainframe
we were coming off of to go to the mini but for the new
system i worked with all the conversion efforts going on
in the departments along with any interface issues to 
the printers, how to run jobs in sequence, scanning 
grades, ...).  i pretty much did whatever was needed.
when the conversion was winding down was a good point
for me to retire/quit as i'd been doing nothing but
going to school and programming or working with computers
for 15yrs.  right before the internet took off...

  my own local conversion effort recently was my small
website setup where the theme author had introduced a
lot of breaking changes over several years and no 
conversion utility so i wrote one in a few days.  it 
saved me a few weeks of converting it all by hand (and 
i've posted it to github so anyone else stuck in the 
same spot at least has a workable framework to go from).
no, it's not AI or complex enough to be considered all
that interesting but it worked and saved me enough time 
that i can start looking at python 3 again.


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


Re: python 2 to 3 converter

2019-12-10 Thread songbird
Chris Angelico wrote:
> On Tue, Dec 10, 2019 at 12:15 PM songbird  wrote:
>>
>> Chris Angelico wrote:
>> ...
>> >
>> > Here's an example piece of code.
>> >
>> > sock = socket.socket(...)
>> > name = input("Enter your username: ")
>> > code = input("Enter the base64 code: ")
>> > code = base64.b64decode(code)
>> > sock.write("""GET /foo HTTP/1.0
>> > Authentication: Demo %s/%s
>> >
>> > """ % (name, code))
>> > match = re.search(r"#[A-Za-z0-9]+#", sock.read())
>> > if match: print("Response: " + match.group(0))
>> >
>> > Your challenge: Figure out which of those strings should be a byte
>> > string and which should be text. Or alternatively, prove that this is
>> > a hard problem. There are only a finite number of types - two, to be
>> > precise - so by your argument, this should be straightforward, right?
>>
>>   this isn't a process of looking at isolated code.  this
>> is a process of looking at the code, but also the test cases
>> or working examples.  so the inputs are known and the code
>> itself gives clues about what it is expecting.
>
> Okay. The test cases are also written in Python, and they use
> unadorned string literals to provide mock values for input() and the
> socket response. Now what?

  wouldn't there be clues in how that string is used in
the program itself (either calls to converters or when
the literal is assigned to some variable or used in a
print statement)?


> What if the test cases are entirely ASCII characters?

  it all goes utf in that case and the string is not 
binary.


> What if the test cases are NOT entirely ASCII characters?

  if the program has more than one language then you may
have to see what the character set falls into.  is it hex
it it octal or binary or some language.  i'd guess there
will be clues in the code as to how that string is used
later.


>>   regular expressions can be matched in finite time as well
>> as a fixed length text of any type can be scanned as a match
>> or rejected.
>>
>>   if you examined a thousand uses of match and found the
>> pattern used above and then examined what those programs did
>> with that match what would you select as the first type, the
>> one used the most first, if that doesn't work go with the 2nd,
>> etc.
>>
>
> That's not really the point. Are your regular expressions working with
> text or bytes? Does your socket return text or bytes?

  clues in the program again.  you're not limited to looking
only at the string itself, but the context of the entire
program.  i'm sure patterns are there to be found if you
can scan enough programs they'll start showing up.  once
you've found a viable pattern then you have a way to
generate a test case to see if it works or not.


> I've deliberately chosen these examples because they are hard. And I
> didn't even get into an extremely hard problem, with the inclusion of
> text inside binary data inside of text inside of bytes. (It does
> happen.)
>
> These problems are fundamentally hard because there is insufficient
> information in the source code alone to determine the programmer's
> intent.

  that is why we would be running the program itself and
examining test case results.

  none of these programs run in isolation, information is
known what they expect as input or produce as output.


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


Re: python 2 to 3 converter

2019-12-09 Thread songbird
Chris Angelico wrote:
...
> What if neither works, because there are assumptions that don't work?

  then you get stuck doing it by hand, but you would have
been stuck doing it before for sure by hand so if you can
write something which might get some of the easy cases
done then at least you're saving your efforts for the 
harder stuff.


> I get the very strong impression that you've never tried this.

  of course not!  i don't have that kind of pipeline
or machine power and i'm several years away from being 
where i'd like to be in terms of understanding the
language itself.  i hope to have the time over the 
next few years to learn enough but i don't know how 
that will go.

  i'm glad in looking around more the past few evenings
that the conversion effort is making progress and 
things are not as dire as some have made it out to be.
i just hope the lessons have been learned going 
forwards.


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


Re: python 2 to 3 converter

2019-12-09 Thread songbird
Chris Angelico wrote:
...
>
> Here's an example piece of code.
>
> sock = socket.socket(...)
> name = input("Enter your username: ")
> code = input("Enter the base64 code: ")
> code = base64.b64decode(code)
> sock.write("""GET /foo HTTP/1.0
> Authentication: Demo %s/%s
>
> """ % (name, code))
> match = re.search(r"#[A-Za-z0-9]+#", sock.read())
> if match: print("Response: " + match.group(0))
>
> Your challenge: Figure out which of those strings should be a byte
> string and which should be text. Or alternatively, prove that this is
> a hard problem. There are only a finite number of types - two, to be
> precise - so by your argument, this should be straightforward, right?

  this isn't a process of looking at isolated code.  this
is a process of looking at the code, but also the test cases
or working examples.  so the inputs are known and the code 
itself gives clues about what it is expecting.

  regular expressions can be matched in finite time as well
as a fixed length text of any type can be scanned as a match
or rejected.

  if you examined a thousand uses of match and found the
pattern used above and then examined what those programs did
with that match what would you select as the first type, the
one used the most first, if that doesn't work go with the 2nd,
etc.


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


Re: python 2 to 3 converter

2019-12-09 Thread songbird
Rob Gaddi wrote:
...
> And how exactly do you propose to determine whether the constant I've 
> enclosed 
> in quotation marks in Python2 represents "text" or "binary data"?  Not all 
> text 
> is words; think of SQL queries.  And some words are binary data, think SCPI 
> commands being sent to a serial port.

  why not assume one, see if it works and then if it doesn't you
know it is the other?  if those are the only two choices then 
that speeds things up.


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


Re: python 2 to 3 converter

2019-12-09 Thread songbird
jf...@ms4.hinet.net wrote:
...
> Even string is hard to be handled by the AI:-)
>
> Quoted from https://portingguide.readthedocs.io/en/latest/strings.html
> " ... This means that you need to go through the entire codebase, and decide 
> which value is what type. Unfortunately, this process generally cannot be 
> automated."

  i don't agree.  if the language is already parsed then
you have the strings.  the contents of the strings will
have to be finite if they are fixed strings.  so to convert
a fixed string you can choose a type for the value and run
a test to see if it works.  if it does then you've picked 
the correct type, if it doesn't you pick the next type.
there are only a finite number of types.

  yes it is brute force but it would find something that
worked eventually if there was something to be found.

  for programs using indefinite strings via input you
can't predict what those would be doing, but then of
course you would be able to say the most general type could 
be tried first and then run tests to see if it worked.

  the overall patterns to try for a string could be 
driven by examining code which has already been converted
that contains similar patterns - eventually you would
have enough of an idea of which things to try first to
speed things up.

  yes, this is a generally hard issue if you are talking
random strings and not sure what is what, but in the
case of a computer language it is already specified and
parsers already exist.


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


Re: python 2 to 3 converter

2019-12-09 Thread songbird
Greg Ewing wrote:
> On 8/12/19 9:30 pm, songbird wrote:
>>wouldn't it make more sense to just go back and fix the
>> converter program than to have to manually convert all this
>> python2 code?
>
> Anything that isn't already fixed by 2to3 is probably
> somewhere between very difficult and impossible to fix
> using an automated process. It sounds like an interesting
> project, but be aware that it's probably an AI-complete
> problem.

  if the program already exists and is working then that
implies a parser already exists for it.

  this is not a general AI or CS issue.


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


Re: python 2 to 3 converter

2019-12-08 Thread songbird
Chris Angelico wrote:
> On Sun, Dec 8, 2019 at 7:36 PM songbird  wrote:
>>   this would be a heck of a lot of fun.
>
> Then go ahead and do it.

  i know you're just being flip here and that's fine
with me.  that said, i'd love to!  how big is PyPI? 
(huge)  will it fit on an SSD?  (no)  my local machine 
and pipeline isn't big enough to crunch it (too bad).
etc.

  i'm going to have fun here so you can ignore this if
you'd like.

  my name for the new archive is called OctoPyPIE.  :)

  uploads to OPPIE are parsed from the start to be python3
compatible only.  if it is not compatible then the code is
quarantined with a message which says "fix it and try 
again, we no longer accept incompatible code."

  the quarantined python2 code will be used for background
processing (to see what is most broken) but it is never
distributed further.  it is just indexed, dependencies 
checked, noting which ones are most frequently used and
that information kept to help focus the broader effort of
conversion.  i think we should call the quarantine area
ISENGUARD and the programs for chewing it up called ENT.  
code that eventually may get a fixer so that it could be 
promoted back to OPPIE without any manual intervention 
would be done by ELROND.  code which is impossible to ever 
be manually converted would be left and perhaps would 
eventually end up in MORDOR after being transported by 
the RINGWRAITH.

  dev null is of course MTDOOM.

  those who come to the table of OPPIE only eat the 
freshest pie.  HOBBITS like only the best.

  thus is finished the 2nd AGE.


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


python 2 to 3 converter

2019-12-08 Thread songbird
  wouldn't it make more sense to just go back and fix the
converter program than to have to manually convert all this
python2 code?

  how many small test bits of code from PyPI could be
used as templates for patterns to search for that can then
be automatically converted and the test rerun?  thousands,
millions?  i bet it isn't a small amount of code that 
could be done and save everyone a large amount of time.

  having a large code repository would be useful for such
things, but also i think it would be a very good idea for
people who make changes to their code which obsolete
features or deprecations or whatever you want to call them
that they also need to formally describe the transformations
needed and supply a conversion script for the code so
that there would always be a potential path forwards where
some portion of the changes can be done automatically.

  the thing is that having such a large code repository
means you can also index it for code fragments and see 
which are the most frequently used and then focus on getting
those fixes back into the automatic translator program and
then keep iterating through as updates are applied and
automatic tests succeed.

  this would be a heck of a lot of fun.


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


Re: Conway's game of Life, just because.

2019-05-08 Thread songbird
Paul Moore wrote:
> Golly <http://golly.sourceforge.net/> supports both bounded and
> unbounded universes. I don't know how it does it, and (obviously) it
> will hit limits *somewhere*, but I consider support of unbounded
> universes to mean that any failure modes will not be attributable to
> limits on the value of co-ordinates (for the pedants out there,
> ignoring issues such as numbers to big to represent in memory...)
>
> It does limit *editing* of patterns to co-ordinates below a billion
> (to quote the "Known Limitations" page). But that's a distinct issue
> (I guess related to the GUI toolkit being used).
>
> Disclaimer: I've only made very light use of golly, most of the above
> is inferred from the manual and reports of how others have used it.


  i tried it.

  what i wanted in the end was a way for the rules to be layered
and there to be levels stacked (so you could have different rules
apply to different scales of things - much like life/biology and
ecological systems function).

  i never designed anything though.  i started learning python 
with this sort of project in mind, but don't have a lot of time
now to work on it.  maybe by next fall/winter...  :)


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


Re: revisiting the "What am I running on?" question

2019-03-01 Thread songbird
Terry Reedy wrote:
> On 2/22/2019 7:55 AM, songbird wrote:
>> eryk sun wrote:
>> ...
>>> The win-amd64 ABI is significantly different, but at the API level
>>> there isn't a drastic difference between 32-bit and 64-bit Windows, so
>>> there's no cognitive burden with perpetuating the Win32 name. The
>>> official API name was actually changed to "Windows API" or WINAPI (or
>>> WinAPI). But it would require a massive effort to change the culture.
>>> There's no pressing need to expend that much time and energy over a
>>> name.
>> 
>>just adding a comment to the documentation that
>> win32 also covers win64 would be a help IMO.
>
> Could you open an issue on the tracker suggesting a specific edit at a 
> specific place?

  i don't want to create yet another account to file
a bug/issue, but the specific place in the docs is:

  
https://docs.python.org/3/library/sys.html?highlight=sys%20platform#sys.platform


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


Re: revisiting the "What am I running on?" question

2019-02-23 Thread songbird
Terry Reedy wrote:
> On 2/22/2019 7:55 AM, songbird wrote:
>> eryk sun wrote:
>> ...
>>> The win-amd64 ABI is significantly different, but at the API level
>>> there isn't a drastic difference between 32-bit and 64-bit Windows, so
>>> there's no cognitive burden with perpetuating the Win32 name. The
>>> official API name was actually changed to "Windows API" or WINAPI (or
>>> WinAPI). But it would require a massive effort to change the culture.
>>> There's no pressing need to expend that much time and energy over a
>>> name.
>> 
>>just adding a comment to the documentation that
>> win32 also covers win64 would be a help IMO.
>
> Could you open an issue on the tracker suggesting a specific edit at a 
> specific place?

  yes, i will next week when i can get back to this.


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


Re: revisiting the "What am I running on?" question

2019-02-22 Thread songbird
Chris Angelico wrote:
>songbird wrote:
...
>>   "Do I have temporary directory and file creation
>> permissions on this system or not?"
>
> Then ask that question instead! And the answer might well be here:
>
> https://docs.python.org/3/library/tempfile.html

  if you recall my original post/code it uses
tempfile and i asked for comments which i've
gotten.

  thanks,


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


Re: revisiting the "What am I running on?" question

2019-02-22 Thread songbird
eryk sun wrote:
...
> The win-amd64 ABI is significantly different, but at the API level
> there isn't a drastic difference between 32-bit and 64-bit Windows, so
> there's no cognitive burden with perpetuating the Win32 name. The
> official API name was actually changed to "Windows API" or WINAPI (or
> WinAPI). But it would require a massive effort to change the culture.
> There's no pressing need to expend that much time and energy over a
> name.

  just adding a comment to the documentation that
win32 also covers win64 would be a help IMO.

  for those who are using the startswith syntax 
and checking for "win" alone then you could change 
the string returned to "win32-win64" or some other
string with the prefix "win" and it would still 
work with no changes needed.


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


Re: revisiting the "What am I running on?" question

2019-02-22 Thread songbird
Chris Angelico wrote:
> On Thu, Feb 21, 2019 at 12:56 AM songbird  wrote:
>> Thomas Jollans wrote:
>> ...
>> > I'm fairly sure "win32" was used on W9x as well. In any case it *was*
>> > correct at the time, as early versions of Python also ran on DOS and
>> > Windows 3.1. "windows" would not have been suitable.
>> >
>> > But yeah, we're stuck with it. There are obviously good reasons that it
>> > wasn't changed when we moved to amd64, but it is annoying.
>>
>>   to me it is confusing and looks outdated so it
>> did not give me much confidence i had found the
>> right thing to use and so i kept looking further.
>> if someone could put a note in the docs about
>> this it will likely help others.
>
> Put a note somewhere in Microsoft's docs or something - this isn't a
> Python-specific thing.

  the document i quoted is a python document.


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


Re: revisiting the "What am I running on?" question

2019-02-20 Thread songbird
Chris Angelico wrote:
> songbird wrote:
...
>>   no win64?
>
> The value "win32" means Windows (or, more technically, "Windows NT
> family", as opposed to Win95/Win98 - but since Win XP, that's the only
> type of Windows there is). If you actually care about whether it's a
> 32-bit or 64-bit OS, you can look at sys.maxsize.

  i'm not sure what system my code will actually
run on or not.  i got rid of my old hardware as
part of a cleanup so i can't test things like 
that anymore without some kind of emulator or 
other kind people.

  at present i just want to know what kind of
system i am running on so i can put my configuration 
file and saved games in the correct places.

  if i can't determine what kind of system i am
running on then i won't run at all (instead of
risking creating a directory or file on a system
that doesn't have such ways of doing that - i 
really don't know what people may attempt after
all).


>>   no arm(s)?
>
> That's a CPU architecture. What OS would you be running on your ARM?
> If it's Windows, "win32". If it's Linux, "linux". Etc.

  ok.  since i never have such things to try i 
don't always know what they run or how it looks
to a python3 program.

  anyways, one thing i do like about an actual
probe of the temporary kind is that i can answer
the question of:

  "Do I have temporary directory and file creation 
permissions on this system or not?"

  a more accurate answer for any longer term storage
would tell me if i have more permanent directory and 
file creation permissions or not, but my program 
doesn't require those since it will run without a 
configuration file or any saved games.


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


Re: revisiting the "What am I running on?" question

2019-02-20 Thread songbird
Thomas Jollans wrote:
...
> I'm fairly sure "win32" was used on W9x as well. In any case it *was*
> correct at the time, as early versions of Python also ran on DOS and
> Windows 3.1. "windows" would not have been suitable.
>
> But yeah, we're stuck with it. There are obviously good reasons that it
> wasn't changed when we moved to amd64, but it is annoying.

  to me it is confusing and looks outdated so it
did not give me much confidence i had found the
right thing to use and so i kept looking further.
if someone could put a note in the docs about 
this it will likely help others.

  in this age where things look to me very fragmented
and then abandoned it is hard to know what is and 
isn't being maintained without looking for issue 
trackers and bugs and seeing if anyone is actively
fixing things or not (multiply this by the number
of modules being used and it drains more time).


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


Re: Gtk. GUI app pgming

2019-02-19 Thread songbird
nn wrote:
>
>  any gtk+ III.buffs  around ?
>
>  am gonna launch a hot new newsreader soon. works like a charm.

  i used python 3, gtk3 (PyGObject which brings you
pycairo) and pyglet for a quick game and it went ok.

  the issues i have now are with the actual distribution 
to all the platforms because i don't have a Windows and
a few other architectures to generate my own binary wheels 
for uploading or to test on.  in the meantime people have 
to install python 3 along with a C compiler and i don't 
think that really is easy for people who are at the plain 
"user level" of understanding.

  i have a few glitches because of the mixing of window
layers going on (the application using one idea of 
windowing things and priorities that gtk may be using)
but it isn't bad enough that i've dug into it to sort
it out yet.  it mostly works.  :)


  https://pypi.org/project/ngfp/

  the python 3 code itself is rather atrocious in parts
but that's a whole different issue...  lol  (i'm still
obviously learning :) )


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


Re: revisiting the "What am I running on?" question

2019-02-19 Thread songbird
MRAB wrote:
...
> Don't use a bare except, it'll catch _any_ exception.

  that's ok with this code IMO, but i see your point.


> If the regex matches, re.search will return a match object; if it 
> doesn't match, it'll return None.
>
> In any case, +1 to Dan's answer.
>
> [snip]

  ok, thanks!


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


Re: revisiting the "What am I running on?" question

2019-02-19 Thread songbird
Rick Johnson wrote:
...
> The standard idiom for regexp match objects is to test for truthiness, not to 
> use an except-clause.
>
> m = re.search("^[A-Za-z]:", sysprobetmp)
> if m:
> ...

  ok, thanks!  :)


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


Re: revisiting the "What am I running on?" question

2019-02-19 Thread songbird
Dan Sommers wrote:
...
> Python 3.7.2 (default, Jan 10 2019, 23:51:51)
> [GCC 8.2.1 20181127] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> sys.platform
> 'linux'

  this doesn't help me for the rest of the platforms
available.


=  from the docs:

  if sys.platform.startswith('freebsd'):
# FreeBSD-specific code here...
elif sys.platform.startswith('linux'):
# Linux-specific code here...

For other systems, the values are:
System  platform value
Linux   'linux'
Windows 'win32'
Windows/Cygwin  'cygwin'
Mac OS X'darwin'

=

  no win64?
  no arm(s)?

  no legs(a joke :)...

  the above is missing a lot of devices.

  i looked around for something more complete
and didn't come across anything more definitive
that looked to be up to date.


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


Re: revisiting the "What am I running on?" question

2019-02-17 Thread songbird
songbird wrote:
...
> result = re.search("^/(tmp)|(var)|(usr)|(opt)|(home)", sysprobetmp)

  i changed that line to:

 result = re.search("^/((tmp)|(var)|(usr)|(opt)|(home))", sysprobetmp)

  just to make sure the leading slash is not just grouped
with the first string.  i like to be more explicit with
my precedence if i'm not sure what the language might
actually do...  :)


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


revisiting the "What am I running on?" question

2019-02-17 Thread songbird


  having worked on some other things for a while i 
didn't put much emphasis on working on this until i
had the other bugs taken care of.

  so now back into it we can go...  :)

  what i came up with (sorry, i hate yet another not
invented here thing, but this is just where i ended up
after some pondering).

  simply put.  if i'm running on a computer and i 
don't easily know why kind of computer how can i
answer this in a quick way without getting overly
complicated that also will cover most of the easy
cases?

  i came up with this:

  comments?  additions?  clarifications?

  i don't have a windows system to test this on,
does it work?

  thanks  :)


=
import re
import tempfile


def sysprobe ():

sysprobetmp = tempfile.gettempdir()

print ("Temp directory : -->" + sysprobetmp + "<--\n")

result = re.search("^/(tmp)|(var)|(usr)|(opt)|(home)", sysprobetmp)
try:
print ("Result : -->" + result.group(0) + "<--\n")

return ("posix")
except:
pass

result = re.search("^[A-Za-z]:", sysprobetmp)
try:
print ("Result : -->" + result.group(0) + "<--\n")
return ("windows")
except:
pass

return ("unknown")


def main ():

  print (sysprobe())


if __name__ == "__main__":
main()


=


  on my system i get:

=

(env) me@ant(39)~/src/salsa/bits/sysprobe$ python3 sysprobe.py 
Temp directory : -->/tmp<--

Result : -->/tmp<--

posix

=


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


Re: Why float('Nan') == float('Nan') is False

2019-02-13 Thread songbird
Chris Angelico wrote:
> On Thu, Feb 14, 2019 at 7:12 AM Test Bot  wrote:
>>
>> This definition of NaN is much better in mentally visualizing all the so
>> called bizarreness of IEEE. This also makes intuitive that no 2 NaN will be
>> equal just as no 2 infinities would be equal. I believe in a hypothesis(of
>> my own creation) that any arithmetic on a data type of NaN would be similar
>> to any set of operations on the set of Infinities.
>>
>
> Why would no two infinities be equal? In mathematics, there's one
> best-known infinity (aleph null, aka the number of counting numbers),
> and many many infinities are provably equal to it. (Others are
> provably NOT equal to it, like the number of real numbers.) There's
> nothing wrong with saying "there are as many prime numbers as there
> are odd numbers", or equivalently that "the size/cardinality of the
> set of primes is equal to the size of the set of odd numbers" [1]. And
> both Python and IEEE agree:
...
> [1] I'm sure someone will point out something pedantically wrong in
> what I said, but certainly the sets have the same cardinality.

  all such proofs i have ever seen are based upon the 
assumptions that there are infinite numbers of such
things like primes.

  this only makes sense in theory.

  alas, we don't really know if the universe is infinitely
subdivisible (as the reals seem to represent) or infinitely
large (even if it isn't infinitely subdivisible)...  so to
me every one of those proofs is conditional upon assumptions
(which also drags the p = np question into such assumptions).

  it's fun to think about.  :)


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


Re: Problem in Installing version 3.7.2(64 bit)

2019-01-29 Thread songbird
Anssi Saari wrote:
> Terry Reedy  writes:
>> On 1/26/2019 6:24 AM, Vrinda Bansal wrote:
>>> Dear Sir/Madam,
>>>
>>> After Installation of the version 3.7.2(64 bit) in Windows 8 when I run the
>>> program it gives an error. Screenshot of the error is attached below.
>>
>> Nope.  This is text only mail list.  Images are tossed.  You must copy
>> and paste.
>
> Just curious, but wouldn't it be better to just reject messages with
> attachments instead of silent removal? I suppose the end result is
> mostly the same for the person asking but the rest of us would be
> spared.

  my understanding is that this list is actually 
several combined services (i'm not sure how the
mailing list operates or how it filters or rejects
things) and then there is the usenet list comp.lang.python
(which is how i see articles and replies).

  usenet has usually been a text only service unless
you have a specific binary group (some usenet servers
have them and others don't).

  asking the person to upload the image to someplace
else and provide a link to the image would be a thing
for the FAQ if there were one for either or both of 
the e-mail list service provider or the usenet group.


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


Re: preferences file

2019-01-28 Thread songbird
DL Neil wrote:
> On 29/01/19 1:29 AM, Karsten Hilbert wrote:
>> On Mon, Jan 28, 2019 at 07:02:47AM -0500, songbird wrote:
>> 
>>>> What about running a multi-tenant application (for multiple users who
>>>> are not also system-users) - cf them logging-on to run their own. It is
>>>> appropriate, possibly even "required" to keep Fred's config file,
>>>> reports, graphs, logs, etc; separate from Barney's. Ideally they will
>>>> not be sub-dirs of the application/package.
>>>
>>>if it is per user defined then $HOME/.config/,
>>> $HOME/.local/share/ and any temporary data can go
>>> in $HOME/.cache/ will do it for posix on Windows
>>> there is the per user app stuff which i haven't sorted out
>>> yet.
>>>
>>>$HOME changes per user login name change.
>> 
>>  $HOME/.config///
>>  $HOME/.cache///
>
>
> +1
>
> The latter for tmp/intermediate files (without hassles, eg creating 
> unique fileNMs!). - and which can be wiped with a single command at the 
> end of the run!
>
> The former for 'valuable stuff'. With the opportunity, to separate 
> output presentations and inputs using sub-dirs!
>
> (noticed in one such implementation, the need to separate different 
> 'runs' of the same app, by the same client, using alternate hypotheses - 
> that required another 'layer' of sub-dirs!)
>
> Thanks!

  oh, well i don't need anything that complicated but
usually there is a way of generating unique file names
and managing temporary files.

  if you are running an application by a login user
which does not log out then eventually you may need
to use some other method of cleaning up the application's
files somehow but to me that is a whole different topic
from the issue of where to put them. 


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


Re: preferences file

2019-01-28 Thread songbird
Karsten Hilbert wrote:
> On Mon, Jan 28, 2019 at 10:23:31AM -0500, songbird wrote:
>> Karsten Hilbert wrote:
>> > On Mon, Jan 28, 2019 at 07:02:47AM -0500, songbird wrote:
>> >
>> >> > What about running a multi-tenant application (for multiple users who 
>> >> > are not also system-users) - cf them logging-on to run their own. It is 
>> >> > appropriate, possibly even "required" to keep Fred's config file, 
>> >> > reports, graphs, logs, etc; separate from Barney's. Ideally they will 
>> >> > not be sub-dirs of the application/package.
>> >> 
>> >>   if it is per user defined then $HOME/.config/, 
>> >> $HOME/.local/share/ and any temporary data can go 
>> >> in $HOME/.cache/ will do it for posix on Windows 
>> >> there is the per user app stuff which i haven't sorted out
>> >> yet.
>> >> 
>> >>   $HOME changes per user login name change.
>> >
>> >$HOME/.config///
>> >$HOME/.cache///
>> 
>>   that makes no sense as you already have unique
>> user name covered by $HOME so why repeat again?
>
> Because you seemed to imply that the login user is different
> from the app user:
>
>   "the per user app stuff")
>
> Apparently you meant something else ?

  sorry for being unclear.

  each user is taken care of by $HOME and for me there
is no other complication.


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


Re: preferences file

2019-01-28 Thread songbird
Karsten Hilbert wrote:
> On Mon, Jan 28, 2019 at 07:02:47AM -0500, songbird wrote:
>
>> > What about running a multi-tenant application (for multiple users who 
>> > are not also system-users) - cf them logging-on to run their own. It is 
>> > appropriate, possibly even "required" to keep Fred's config file, 
>> > reports, graphs, logs, etc; separate from Barney's. Ideally they will 
>> > not be sub-dirs of the application/package.
>> 
>>   if it is per user defined then $HOME/.config/, 
>> $HOME/.local/share/ and any temporary data can go 
>> in $HOME/.cache/ will do it for posix on Windows 
>> there is the per user app stuff which i haven't sorted out
>> yet.
>> 
>>   $HOME changes per user login name change.
>
>   $HOME/.config///
>   $HOME/.cache///

  that makes no sense as you already have unique
user name covered by $HOME so why repeat again?


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


Re: preferences file

2019-01-28 Thread songbird
DL Neil wrote:
> On 25/01/19 4:22 PM, Bill Campbell wrote:
>> On Thu, Jan 24, 2019, Dave wrote:
>>> I'm doing a small application and want to add user preferences.  Did some
>>> googling to see if there are standard Python ways/tools, but it seems not so
>>> much.  My specific questions are:
>>>
>>> 1. Best practices for a user preference file/system?
>> 
>> Generally I put them in the user's $HOME or $HOME/etc directory
>> with appropriate permissions unless working in a virtual
>> environement.
>
> Good idea.
>
> What about running a multi-tenant application (for multiple users who 
> are not also system-users) - cf them logging-on to run their own. It is 
> appropriate, possibly even "required" to keep Fred's config file, 
> reports, graphs, logs, etc; separate from Barney's. Ideally they will 
> not be sub-dirs of the application/package.

  if it is per user defined then $HOME/.config/, 
$HOME/.local/share/ and any temporary data can go 
in $HOME/.cache/ will do it for posix on Windows 
there is the per user app stuff which i haven't sorted out
yet.

  $HOME changes per user login name change.


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


Re: Fatal Python error

2019-01-27 Thread songbird
Abdallah Adham wrote:
> Hey
> I am having this problem for about 2 weeks, I can't do anything, so please
> give me some instructions so I can solve it.
>
> Fatal Python error: initfsencoding: unable to load the file system code.
> ModuleNotFoundError: No module named 'encodings'
>
>:Current thread 0x3c7c (most recent call first
>
> Process finished with exit code -1073740791 (0xC409)

  
https://stackoverflow.com/questions/54087049/fatal-python-error-initfsencoding-unable-to-load-the-file-system-codec


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


Re: preferences file

2019-01-26 Thread songbird
Karsten Hilbert wrote:
> On Sat, Jan 26, 2019 at 05:35:26PM -0500, songbird wrote:
>
>> >>   if the system doesn't have home directories but does have
>> >> /usr/local you can put things in there (just check to make
>> >> sure first that you aren't clobbering someone else's directories
>> >> or files :) ).
>> >
>> > I don't that that's typically writable to for any odd user.
>> 
>>   i'm assuming the person can get that changed if desired
>> or change it themselves.  if not, then it would be a
>> rather strange situation IMO, to not have a home directory
>> and to also not have some other place to put things.
>
> On a Linux system the only other place that should, by
> default, offer writable disk space is /tmp/ , I guess.
>
> Or else /media/$USER/a-user-mounted-removable-media/

  ugh!  i forgot that /usr should be read only for
most normal people.  i guess /opt could be used instead
with config changes going into /var/opt but i don't 
really like that either.  i'd much rather keep all user 
information under the specific user home directory.


>>   at the moment i'm assuming that recent Mac's should
>> be posix and have a $HOME and allow for $HOME/.local/share
>> and $HOME/.config
>
> Surely they should.

  :)


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


Re: preferences file

2019-01-26 Thread songbird
Karsten Hilbert wrote:
> On Fri, Jan 25, 2019 at 11:04:51AM -0500, songbird wrote:
>
>>   if the system doesn't have home directories but does have
>> /usr/local you can put things in there (just check to make
>> sure first that you aren't clobbering someone else's directories
>> or files :) ).
>
> I don't that that's typically writable to for any odd user.

  i'm assuming the person can get that changed if desired
or change it themselves.  if not, then it would be a
rather strange situation IMO, to not have a home directory
and to also not have some other place to put things.

  that said, i've not looked at an Android, IOS, Mac, or 
Windows system in a long time and is why i've had to ask
here.  over the holidays i touched a Mac for the first 
time in over 30yrs (no i don't get out much :) ) and
wished i had more time to look into it more but couldn't.
it would have been nice to answer some of my questions
by a few minutes of poking around.

  at the moment i'm assuming that recent Mac's should
be posix and have a $HOME and allow for $HOME/.local/share
and $HOME/.config


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


Re: preferences file

2019-01-25 Thread songbird
Dave wrote:
> I'm doing a small application and want to add user preferences.  Did 
> some googling to see if there are standard Python ways/tools, but it 
> seems not so much.  My specific questions are:
>
> 1. Best practices for a user preference file/system?

  use as many default parameters as you can so that the
user can run it without any configuration changes if
possible.

  what i did was this:

 config.py which sets the default values used by other 
modules which then gets imported by any module that needs 
those values.  these can be changed during operation if
needed, but are not saved unless specifically desired.

  if the user desires to save a different configuration
than the above default values then that file is saved to
$HOME/.config//config_.json

  i also made sure to upload my app to PyPI making sure
the  is unique enough there (but also checked
it via the packages listing for Debian and Ubuntu to make
sure there wasn't a conflict).


> 2. File format favored and why - ini, JSON, etc?

  configuration info and saved user games i've ended up
using json.  it is easy to load and save and should be 
universal enough.


> 3. File location?  I'm using Ubuntu and I believe that the correct 
> location would be home/.config/ .  What about Mac and Windows?

  yes,

  user saved info would go into:

$HOME/.local/share/

  should be ok for any posix system (Debian, Ubuntu, MacOS)

  if the system doesn't have home directories but does have
/usr/local you can put things in there (just check to make
sure first that you aren't clobbering someone else's directories
or files :) ).


> Would like to find a Python library that handles all of this, but so far...

  every recommendation so far i've seen looks to be
either not adopted widely or not actively developed/maintained.


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


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

2019-01-09 Thread songbird
Matthew Lemon wrote:
> If the OP was able to take the time to familiarise himself with the 
> technologies, rather than bemoan the difficulty of deploying a ten year old 
> code-base without mininal effort, he might have some success. Code rot is an 
> issue after weeks sometimes, never mind ten years, and Python deployment is a 
> weakness. However the tools do exist if you are prepared to give it a go. 
> I've had most successful with pyinstaller, which is why I linked to it. Good 
> luck!

  i looked at it, will require further reading/testing.

  i see part of my list of modules are supported but 
not sure all are without a test.  will have to look into 
it further.  tks.  :)


  songbird  (not the OP, but in a similar and perhaps
 more complicated boat...
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-01-09 Thread songbird
Grant Edwards wrote:
...
> That said, I've recently switched from py2exe to cx_freeze.  However,
> even that isn't simple enough for my users, and I bundle the output
> from those with Inno Setup.

  i looked at the one and stopped at that because
alas, i have no Windows or MacOS machines to
generate any binaries, though i would guess that
the MacOS may have an easier path to getting
a C compiler installed (but i don't know, my MacOS
person hasn't said anything yet).

  in looking at the Python install for Windows it
looks like i will probably want to do it to make
sure that the paths are set up correctly.  the C
compiler, don't know how easy that might be until 
i do it, which i hate when sitting in someone 
else's house with them hovering.  considering i 
haven't touched Windows since XP and really am 
not an expert these days it should be entertaining.

  my code is all python 3 so that at least should
simplify some things.


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


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

2019-01-09 Thread songbird
MRAB wrote:
> On 2019-01-09 14:56, songbird wrote:
>> Chris Angelico wrote:
>> ...
>>> You want it to work with minimal effort? Then forget about py2exe and
>>> just distribute your .py files. WAY easier.
>> 
>>which then forces the work onto every other
>> person who might install it, if they are on a
>> different architecture or system it even gets
>> worse if you add in that they may need to figure
>> out how to get a C compiler installed and
>> available (if a bdist/wheel isn't available
>> because the developer couldn't figure out how
>> to generate one).
>> 
>>for a novice user who just wants to get
>> something done this isn't a very good solution.
>> 
>>a build farm for common architectures would
>> help a lot of developers avoid all this thrashing.
>> 
> .py files work on any platform that supports Python: Windows, Linux, 
> MacOs, ...

  .py isn't the point as somehow the modules i am 
using compile C code during the install.  i'd be 
happier if they didn't, but i don't have a way to
easily generate those files myself that i know of.


> How many platforms support .exe files that were compiled for Windows?

  depends upon the versions...

  i have some pretty ancient Windows/DOS programs
that work fine under dosbox in my Debian Linux testing
setup.  i haven't checked them out lately though to
see if they're still runnable (good chance they're
ok).  been busy with other things and besides i 
finally moved the ancient spreadsheets from Multiplan 
to Libreoffice.


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


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

2019-01-09 Thread songbird
Chris Angelico wrote:
...
> This is true - but on the flip side, it's a bit unfair to say "blah
> blah Python sucks because py2exe is hard". That's not Python's fault.
> You have an additional requirement ("support people who can't install
> Python"), and that's going to have extra hassles. LOTS of them, in
> this case.

  i'm not as much worried about the python 3 install
as much as the C compiler that the graphics libs seem
to want to use during install from source.  that is
likely not as easy to do.  as i don't even have a
Windows machine here at all i can only read up on it
as much as i can and try to take some notes with me
of things to check and try out and hope that is 
enough.  i should be ok, but i'm not a Windows
expert by far.  so ...  :)


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


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

2019-01-09 Thread songbird
Chris Angelico wrote:
...
> You want it to work with minimal effort? Then forget about py2exe and
> just distribute your .py files. WAY easier.

  which then forces the work onto every other
person who might install it, if they are on a
different architecture or system it even gets
worse if you add in that they may need to figure
out how to get a C compiler installed and 
available (if a bdist/wheel isn't available
because the developer couldn't figure out how
to generate one).

  for a novice user who just wants to get 
something done this isn't a very good solution.

  a build farm for common architectures would
help a lot of developers avoid all this thrashing.


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


Re: the python name

2019-01-04 Thread songbird
Rick Johnson wrote:
...
> You're singing a sad tune songbird, but i feel your pain...

  like all things, this too shall pass...  :)


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


Re: the python name

2019-01-04 Thread songbird
Peter J. Holzer wrote:
> songbird wrote:

hi,

  thank you for your reply.


...
> Almost all of these points don't seem to be related to the language, but
> to your environment.

  an application isn't useful unless it actually can
be deployed and used in an environment.

  the easier it is for me to stay within the language
itself using whatever modules and features it provides.
and more the the better because every time i have to 
go outside to investigate or debug other things that 
adds complexity and more points of failure and more 
issues that get in the way of me actually working on 
the program (it also interferes with my goals if i'm
having to deal with beaurocracy issues instead of
fixing bugs or learning Python better).


  at least these make sense:

  https://packaging.python.org/tutorials/installing-packages/
  https://docs.python.org/3/installing/index.html#installing-index

  and this helps answer a lot of my questions that have been
hovering around:
  https://pip.pypa.io/en/stable/reference/pip_install/#caching


>>   there must be a more local way to do the same thing but=20
>
> I do some of my Python development locally and and some remotely, but
> that's mostly because to me it doesn't make much difference (vim in a
> terminal works the same when I'm ssh'd into a server as when I work
> locally) and not having to replicate the environment is a plus for me.
> If my tools worked only locally, I could do all development locally.

  i'm always working on my local machine first and 
foremost.  i always need a quick method for testing 
the whole chain from code to install and running tests
that doesn't involve a large turn around in time.

  as an example, the program hugo which lets me
generate a static web site.  it is great that i can 
do all of my local development and testing without 
having to upload it to the web server and then 
when i finally do upload it and test it out it 
almost always works the same way and there isn't
a half hour delay between me finding out something
didn't work.


>> as of yet the develop option doesn't seem to work how i
>> would expect.
>
> What is "the develop option"? Again, it seems like you are talking about
> a specific environment, not Python the language.

   i hope my comments above are sufficient to get 
my points across about "environment".


  i use this command to put my project into a
local virtual environment:

(env)$ pip3 install -e $NGFP_SRC_HOME/ --no-cache-dir --force-reinstall


where:
-e,--editable 
  Install  a  project  in editable mode (i.e.  setuptools "develop
  mode") from a local project path or a VCS url.

  it doesn't seem to work how i expect, but that could be
my own bug someplace.  haven't tracked it down yet.

  i'm also trying to get back more to what my initial 
goals were with this project (to learn the language 
and to learn OOP concepts better).  when i can get back
to the code itself and whack it into better shape then
i'll feel a lot better.  i admit it is a mess now.


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


Re: What can python replace?

2019-01-04 Thread songbird
Avi Gross wrote:
...

  this is really a computation theory question and for the
most part you'll find that all languages of suitable power
can replace each other.

  arguably some languages seem more expressive or easier 
to read than others.

  but the most popular languages will often have translators
for other languages as a part of their larger ecosystem.


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


Re: the python name

2019-01-03 Thread songbird
Rick Johnson wrote:
> songbird wrote:
>
...
>> if you want to know the perspective of a new person 
>> to the language and to help out make it better i have
>> a few suggestions for where to spend your time in a
>> way that will help out people a great deal.
>
> I'm listening...

  i only get so many units of time to work on something.
the more rabbit holes i need to go down to figure out
a basic issue the less likely progress actually happens.

  detecting which type of system you are on and setting
up your package to install to the right location(s).
after [x] years this shouldn't be too hard and fairly
easy to find.  ugh.  add to that yet another layer for
which linux distribution...  double ugh.  the recommended
solutions are not really complete and they end up leading 
you down even more rabbit holes.

  platform, os, sys, pathlib, distro (looks like they need
help).

  a test of any change to the setup involves an upload
which may take a half hour or more to show up, by then
i can be interrupted and not get back to it for days.

  there must be a more local way to do the same thing but 
as of yet the develop option doesn't seem to work how i
would expect.  i'm not sure what my error is.  i'll have
to go back and look at documents.

  finding out all the caches and how to verify they are 
either in sync or if you should clear them and how.

  i do have testers for Mac and Windows that can give me 
feedback, but only the Mac person is a techie where i 
don't feel like i'd have to be there in person (and also
i see some indication that Mac and Linux are both Posix
so perhaps nothing else needs to be done there anyways 
once i figure out to get the manual page installed in the
right spot).  since i don't have a Windows machine it will 
take me longer to figure that out and the few people i
have for that testing are not techies so i'd want to be
there when they did the install just to see how it went.


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


Re: the python name

2019-01-02 Thread songbird
Rick Johnson wrote:
...
> Of course, no one can predict the consequences of every action. Not even GvR, 
> in is almost infinite wisdom, and his access to a semi-dependable time 
> machine, could predict such a tragedy of epic proportions.
>
> To say i'm saddened by the whole experience, would be an understatement. 
>
> If python dies, then not only will a huge portion of my efforts be wasted on 
> a dead language, but my heart will truly be broken. To me, Python was the 
> "little language that could". Chugging-a-lugging up that hill and overcoming 
> every obstacle with nothing but raw youthful enthusiasm. The underdog that 
> you cheered for. Or the runt, being the most cute and cuddly of them all. 
>
> If this language _can_ be saved, it certainly won't be easy. 
>
> I'm unsure about the current leadership. And even *IF* GvR made some sort of 
> "triumphant return", if he maintains the previous coarse, then the language 
> is doomed. Hmm... Which means, the only path out of this mess is a total 
> re-investment in the community; by every single person involved. 

  if FORTRAN and COBOL aren't dead i don't see Python
going away any time soon.

  if you want to know the perspective of a new person 
to the language and to help out make it better i have
a few suggestions for where to spend your time in a
way that will help out people a great deal.


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


Re: the python name

2019-01-02 Thread songbird
Dennis Lee Bieber wrote:
> On Wed, 2 Jan 2019 19:41:36 +, "Schachner, Joseph"
> declaimed the following:
>
>
>>The name "Python" may not make sense, but what sense does the name Java make, 
>>or even C (unless you know that it was the successor to B), or Haskell or 
>>Pascal or even BASIC?  Or Caml or Kotlin or Scratch?  Or Oberon or R? Or 
>>Smalltalk, or SNOBOL?
>>
>
>   Which was a derivative of BCPL (so one could claim a successor of C
> should be named P), ?, mathematician, beginners all-purpose symbolic
> instruction code. R? maybe a subtle implication to be better/in-front-of S.
> SNOBOL is the ugly one, since the SN come from "string", and the BO from
> the middle of "symbolic".

  i can only claim to have written one program in
SNOBOL and that was over 30yrs ago...

  being new to Python i'm not concerned about the 
name of it as much as having fun in figuring out
what to do with it.


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


Re: setup.py and licensing questions

2018-12-12 Thread songbird
Ben Finney wrote:
> songbird writes:
>
>>   can i put multiple License lines in setup.py 
>> classifiers like: ?
>>
>>   "License :: OSI Approved :: ???",
>>   "License :: OSI Approved :: ???",
>
> Yes.
>
> The semantics of that are not formalised, to my knowledge. You would be
> signaling that the specified licenses are involved somehow, but not how
> they combine for this specific work.

  ok, thanks, that's good to know.

  i will have a list of each file i've used from
elsewhere, where it came from and as best as i can 
figure it out the licenses/copyright holders and/or
permissions.  i'm not using anyone else's code but
i am using some artwork and a man page that i've
adapted.


> For this reason (and others) you should always put an explicit,
> unambiguous *grant of license* in the work, preferably in the README
> document or somewhere prominent like that.
>
> The grant of license is a statement, preferably brief, that says exactly
> what the work is, who holds copyright, who receives a grant of license,
> and what that grants the recipient to do, under what explicit conditions.
>
> For example:
>
> Copyright © 2018 Ben Finney 
> Purple Drachma is free software: you are free to copy, modify,
> and/or distribute this work under the conditions of the GNU Affero
> General Public License, version 3 or later as published by the Free
> Software Foundation. See the file LICENSE.AGPL-3.0 for details.

  yes, i'll be putting a license on the code and any
of the artwork i've made.

  thank you,


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


setup.py and licensing questions

2018-12-12 Thread songbird
hi,

  i'm currently working through all the packaging and 
licensing stuff for my project and want to put the 
license in the setup.py file, but there may actually 
be more than one license (GPL ones for the artwork 
i've borrowed from another project and whatever license 
i choose to put on my own code and the artwork i've done).

  can i put multiple License lines in setup.py 
classifiers like: ?

  "License :: OSI Approved :: ???",
  "License :: OSI Approved :: ???",


  thanks,


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


Re: What Python books to you recommend to beginners?

2018-12-03 Thread songbird
A person wrote via e-mail:
> songbird wrote:
>> Dennis Lee Bieber wrote:
...

[post ok'd by them]


> >my goal in learning python was to use it as a way of
> > picking up OOP concepts in a more concrete way (theory
> > alone doesn't give me enough hands on the bits i need so
> > i tend to just do other things instead).
> > 
> >now that i've used python for a starting project and
> > have that project mostly working i want to step back and
> > work on the OOP aspects.

> A Scandinavian company put out a good series (I think by Lean Publishing).
> The first is "The Python Apprentice", the next is "The Python Journeyman",
> and presumably there is a third that I have yet to see, ie 'Master'.
> 
> Perhaps "Clean Code in Python", Packt - doesn't match everyone's style.

  will take a look for things and see what i can find.
so i'll put these on the list.

 
> Python's 'batteries included' is exemplified by the Python Standard Library.
> Doug Hellman used to blog a 'Python Module of the Week' (see
> https://pymotw.com/3/) which you might review. He has also published a book
> on the PSL through O'Reilly.

  ok, thanks.  :)

 
> To some extent you may be talking about Design Patterns. Unfortunately, this
> area is terribly confused by certain authors taking concepts from other
> languages, eg Java, and trying to find a Python equivalent. This is a
> grossly non-Pythonic approach. So, I'll join a previous correspondent by
> recommending you stay away from anything 'tainted' by Java-think.

  i would agree with that anyways...


> There are plenty of Python books 'about'. Beyond the 'basics' they tend to
> become more topical, eg Scientific, Financial, Data Analysis... so what
> suits you might not me.

  i'm pretty well read so i can adapt to a lot of
subject matters as long as the concepts are geared
towards what i'm after.  a solid example is a good
thing as long as it covers the concepts - the 
problem i usually have with many examples though is
that they are too simplistic to be interesting enough
but that's just me being picky.  ha...


> Your question is rather broad and open-ended. Do you have access to a decent
> library? What is available there? Have you looked at the various free
> books/downloads and YouTube subscriptions? Happy reading!

  i do have access to a library and it is connected to
the rest of the state and country if i can't get any
of the mentioned items within the network.  though i 
much prefer an electronic copy because the amount of
time it may take me to get through a longer text.


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


Re: What Python books to you recommend to beginners?

2018-12-03 Thread songbird
boB Stepp wrote:
...
> You might want to look at "Python 3 -- Object Oriented Programming" by
> Dusty Phillips.  It is copyright 2010, so it won't have the latest,
> greatest Python 3 features, but the book's entire focus is teaching
> OOP in a Python 3 context.

  thanks, i'll put it on the list to seek.


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


Re: What Python books to you recommend to beginners?

2018-12-02 Thread songbird
Dennis Lee Bieber wrote:
> On Sun, 2 Dec 2018 12:40:44 -0500, songbird 
> declaimed the following:
>

>>  as references those are useful, but howabout 
>>something a bit more conceptual or design oriented?
>>
>
>   At that level, you are not looking for "Python" books but rather
> software engineering texts -- which should provide concepts you then map
> into the language being used.
...

  but i am...


...
> has OOP features -- you don't have to code your own dispatching logic. The
> current favored notation for OOAD modeling is UML, so a book on UML might
> be useful:
>
> Beginning UML 2.0 (O'Reilly)
> UML Distilled (Addison-Wesley)
> Using UML (Addison-Wesley)
>
>   These are somewhat old and may have newer texts available. It's been
> some 5+ years since I bought any books of this class; my more recent books
> have been microprocessor subjects (Arduino, R-Pi, Beaglebone, PIC and ARM
> Cortex M-series)
...

  thanks,

  i'll look at UML, not sure i want to learn yet another
language on top of python.

  my goal in learning python was to use it as a way of 
picking up OOP concepts in a more concrete way (theory
alone doesn't give me enough hands on the bits i need so
i tend to just do other things instead).

  now that i've used python for a starting project and 
have that project mostly working i want to step back and 
work on the OOP aspects.


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


Re: What Python books to you recommend to beginners?

2018-12-02 Thread songbird
Stefan Ram wrote:
...

  thank you.  :)

  as references those are useful, but howabout 
something a bit more conceptual or design oriented?

  i have a pretty good idea about various language
features or things to try, but i need a little more
higher level view of how to go about building a
python program.

  i can hack stuff together and it works, but it
doesn't look pretty...  :)


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


Re: Overwhelmed by the Simplicity of Python. Any Recommendation?

2018-11-03 Thread songbird
Rhodri James wrote:
...
> I completely agree.  I too have come from a background in C, and still 
> do most of my day job in C or assembler.  It took a while before I was 
> writing idiomatic Python, never mind efficient Python (arguably I still 
> don't, but as Rob says, who cares?).  Don't worry about it; at some 
> point you will discover that the "obvious" Python you are writing looks 
> a lot like the code you are looking at now and thinking "that's really 
> clever, I'll never be able to to that."

  at this stage of my own process in learning, i'm
trying to read the FAQs i can find, any tutorials,
answers to specific questions on stackoverflow on
particular topics to see if i can understand the
issues, etc.

  as for my own code, yes, it's horrible at the 
moment, but to me working code is always the 
final arbitor.  i much prefer simple and stepwise
refinement if speed isn't the issue i think clarity
and simplicity is more important.

  speed is only more important for large projects 
that process a ton of data.

  in 3-5yrs i expect to understand more of what 
the theory and more conceptual things going on as
i read more of the history and how the language 
has developed.

  i won't consider myself fluent until i start 
"thinking" in it and can visualise the data
structures/objects in my head and such as i 
currently do for C.


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


Re: pyglet, i don't understand why this code isn't working

2018-11-02 Thread songbird
Peter Otten wrote:
> songbird wrote:
>> MRAB wrote:
>>> On 2018-11-02 19:58, songbird wrote:
>>>> 
>>>>hello,  :)
>>>> 
>
>>> [snip]
>>> In __init__ you initialise self.animation_initial_turn_it_off to True.
>>>
>>> Nowhere in your code do you change it, so it remains True.
>> 
>>   i wish it were that easy...
>> 
>>   see my_sprite.py
>
> It *is* that that easy. Just spot the typo in 
>
>> self.animation_initial_turn_if_off = False
>> ^^

  i just did...  1 minute ago, learnin how to use debugger
and there it was.

  lol

  thanks  :)


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


Re: pyglet, i don't understand why this code isn't working

2018-11-02 Thread songbird
MRAB wrote:
> On 2018-11-02 19:58, songbird wrote:
>> 
>>hello,  :)
>> 
>>my question is below, a bit of background first.
>> i'm very new to python and picking it up by working
>> on a project for fun.
>> 
>>please don't critique my style or lack of
>> classes/objects in the code yet - i'm way too new.  :)
>> 
>> 
>>my current project is at:
>> 
>>https://salsa.debian.org/ant-guest/gfpoken-in-python/
>>https://salsa.debian.org/ant-guest/gfpoken-in-python/tree/next
>> 
>>i'm using pyglet (most recent version) and gtk...
>> in Debian Linux testing.
>> 
>>my question is that in on_animation_end in the my_sprite.py
>> class doesn't seem to work as i'd expect.
>> 
>>i never reach:   print ("Do we Ever get here?") statement.
>> 
>>and i'm curious if i've just messed up something obvious
>> here or if my problem is elsewhere?
>> 
> [snip]
> In __init__ you initialise self.animation_initial_turn_it_off to True.
>
> Nowhere in your code do you change it, so it remains True.

  i wish it were that easy...

  see my_sprite.py 

...
def on_animation_end (self):

# we're already running when initialised so we
# have to shut it off until we restart it again
# but we only have to do this once as from then on
# each animation will check the global flag to see
# if it should run
#print ("AF AC ", self.animation_foo, self.animation_count)
self.animation_foo = False
self.animation_count += 1
if ((self.animation_initial_turn_it_off == True) and
(self.animation_running == True)):
print ("initial shut down animation AR True")
pyglet.clock.unschedule(self._animate)
self.animation_initial_turn_if_off = False
^^

self.animation_running = False
pprint.pprint(MySprite.__mro__)
pprint.pprint(MySprite.on_animation_end)
elif ((self.animation_initial_turn_it_off == True) and
(self.animation_running == False)):
    # we shouldn't get here, but just in case
# just turn it off again...
#print ("initial shut down animation AR False")
self.animation_initial_turn_if_off = False
...


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


pyglet, i don't understand why this code isn't working

2018-11-02 Thread songbird


  hello,  :)

  my question is below, a bit of background first.
i'm very new to python and picking it up by working
on a project for fun.

  please don't critique my style or lack of
classes/objects in the code yet - i'm way too new.  :)


  my current project is at:

  https://salsa.debian.org/ant-guest/gfpoken-in-python/
  https://salsa.debian.org/ant-guest/gfpoken-in-python/tree/next

  i'm using pyglet (most recent version) and gtk...
in Debian Linux testing.

  my question is that in on_animation_end in the my_sprite.py
class doesn't seem to work as i'd expect.

  i never reach:   print ("Do we Ever get here?") statement.

  and i'm curious if i've just messed up something obvious
here or if my problem is elsewhere?

  i don't really quite understand subclasses/super yet so
perhaps i've abused it?

  the overall issue is that i'm trying to turn off and on
the animation and while i can do it in code like below i
haven't yet been able to figure out how to get that into
my other code...

  thanks for your input/consideration.  :)

  p.s. if you don't know the game gfpoken it is in 
debian/linux and it is a mirror puzzle game.  the
man page is there.  i haven't written help screen or
directions yet, but you click on things to the right
and place them on the grid on the left until the output
of the animation matches the colored arrows.

  it is mostly done other than some directions, checking
the boards for matching/winning, winning game screen and 
help.  just trying to iron this issue out...


=
import pyglet

marble_roll_image = pyglet.image.load('green_marbles.png')
marble_seq = pyglet.image.ImageGrid(marble_roll_image, 1, 16)
anim = pyglet.image.Animation.from_image_sequence(marble_seq, 0.1, True)
marble_anim_sprite = pyglet.sprite.Sprite(anim)

window = pyglet.window.Window()

def test_off (dt, sprite):
pyglet.clock.unschedule(sprite._animate)

def test_on (dt, sprite):
pyglet.clock.schedule(sprite._animate)


pyglet.clock.schedule_once(test_off, 5, marble_anim_sprite)
pyglet.clock.schedule_once(test_on, 10, marble_anim_sprite)


@window.event
def on_draw():
window.clear()
marble_anim_sprite.draw()


@marble_anim_sprite.event
def on_animation_end ():

print ("on_animation_end ")


pyglet.app.run()
=


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


amusing error message

2018-11-02 Thread songbird
  hello,  :)

  this is just a bit of amusement, i'll post my
current question in another thread...

  please don't critique my style or lack of
classes/objects in the code yet - i'm way too new.  :)

  my current project is at:

  https://salsa.debian.org/ant-guest/gfpoken-in-python/
  https://salsa.debian.org/ant-guest/gfpoken-in-python/tree/next

  i'm using pyglet (most recent version) and gtk...


  the amusing bit:

  working on my git next branch...


  in my_sprite.py if i take the self out of on_animation_end parentheses i get 
this error message:

TypeError: The 'on_animation_end' event was dispatched with 0 arguments, but 
the handler 'on_animation_end' at /home/me/src/salsa/ngfp/my_sprite.py:23 is 
written with 0 arguments.

  0 <> 0!   :)


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


Re: introduction

2018-11-02 Thread songbird
Dariet Kamukama wrote:
> hey hw is every body here, am new to the group and want to learn python

  i'm good, thanks...  :)

  i'm also a beginner with python.

  do you have other programming experience?

  i have a fair amount of non OOP experience in
mostly functional types like C or Pascal.

  some Lisp, assembler, algol, sql, fortran, many
other bits of this and that (shell languages, awk,
sed, lex, yacc, etc.)...

  all i can say about learning a new language is 
that i need to have a project to work on to make 
it interesting so i've picked a project and am 
working on it and picking up ideas as i go and 
have time to study more.

  i'm woefully bad at OOP concepts and it takes
me a while for things to sink in.

  i see familiar names here from other lists i've 
been reading and writing to a few.  :)


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