Re: Installed correctly

2006-08-13 Thread Rich


Well thanks for all your replies. 

I've now uninstalled Python, and reinstalled it using the default path
(C:\pythoh24). But command line still says "unrecognized command",
when typng "pythoin". so maybe you have to 


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


Re: Installed correctly

2006-08-13 Thread Rich

(sorry, I accidentally hit "send" before I was finished)

Well thanks for all your replies. 

I've now uninstalled Python, and reinstalled it using the default path
(C:\python24), to avoid any complications. But command line still said
"unrecognized command", when typing "python". So apparently you have
to do that manually (at least in some cases). In any case I added the
path according to your instructions, and now it seems to work. 

Perhaps the page refered to systems that comes with Python
pre-installed (they mention that some HP machines do). Obviously, the
pre-iinstallation would have to include setting the path. 

Again, thanks for your help! :)


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


passing a variable to an external program

2007-01-11 Thread Rich
I want to run an external program using os.system() but I want to
include a variable in the middle of the command line.

An example of the type of thing I want to be able to do:
pathname = os.path.dirname(sys.argv[0])
os.system('cscript /nologo ' + pathname + '\test.vbs')

When I run this, everything after pathname + seems to be ignored.  Is
this just incorrect syntax or am I trying to do something fundamentally
wrong?  Is there a better way to do something like this?  I'm trying to
move from perl to python and this is my first attempt at python.

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


Re: passing a variable to an external program

2007-01-11 Thread Rich
Thank you, that did it.  I don't know why I didn't think to escape the
\ with \\.

On Jan 11, 2:18 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-01-11, Rich <[EMAIL PROTECTED]> wrote:
>
> > I want to run an external program using os.system() but I want to
> > include a variable in the middle of the command line.
>
> > An example of the type of thing I want to be able to do:
> > pathname = os.path.dirname(sys.argv[0])
> > os.system('cscript /nologo ' + pathname + '\test.vbs')Use / instead of \, 
> > or \\ instead of \.
>
> --
> Neil Cerutti
> Ushers will eat latecomers. --Church Bulletin Blooper

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


newbie - returned values from cscript.exe

2007-01-24 Thread Rich
I am writing my first python script and I'm guessing this is something
obvious but I can't find any examples of doing something like this.  I
have a python script that is running a vbscript through cscript.exe.
The vbscript looks up a server name, username, password etc and returns
these values in a delimited list using wscript.echo.  I can assign
these values to variables using a Windows batch files with the
following code

FOR /F "tokens=1-6" %%a in ('cscript /nologo GetServerAccessInfo.vbs"')
do (
SET DB_SERVER_NAME=%%a
SET DB_NAME=%%b
SET NMDBO_USERNAME=%%c
SET NMDBO_PASSWORD=%%d
SET SU_USERNAME=%%e
SET SU_PASSWORD=%%f

I can't figure out how to do the same thing using a python script to
call this instead of a batch file.

I am running the vbscript by using the following command
os.system('cscript /nologo GetServerAccessInfo.vbs')

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


Help with pyserial and sending binary data?

2008-05-02 Thread Rich
Hello,

I am working on a python library for sending and receiving data from a Subaru's 
ECU (the fuel injection computer) via the OBD-II port and an OBD to USB cable, 
with the Subaru Select Monitor protocol. There are a few open source programs 
that do this already (http://romraider.com/ , http://jdash.sourceforge.net/ , 
http://tari.co.za/downloads/software/source/ ), but they are written in Java or 
C++. I have never done anything with serial before, and very little with binary 
data, so this is all new to me. 

The SSM protocol is fairly simple - a request packet (all in binary, 
represented in hex) consists of a header (0x80), destination byte (0x10 for the 
ECU), source byte (0xf0 for the diagnostic tool - AKA your computer), Payload 
length in hex, the Payload, which is one of 6 known commands(0xA0 Read memory, 
0xA8 Read single address, 0xB0 Write memory, 0xB8 Write single address, 0xBF 
ECU init) and addresses or address range, then the checksum byte, which is the 
8 least-significant bits of the sum of the rest of the request packet.

A returned packet consists of a header, destination byte (your computer), 
source byte (ECU), payload size (all data between payload size and checksum 
byte), and the same checksum byte. Further reading (pretty good documentation 
on the protocol) is here: http://tari.co.za/downloads/documentation/ssm.pdf , 
but that is the basics to at least say hi to your car from your computer. 

So I've been messing with it, and in as few lines as possible, this should in 
theory, send the init command to the ECU (0x80 0x10 0xF0 0x01 0xBF 0x40), and 
the ECU should return its ID to let you know that you can now chat (something 
like 0x80 0xF0 0x10 0x39 0xFF 0xA2 0x10 0x0F 0x1B 0x14 0x40 0x05 0x05 0x73 0xFA 
0xEB ..):

#--
import serial, string
output = " "
ser = serial.Serial('/dev/ttyUSB0', 4800, 8, 'N', 1, timeout=1)
ser.write(chr(0x80)+chr(0x10)+chr(0xF0)+chr(0x01)+chr(0xBF)+chr(0x40))
while output != "":
   output = ser.read()
   print hex(ord(output))
#--

The only problem is that when I send the ECU init command, it just echos back 
the data I sent it, which, from my understanding, means that I sent an invalid 
request packet. I'm guessing that there aren't many people on this list with 
OBD-II subarus and an open port cable ( 
http://www.tactrix.com/product_info.php?products_id=36 ) that could test this 
out, but in the off chance there is, perhaps you could help. I've been chatting 
with the RomRaider developers ( http://www.romraider.com/forum/topic3129.html ) 
on the subject, but they are Java guys, not Python guys. There is more 
encompassing code there, but something lies wrong in my basic implementation 
above.

My best guess I have heard is that chr() isn't encoding the hex value properly 
to a byte value the ECU understands (wrong endianness?), or chr() encoding 
isn't always representing hex as an 8-bit byte. chr() should always encode to 
an 8-bit byte (not 7-bit ASCII or anything, correct)? Is there any way to 
switch byte endianness, or ensure I am encoding 8-bit bytes? Any help is much 
appreciated. Thanks!

 -rich



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--
http://mail.python.org/mailman/listinfo/python-list


Learning different languages

2006-03-07 Thread Rich

Hi,

(this is a probably a bit OT here, but comp.lang seems rather
desolated, so I'm not sure I would get an answer there. And right now
I'm in the middle of learning Python anyway so...)

Anyway, my question is: what experience you people have with working
with different languages at the same time?

Actually I did myself many years ago, on my Commodore machines, where
I programmed a lot in both basic, assembler and machine code, and
don't recall I had any problems with handling these parallel. But
then, they are very different languages, so it's not easy to get their
syntax etc. mixed up with each other. 

I'm more thinking about Python, PHP, C++, Perl, Euphoria, which are
languages I'm thinking of learning now. They look much more like each
other than basic and MC, at places some even share the exact same
syntax it seems, so your brain might get confused with what language
you're actually working with?

How is your experience with handling these paralell?. And what would
you recommend - take one (or perhaps two) at a time, and then continue
with the next? Or is it OK to go ahead with them all, at once?


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


Re: Learning different languages

2006-03-09 Thread Rich
On Tue, 07 Mar 2006 23:44:56 +0100, Rich <[EMAIL PROTECTED]> wrote:


Well thanks for all your replies.There seem to be general agreement
that it's best to learn one language at a time, which also is what
makes most sense to me. 

I'm also glad to hear it's not a big problem to separate the different
languages, in practice. The analogy with different spoken languages
makes sense, yes, I have no problem at all in that respect.

Your additional comments have also thrown some light on issues I
wasn't aware of. So thanks again, your input has been very helpful and
reassuring!

:-)

Rich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Academic citation of Python

2012-06-16 Thread Rich Webb
On Sat, 16 Jun 2012 14:01:12 +0100, Mark Lawrence
 wrote:

>On 16/06/2012 04:24, Mark Livingstone wrote:
>> Hello!
>>
>> I wish to properly cite Python in an academic paper I am writing.
>>
>> Is there a preferred document etc to cite?
>>
>> Thanks in advance,
>>
>> MArkL
>
>The main website www.python.org and possibly the sites for Jython, 
>IronPython and PyPY?

He's probably looking for an IEC or ANSI standard, like "Information
technology — Programming languages — C  INCITS/ISO/IEC 9899-2011[2012]
(ISO/IEC 9899-2011, IDT)". I don't think URLs qualify as standards
documents.

-- 
Rich Webb Norfolk, VA
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter: multicolumn table widget

2022-05-31 Thread Rich Shepard

My web searches haven't helped me learn how to design a read-only scrollable
table widget displaying rows retrieved from postgres database tables. This
is for my business development application.

I'm writing a view module that displays my contact history with a named
person. The person's last and first name are passed to the database tables
and all the results are displayed in a read-only view.

The view has three vertical sections: person information on top, contact
methods (phones, email) below that, and a scrollable, multicolumn table
at the bottom.

The table columns consist of three tk.StringVal() and one tk.Text() which
usually has multiple rows related to that contact event.

I want to learn how to create the table so each row has the contents of each
of the four columns and I can scroll down and up to look at the history.

All help is certainly appreciated.

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


Re: Tkinter: multicolumn table widget

2022-05-31 Thread Rich Shepard

On Tue, 31 May 2022, MRAB wrote:


Have a look at the tkinter.ttk.Treeview widget; it can be formatted as a
tree hierarchy, its name suggests, or a multi-column tables, but it
doesn't support multi-line text though, as far as I know.


MRAB,

Thank you, I will.

Each time I add a row to the contacts database table I include a note of
what was discussed and what needs to be done. I'd like to be able to see the
entire note with each contact event.

I'm not committed to using a table so I'm totally open to other approaches.
My needs are few:
  - The returned results are read-only.
  - The number of rows returned are variable.
  - Each row has a contact date, contact type, note, and next contact date.
The last one isn't necessary to be displayed, but the first three are.
  - I want to be able to scroll and view all returned rows.

As with the tkinter.Text widget, you'll need to add the scrollbar(s) 
separately and then link them.


This I expected.

Thanks,

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


Re: Tkinter: multicolumn table widget

2022-05-31 Thread Rich Shepard

On Tue, 31 May 2022, MRAB wrote:


The note could be displayed partially in the column itself, with the full
text displayed either in read-only textbox nearby when the row is selected
(and it's the only selected row), or in the form of a tooltip when you
hover over it.

There's an example of how to show a tooltip here:
https://stackoverflow.com/questions/3221956/how-do-i-display-tooltips-in-tkinter


MRAB,

Thank you very much. I've been reading about the TreeView and learning how
to use it. Displaying the text column in a read-only textbox or tooltip
would certainly do the job.

Best regards,

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


Re: Tkinter: multicolumn table widget

2022-06-06 Thread Rich Shepard

On Tue, 31 May 2022, MRAB wrote:


There's an example of how to show a tooltip here:
https://stackoverflow.com/questions/3221956/how-do-i-display-tooltips-in-tkinter


MRAB,

A tooltip would work. I downloaded the first example and assume that it will
display a treeview cell when the cursor hovers over it without needing to be
limited to a single column.

When I test the module (I'm still writing it) I'll learn what needs fixing.

Thanks very much,

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


Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard

I'm not seeing the error source in a small tkinter module I'm testing.

The module code:
---
import tkinter as tk
from tkinter import ttk

import common_classes as cc

class ConactNameInput(tk.Frame):
def __init__(self, parent, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
# A dict to keep track of input widgets
self.inputs = {}

self.inputs['Last name'] = cc.LabelInput(
ContactNameInput, 'lname',
input_class = ttk.Entry,
input_var = tk.StringVar()
)
self.inputs['Last name'].grid(row = 0, column = 0)
#
self.inputs['First name'] = cc.LabelInput(
ContactNameInput, 'fname',
input_class = ttk.Entry,
input_var = tk.StringVar()
)
self.inputs['First name'].grid(row = 0, column = 1)

okay_button = tk.Button(self, text="OK",
command=self.ok)
okay_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20))

cancel_button = tk.Button(self, text="Cancel",
  command=self.cancel)
cancel_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))

def okay_button(self):
pass

def cancel_button(self):
Quitter()

def get_last_name(self):
pass

def get_first_name(self):
pass


class NameApplication(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title("Contact Name")
self.geometry("800x600")
self.resizable(width = False, height = False)
ContactNameInput(self).grid(row = 0, column = 0, sticky=('EWNS'))
self.columnconfigure(0, weight=1)

if __name__ == '__main__':
app = NameApplication()
app.mainloop()
--

The python error traceback:
--
Traceback (most recent call last):
  File "contact_history_name_input.py", line 60, in 
app = NameApplication()
  File "contact_history_name_input.py", line 55, in __init__
ContactNameInput(self).grid(row = 0, column = 0, sticky=('EWNS'))
  File "contact_history_name_input.py", line 17, in __init__
input_var = tk.StringVar()
  File "/home/rshepard/development/BusinessTracker/views/common_classes.py", 
line 46, in __init__
super().__init__(parent, **kwargs)
  File "/usr/lib64/python3.7/tkinter/__init__.py", line 2744, in __init__
Widget.__init__(self, master, 'frame', cnf, {}, extra)
  File "/usr/lib64/python3.7/tkinter/__init__.py", line 2292, in __init__
BaseWidget._setup(self, master, cnf)
  File "/usr/lib64/python3.7/tkinter/__init__.py", line 2262, in _setup
self.tk = master.tk
AttributeError: type object 'ContactNameInput' has no attribute 'tk'
--

I'm not correctly placing the NameInput class in the NameApplication frame.
What have I missed?

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


Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard

On Fri, 17 Jun 2022, MRAB wrote:

You haven't shown the code for common_classes.LabelInput, but I'm guessing 
that the first argument should be the parent.


Here's the LabelInput class:
class LabelInput(tk.Frame):
""" A widget containing a label and input together. """

def __init__(self, parent, label='', input_class=ttk.Entry,
 input_var=None, input_args=None, label_args=None,
 **kwargs):
super().__init__(parent, **kwargs)
label_args = label_args or {}
input_args = input_args or {}
self.variable = input_var,

if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton):
input_args["text"] = label
input_args["variable"] = input_var
else:
self.label = ttk.Label(self, text=label, **label_args)
self.label.grid(row=0, column=0, sticky=(tk.W + tk.E))
input_args["textvariable"] = input_var

self.input = input_class(self, **input_args)
self.input.grid(row=1, column=0, sticky=(tk.W + tk.E))
self.columnconfigure(0, weight=1)
self.error = getattr(self.input, 'error', tk.StringVar())
self.error_label = ttk.Label(self, textvariable=self.error)
self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E))

def grid(self, sticky=(tk.E + tk.W), **kwargs):
super().grid(sticky=sticky, **kwargs)

def get(self):
try:
if self.variable:
return self.variable.get()
elif type(self.input) == tk.Text:
return self.input.get('1.0', tk.END)
else:
return self.input.get()
except (TypeError, tk.TclError):
# happens when numeric fields are empty.
return ''

def set(self, value, *args, **kwargs):
if type(self.variable) == tk.BooleanVar:
self.variable.set(bool(value))
elif self.variable:
self.variable.set(value, *args, **kwargs)
elif type(self.input) in (ttk.Checkbutton, ttk.Radiobutton):
if value:
self.input.select()
else:
self.input.deselect()
elif type(self.input) == tk.Text:
self.input.delete('1.0', tk.END)
self.input.insert('1.0', value)
else:
self.input.delete(0, tk.END)
self.input.insert(0, value)

You're passing in the _class_ ConactNameInput, but I'm guessing that it 
should be an _instance_ of that class, in this case, 'self'.


Haven't I done this in the application class?
class NameApplication(tk.Tk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title("Contact Name")
self.geometry("800x600")
self.resizable(width = False, height = False)
ContactNameInput(self).grid(row = 0, column = 0, sticky=('EWNS'))
self.columnconfigure(0, weight=1)

If not, where do I specify the instance of the ContactNameInput class?

Thanks,

Rich


--
Richard Shepard, Ph.D.  The Environmental Issues Doctor
Applied Ecosystem Services, LLC
Troutdale, OR 97060 USA503-667-4517 www[dot]appl-ecosys[dot]com
--
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard

On Fri, 17 Jun 2022, MRAB wrote:


This:

self.inputs['Last name'] = cc.LabelInput(
ContactNameInput, 'lname',
input_class = ttk.Entry,
input_var = tk.StringVar()
)

should be this:

self.inputs['Last name'] = cc.LabelInput(
self, 'lname',
input_class = ttk.Entry,
input_var = tk.StringVar()
)

Also, this:

self.inputs['First name'] = cc.LabelInput(
ContactNameInput, 'fname',
input_class = ttk.Entry,
input_var = tk.StringVar()
)

should be this:

self.inputs['First name'] = cc.LabelInput(
self, 'fname',
input_class = ttk.Entry,
input_var = tk.StringVar()
)


MRAB,

Ah! I must have misread Alan Moore's examples, then. I'll need to fix all my
views.

Thank you,

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


Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Rich Shepard

On Fri, 17 Jun 2022, Dennis Lee Bieber wrote:


ContactNameInput, 'lname',
ContactNameInput, 'fname',


This works if a tk.labelframe is where the widget is placed. In my case, as
MRAB taught me, the proper syntax is
self,'lname'...
self.'fname'...

Thanks, Dennis,

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


Re: Tkinter module test: widget class not inserted in application frame

2022-06-18 Thread Rich Shepard

On Sat, 18 Jun 2022, Peter J. Holzer wrote:


There is a comma (U+002C) here ...
And a dot (U+002E) here.


That was a typo when I wrote the message. And I usually add a space after
commas and surrounding equal signs, all for easier reading.

Thank you,

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


Re: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-13 Thread Rich Shepard

On Mon, 13 Mar 2023, Thomas Passin wrote:

But what I need is analysis of seismograms from 4,000 seismographs world 
wide to detect P-wave energy distribution underground around the earthquake 
to verify EQ Domino Effect



In that case, you will have to do a great deal of work to get all that
data into a common usable form, cleaned and errors removed. That will be a
lot of effort no matter what language you use. In the Matplotlib lesson
you pointed to, the work was already done, for one one earthquake at one
location.


Wouldn't Pandas help here?

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


Re: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-13 Thread Rich Shepard

On Mon, 13 Mar 2023, Thomas Passin wrote:


No doubt, depending on the data formats used. But it's still going to be a
big task.


Thomas,

True, but once you have a dataframe with all the information about all the
earthquakes you can extract data for every analysis you want to do.

If you've not read Wes McKinney's "Python for Data Analysis: Data Wrangling
with Pandas, NumPy, and IPython" I encourage you to do so.

Regards,

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


Cannot install pkg_resources using pip

2023-04-16 Thread Rich Shepard

Python3-3.9.10 installed on this Slackware64-14.2 desktop. Trying to run
meson to build an application I'm told it's missing pkg_resources, which is
part of setuptools. The command fails:
# pip install setuptools
bash: /usr/bin/pip: /usr/bin/python3.7: bad interpreter: No such file or 
directory

There is no python3.7 here:
# ls /usr/bin/python3.7
ls: cannot access '/usr/bin/python3.7': No such file or directory

How do I clean this up?

TIA,

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


Re: Cannot install pkg_resources using pip

2023-04-16 Thread Rich Shepard

On Sun, 16 Apr 2023, Thomas Passin wrote:


It worked then because your path found a pip script. When there are more
than one Python installations, it can be unclear which one will get run,
depending on how the path got set up after the last version was installed.


Thomas,

I probably last used pip with a python-3.7 version.


To check your version of Python, run
python3 -V


$ python3 -V
Python 3.9.10


Then try to run pip:
python3.9 -m pip


$ python3.9 -m pip
/usr/bin/python3.9: No module named pip

If pip has not been installed (very possible on Linux), then you will need to 
get it.  If python3.9 is not the system-upgraded version, then do an internet 
search for "linux python install pip". There's a pip website that has an 
installer for it. I never remember what it's called, so I always have to 
search for it myself.


https://www.redhat.com/sysadmin/install-python-pip-linux

I'll download the installer from ther.

If it appears that python3.9 *is* the version installed by the system, then 
use the system installer to install the right version of pip - as I said 
above, the package name can vary across distros.


It should have been installed with the upgrade to 3.9.10


Your message doesn't seem to have been copied to the mailing list. If you
don't mind, it could help other people if you copied it and this reply to
the list.


I always respond to the mail list if that's the 'reply to' address.
Sometimes I don't check the address used in my reply, assuming it's correct.

Thanks,

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


Re: Cannot install pkg_resources using pip

2023-04-16 Thread Rich Shepard

On Sun, 16 Apr 2023, Rich Shepard wrote:


I'll download the installer from there.


But, I still cannot install the pkg_resources module that meson wants to
start the build of pulseaudio-equalizer:
# pip install pkg_resources
ERROR: Could not find a version that satisfies the requirement pkg_resources 
(from versions: none)
ERROR: No matching distribution found for pkg_resources

Rich

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


Re: Cannot install pkg_resources using pip

2023-04-17 Thread Rich Shepard

On Sun, 16 Apr 2023, Thomas Passin wrote:


Sorry, Rich, I've never dealt with this so someone else will have to give
suggestions.


Thomas,

This is all new to me, too.


I would try to see if there are any versions available. It could be that
meson says it needs version x but only version y > x is available. Pip
will quit but meson may very well work with the available version anyway.
So I would try to install pkg_resources on its own, and then see if the
meson build can succeed. No guarantees, but I've seen this work before. So
python3.9 -m pip install --user pkg_resources

Or, to see what versions if any are available:
python3.9 -m pip install --user pkg_resources==
# NO spaces allowed before the "==".


Thank you. I'll give this a try.

Regards,

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


Re: Cannot install pkg_resources using pip [RESOLVED]

2023-04-17 Thread Rich Shepard

On Sun, 16 Apr 2023, Rich Shepard wrote:


How do I clean this up?


My thanks for the suggestions and ideas you sent me on this issue. I've
resolved it by not trying to build pulseaudio-equalizer. I don't need it
because I learned this morning that my Yamaha CM500 headset clearly heard
the Zoom audio test tones and voices on a YouTube video.

I'm testing the headset on a Zoom call this afternoon with a friend.
Assuming it works with the meeting as it did on the Zoom test I'll use it
for Zoom and Jitsi meetings and use the Marantz Pro mic and Panasonic
headphones for recording web tutorials and podcasts.

Regards,

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


Re: Cannot install pkg_resources using pip

2023-04-17 Thread Rich Shepard

On Mon, 17 Apr 2023, aapost wrote:


Slackware isn't as straight forward in it's management as other distros
(not standardized anyway).


I've used Slackware for 20 years; it's completely rationale and comfortable
for me. :-)


That being said, if you start from python source ...


If worse came to worse, I'd reinstall the distro package.

Thanks,

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


where is requests

2023-05-23 Thread Rich Osborne
I have install Python 3.11.3 but my import requests does not work. I found 
documentation that refers to C:\python35 but I am on 3.11.3. Where do I find 
requests?



Sent from Mail for Windows

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


Re: Application window geometry specifier [RESOLVED]

2021-01-12 Thread Rich Shepard

On Wed, 13 Jan 2021, Chris Angelico wrote:


Do the offsets need to be integers?


ChrisA,

Yep. I totally missed that.

Thanks for seeing it.

Stay well,

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


Re: Application window geometry specifier

2021-01-12 Thread Rich Shepard

On Tue, 12 Jan 2021, Igor Korot wrote:


Keep in mind that if you target Linux, the "modern" window server
(Wayland) will not allow user code to decide the positioning and size of
the TLW.


Igor,

I suspect that Slackware will continue with X11.

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


Re: Application window geometry specifier

2021-01-12 Thread Rich Shepard

On Tue, 12 Jan 2021, Igor Korot wrote:


Maybe. :-)
But it looks Wayland becomes more and more popular.


Igor,

What I've read from those struggling to use Wayland, it may turn out to be a
popular as systemd. :-)

It's important to remember that while all progress involves change, not all
change involves progress.

Regards,

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


Binding menu accelerator to a callback

2021-01-12 Thread Rich Shepard

Menu options work from the menu, but not from the accelerator associated
with that menu item. My research suggests that while 'command' works for the
menu item, 'bind' is required for the associated accelerator. For example,
File -> Quit is defined this way:

self.file_menu.add_command(
label="Quit",
command=self.fileQuit,
underline=0,
accelerator='Ctrl+Q'
)
and works when I pull down the File menu and click on 'Quit.'

I want to modify the menu items so the accelerator is bound to the same
self.fileQuit() (in this case). My web research hasn't found a solution
since examples for using bind() aren't in menus.

Do I need another method that associates accelerators with the callbacks?

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


Re: Application window geometry specifier

2021-01-12 Thread Rich Shepard

On Tue, 12 Jan 2021, Grant Edwards wrote:


And those X11 users will swear at you if you override their window
managers configured window placement. Application code should not care
about or try to control window geometry. Period.


Grant,

Since this application is my own business use those users can swear all they
want. :-) If I decide to post all the code on github other can modify it to
their heart's delight. They can even make it work on their wrist computer
(formerly known as a wrist watch.)

Regards,

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


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

2021-01-13 Thread Rich Shepard

On Thu, 14 Jan 2021, dn via Python-list wrote:


Concerning the definition of "old"
- when I'm having a 'good day', it's anyone several years my senior (and
above)
- when I'm creaking and groaning, it's anyone remotely my age, and older.


About 45 years ago a 25-year-older friend of mine offered a great philosophy
of life. "We can do nothing about growing older," she told me, "but we can
do everything about growing old."

How true.

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


Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard

I want to replace the menu on my application with the more appropriate
notebook. After looking at examples in my reference books and on the Web I
still cannot get it working properly.

Here's a small example (nbtest.py):
---8< ---
#!/usr/bin/env python3

import tkinter as tk
from tkinter import ttk
from tkinter.ttk import Notebook as n

class Test(tk.Tk):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# notebook
n = ttk.Notebook(self)

self.tab1 = ttk.Frame(n) # activities
self.tab2 = ttk.Frame(n) # people
self.tab3 = ttk.Frame(n) # locations
self.tab4 = ttk.Frame(n) # organizations
self.tab5 = ttk.Frame(n) # reports
self.tab6 = ttk.Frame(n) # lookup tables

self.add(tab1, text='Activities')
self.add(tab2, text='People')
self.add(tab3, text='Locations')
self.add(tab4, text='Organizations')
self.add(tab5, text='Reports')
self.add(tab6, text='Lookups')

n.pack(expand = 1, fill ="both")

if __name__ == "__main__":
app = Test()
app.mainloop()
>8 -

python-3.9.1 returns:
$ ./nbtest.py 
Traceback (most recent call last):

  File "/home/rshepard/development/business_tracker/./nbtest.py", line 32, in 

app = Test()
  File "/home/rshepard/development/business_tracker/./nbtest.py", line 22, in 
__init__
self.add(tab1, text='Activities')
  File "/usr/lib64/python3.9/tkinter/__init__.py", line 2346, in __getattr__
return getattr(self.tk, attr)
AttributeError: '_tkinter.tkapp' object has no attribute 'add'

Explanation of the error and suggestions for ttk.notebook references are
needed.

TIA,

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


Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard

On Fri, 15 Jan 2021, MRAB wrote:

You should be adding the frames to the notebook. Also, the tabs are 
'self.tab1', not 'tab1', etc:

n.add(self.tab1, text='Activities')
Similarly for the others.


Thanks. MRAB. This allows me to move on and put pre-built widget pages on
the tabs.

Regards,

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


Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard

On Fri, 15 Jan 2021, Dennis Lee Bieber wrote:


Off-hand, I'd suspect you should be adding these to the NOTEBOOK
object "n".


Dennis,

You're correct. The MWE didn't have the proper syntax.

Now, the problem is the notebook doesn't display its tabs on the main
window, while the proper syntax on a separate file opens a window with the
tabs displayed.

The file 'application.py' is attached. If I had better docs here I could
probably work a lot of this out by myself.

Regards,

Rich
#!/usr/bin/env python3

# main file to start application.

from os import environ
import sys
from datetime import datetime
import tkinter as tk
from tkinter import ttk
from tkinter.ttk import Notebook as nb
from tkinter import filedialog
from tkinter import messagebox
from tkinter.font import nametofont
from functools import partial
import model as m
import views as v
import controller as c


class Application(tk.Tk):
""" Application root window """

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# the top level frame holding notebook, status bar, etc.
self.columnconfigure(0, weight=1)   # helps with frame/app resizing on 
the fly
self.rowconfigure(0, weight=1)  # helps with frame/app resizing on 
the fly
# open application centered on screen; set window width and height
self.appwidth = 1000
self.appheight = 800
# get screen width and height
self.scrwidth = self.winfo_screenwidth()
self.scrheight = self.winfo_screenheight()
# formula to find screen center
self.xLeft = (self.scrwidth/2) - (self.appwidth/2)
self.yTop = (self.scrheight/2) - (self.appheight/2)
# set geometry
self.geometry(str(self.appwidth) + "x" + str(self.appheight) +
  "+" + str(int(self.xLeft)) + "+" + str(int(self.yTop)))

self.title("Main Window Title Goes Here")
self.resizable(width=True, height=True)

datestring = datetime.today().strftime("%Y-%m-%d")

# variables for adjusting font size and style
self.font_bold = tk.BooleanVar()
self.font_size = tk.IntVar()

def set_font(*args):
self.font_spec = 'TkDefaultFont {size} {bold}'.format(
size=font_size.get(),
bold='bold' if font_bold.get() else '')
self.label.config(font=font_spec)
self.font_bold.trace('w', set_font)
self.font_size.trace('w', set_font)

# status bar
self.status = tk.StringVar()
self.statusbar = ttk.Label(self, textvariable=self.status)
self.statusbar.grid(sticky="we", row=3, padx=10)

# notebook
nb = ttk.Notebook(self)

self.tab1 = ttk.Frame(nb) # activities
self.tab2 = ttk.Frame(nb) # people
self.tab3 = ttk.Frame(nb) # locations
self.tab4 = ttk.Frame(nb) # organizations
self.tab5 = ttk.Frame(nb) # reports
self.tab6 = ttk.Frame(nb) # lookup tables

nb.add(self.tab1, text='Activities')
nb.add(self.tab2, text='People')
nb.add(self.tab3, text='Locations')
nb.add(self.tab4, text='Organizationbs')
nb.add(self.tab5, text='Reports')
nb.add(self.tab6, text='Lookups')


if __name__ == "__main__":
app = Application()
app.mainloop()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard

On Fri, 15 Jan 2021, Rich Shepard wrote:


The file 'application.py' is attached. If I had better docs here I could
probably work a lot of this out by myself.


Progress: I didn't put the notebook on the main window using grid. Now I
need to find how to specify the position so it's at the top of the window.
I'll read the options on grid.

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


Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard

On Fri, 15 Jan 2021, Rich Shepard wrote:


Progress: I didn't put the notebook on the main window using grid. Now I
need to find how to specify the position so it's at the top of the window.
I'll read the options on grid.


The notebook tabs are placed on the grid as nb.grid(row=0, column=0,
columnspan=6). But, it's in the center of the main frame and small.

All the references I've found in Tkinter books and on the web have small,
stand-alone, samples of notebooks. Is
<https://www.tcl.tk/man/tcl8.5/TkCmd/ttk_notebook.htm> the best and most
complete reference for learning how to apply a ttk.Notebook?

Regards,

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


Re: Writing a Python3 ttk.Notebook

2021-01-15 Thread Rich Shepard

On Fri, 15 Jan 2021, Terry Reedy wrote:


IDLE's settings dialog uses a ttk.Notebook. The file is
Lib/idlelib/configdialog.py.


Thanks, Terry! I completely forgot that. I'll study the IDLE's code and
learn from that.

Stay well,

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


Re: editor recommendations?

2021-02-26 Thread Rich Shepard

On Fri, 26 Feb 2021, [email protected] wrote:


That's what my emacs looks like, minus the light-grey frame (the window
manager's frame and border are enough for me). Emacs has themes now, but
my setup is very old; all I did was set the "base" text background and
foreground colors and set a flag that says "I have a dark background
rather than a light one."


Emacs: +1. I've been using it for more than two decades. It will provide
syntax coloring (on the black background) for Python as well as other
languages and file types.


Did you have a Python question?  ;-)


Perhaps he didn't but he should know that by opening a shell within emacs he
can run his python code there.

Long ago someone wrote that Emacs is an operating system that includes the
kitchen sink. A friend of mine working for Sharp Electronics did all his
work in Emacs, including email and web browsing (back when a text-based
browser was sufficient.)

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


Comparing text strings

2021-04-12 Thread Rich Shepard

I'm running Slackware64-14.2 and keep a list of installed packages. When a
package is upgraded I want to remove the earlier version, and I've not
before written a script like this. Could there be a module or tool that
already exists to do this? If not, which string function would be best
suited to the task?

Here's an example:
atftp-0.7.2-x86_64-2_SBo.tgz
atftp-0.7.4-x86_64-1_SBo.tgz

and there are others like this. I want the python3 script to remove the
first one. Tools like like 'find' or 'sort -u' won't work because while the
file name is the same the version or build numbers differ.

All suggestions welcome.

Rich

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


Re: Comparing text strings

2021-04-12 Thread Rich Shepard

On Tue, 13 Apr 2021, Cameron Simpson wrote:


I do not know if there are preexisting modules/tools for this, but I
recommend looking at slackware's package management tool - they usually
have some kind of 'clean" operation to purge "old" package install files.
Sometimes that purges all the install files, not just the obsolete ones,
so take care.


Cameron,

slackpkg clean removes all non-core distribution files. That's how I FUBAR'd
my system a couple of months ago.


If you're writing a script, what you want to do is read the names and
extract the version information from them, and also the "package name" -
the bit which identifies the package and does not change with an upgrade.


Yes, that's the approach I would take.


I would then make a dict mapping package names to a list of versions
and/or the full "...tgz" names above. (Actually, use a
defaultdict(list), it will avoid a lot of tedious mucking about.)


Okay. That didn't occur to me.


Alternatively, and now that I think about it, more simply: _if_ the
package files can be sorted by version, then all you need to do is read a
sorted listing and note that latest fil for a particular package. If you
need another one, it should be newer and you can remove the "known"
package file, and update your record that to the new one.


The problem is not that simple. Sometimes the package maintainer upgrades
the package for the same version number so there could be abc-1.0_1_SBo.tgz
and abc-1.0_2_SBo.tgz. The more involved route will be taken.

Thanks!

Rich


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


Re: Comparing text strings

2021-04-13 Thread Rich Shepard

On Tue, 13 Apr 2021, Cameron Simpson wrote:


The problem is not that simple. Sometimes the package maintainer upgrades
the package for the same version number so there could be abc-1.0_1_SBo.tgz
and abc-1.0_2_SBo.tgz. The more involved route will be taken.


If that _1, _2 thing is like RedHat's -1, -2 suffixes for later releases
of the same source package version, you could just include that in the
version string. Looks like it counts up.


Cameron,

There are two variables: the application/tool version number and the build
number. They're both embedded within the filename string. I don't know in
advance the build numbers if it's that variable that's changed.

The list of installed files is (currently) less than 500 lines so a
character-by-character comparison when two rows begin with the same string
will not take long.

Thanks again,

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


Re: Comparing text strings

2021-04-13 Thread Rich Shepard

On Tue, 13 Apr 2021, jak wrote:


If I understand your problem correctly, the problem would be dealing with
numbers as such in file names. This is just a track but it might help you.
This example splits filenames into strings and numbers into tuples,
appends the tuple into a list, and then sorts the list:


jak,

Yes, it would be the version and build numbers that differ when two files
have the same initial string (application name).

Thanks very much,

Rich


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


UI design: combobox or radiobuttons?

2021-04-13 Thread Rich Shepard

My applications use environmental data, each of which has to specify the
units (e.g., cm, m, km, ft, yd, mi). With the widget sets I've used
(wxPython and TKinter) I've always used a combobox with the acceptable
choices in it. I'm now planning a new application using PyQt5 and it occured
to me that a set of radio buttons would also work.

While a set of radiobuttons occupies more room on the parent widget than
does a combobox are there any technical or user issues that would suggest
using one over the other?

TIA,

Rich

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


Re: UI design: combobox or radiobuttons?

2021-04-13 Thread Rich Shepard

On Wed, 14 Apr 2021, Alan Gauld via Python-list wrote:


readability? If the combo box puts the units immediately beside the value
then it will be more readable than if it is a row of radio buttons
above/below or beside the value.

But if the radio buttons represent a unit choice that applies to all
values on the screen then that is more noticeable and thus more readable
than a single small combobox choice lurking in a corner somewhere.


Excellent points, Alan.

Thanks very much,

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


Re: Ann: New Python curses book

2021-04-14 Thread Rich Shepard

On Wed, 14 Apr 2021, Alan Gauld via Python-list wrote:


The paper version should be fine (apart from one error on p44 which has
now been fixed!).


Alan,

What's the error and correction so I can change it in my dead tree version?

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


Re: Ann: New Python curses book

2021-04-15 Thread Rich Shepard

On Thu, 15 Apr 2021, Alan Gauld via Python-list wrote:


In the main() function the block of code starting with the 'with'
statement should be indented to be part of main(). It has been left at the
outermost indentation level.

The source code file is correct so check against that.


Thanks, Alan.

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


Ad-hoc SQL query builder for Python3?

2021-04-24 Thread Rich Shepard

My web searches are not finding what I need to include in an application I'm
building: an ad-hoc sql query builder.

End users will want to query their data for reports not included in the
built-in queries. My searches find a windows-only tool that apparently costs
developers for the version to include in their applications. I'm looking for
a F/OSS tool and I'm sure these are available somewhere.

Suggestions are needed.

TIA,

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


Re: Ad-hoc SQL query builder for Python3?

2021-04-24 Thread Rich Shepard

On Sat, 24 Apr 2021, J. Pic wrote:


Maybe search or ask dba stackexchange for more, meanwhile, here's a
popular one: https://github.com/dbeaver/dbeaver


J.,

I use dbeaver-ce now and then as an admin tool. I didn't consider it as an
included component in a desktop application. I'll look at it from that
perspective.

Thanks,

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


Re: Ad-hoc SQL query builder for Python3?

2021-04-25 Thread Rich Shepard

On Sun, 25 Apr 2021, Alan Gauld via Python-list wrote:


I assume you understand the huge risks involved in such a tool. Letting
users loose on their own data (and possibly other peoples) allows for huge
potential damage/data loss etc.


Alan,

I disagree about the risk. Regardless of the form of the Select statement it
does not delete any rows. Users will be able to specify attributes (columns)
and instances (rows) but not delete or update any table.


You can reduce the risk by finding ways to limit the access to read-only
and tightly controlling which tables etc can be accessed.



But many SQL builder tools don't do that and simply provide a way to
create queries, including drop table, delete from etc. (Quite reasonably
since they are usually aimed at DBAs rather than ordinary users)


That's if the inclusion of the tool allows it.

Of course, if the user knows SQL they could do what they want directly on
the database ignoring the application entirely. If they knew enough to do
this they would be using a database rather than a spreadsheet in the first
place. :-)

Regards,

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


Re: Ad-hoc SQL query builder for Python3?

2021-04-25 Thread Rich Shepard

On Sun, 25 Apr 2021, Peter J. Holzer wrote:


What should that sql query builder build the queries from? Or in other
words what is the user supposed to input?


Peter,


From the dialog box offering tables, columns, and rows from which a SELECT

statement will be constructed.

This is not a console application with a CLI; it has a GUI so there's no
direct access to the backend db from within the application.

Regards,

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


Re: Ad-hoc SQL query builder for Python3?

2021-04-26 Thread Rich Shepard

On Sat, 24 Apr 2021, Rich Shepard wrote:


My web searches are not finding what I need to include in an application I'm
building: an ad-hoc sql query builder.


For those interested I've found a couple of possibilities: PyPika and
SQLbuilder. I'll be looking deeply into them to learn their capabilities.

My model is the query-by-example (QBE) used in Paradox for DOS in the 1980s
and 1990s.

Thanks for all your comments,

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


Re: Ad-hoc SQL query builder for Python3?

2021-04-27 Thread Rich Shepard

On Mon, 27 Apr 2021, Robert Latest via Python-list wrote:


In case nobody mentioned it before, don't forget to take a look at
SQLAlchemy. The object-relational-mapper (ORM) creates a 1:1 mapping of
Python objects to SQL table rows.


Robert,

Yes, I've known of SA for years. I want something that can be embedded in
the application so the user doesn't need to install another dependentcy
package and maintain it.

Regards,

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


Applying winpdb_reborn

2021-05-28 Thread Rich Shepard

I'm trying to debug a module of a PyQt5 application using winpdb_reborn.
When I invoke the debugger with the module's name I get an empty winpdb
window and the console tells me that it cannot find RPDBTERM. The full
traceback is attached.

Here, rpdb2 is available:
$ locate rpdb2.py
/usr/lib64/python3.7/site-packages/rpdb2.py
/opt/winpdb-master/build/lib/rpdb2.py
/opt/winpdb-master/rpdb2.py

My only reference to winpdb_reborn is "Norm Matloff's Introduction to the
Winpdb Python Debugging Tool (not just for Windows!)" and the text does not
contain anything about RPDBTERM.

I need advice on debuggng this module (when run only an empty window is
displayed) and using winpdb_reborn.

TIA,

Rich
$ winpdb activitytype.py 
08:20:06.052 rpdb2.py:6148 MainThread/140081468266240 __setrecursionlimit(): rl 
= 1000
08:20:06.348 winpdb.py:3006 MainThread/140081468266240 set_font(): Using font 
"Monospace" for Console
08:20:06.350 winpdb.py:3006 MainThread/140081468266240 set_font(): Using font 
"Monospace" for Console

(winpdb:5519): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: 
assertion 'height >= 0' failed

(winpdb:5519): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate 
widget with width 13 and height -22

(winpdb:5519): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: 
assertion 'height >= 0' failed

(winpdb:5519): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate 
widget with width 13 and height -22

(winpdb:5519): Gtk-CRITICAL **: gtk_widget_get_preferred_width_for_height: 
assertion 'height >= 0' failed

(winpdb:5519): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate 
widget with width 13 and height -22
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/winpdb.py", line 1288, in __wrapper
self.m_f(*args, **kwargs)
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 197, 
in launch
return self.__smi.launch(fchdir, command_line, interpreter, 
fload_breakpoints)
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 1160, 
in launch
self._spawn_server(fchdir, ExpandedFilename, args, rid, interpreter)
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 1269, 
in _spawn_server
terminal_command = CalcTerminalCommand()
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 2385, 
in CalcTerminalCommand
if RPDBTERM in os.environ:
NameError: name 'RPDBTERM' is not defined
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/winpdb.py", line 1288, in __wrapper
self.m_f(*args, **kwargs)
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 197, 
in launch
return self.__smi.launch(fchdir, command_line, interpreter, 
fload_breakpoints)
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 1160, 
in launch
self._spawn_server(fchdir, ExpandedFilename, args, rid, interpreter)
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 1269, 
in _spawn_server
terminal_command = CalcTerminalCommand()
  File "/usr/lib64/python3.7/site-packages/rpdb/session_manager.py", line 2385, 
in CalcTerminalCommand
if RPDBTERM in os.environ:
NameError: name 'RPDBTERM' is not defined
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Applying winpdb_reborn

2021-05-28 Thread Rich Shepard

On Fri, 28 May 2021, Schachner, Joseph wrote:


I have no familiarity with this issue, but I think one thing to check is
whether all capitalized RPDBTERM is truly the name you are looking for,
remember that Python is case sensitive.


Joseph,

According to the only doc I could find,
"RPDB2 startup:
Say you have a script x.py to debug, with command-lin
arguments arg0, arg1 etc. Then to start RPDB2, type
python rpdb2.py x.py arg0 arg1 ..."

I don't know of any linux utility whose name is in all uppercase letters.

Thanks,

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


Re: Applying winpdb_reborn

2021-05-28 Thread Rich Shepard

On Fri, 28 May 2021, MRAB wrote:


Have you looked at the package's repository?


MRAB,


It looks like this is the one:
https://github.com/bluebird75/winpdb


That's where I got it.

Thanks,

Rich

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


Re: Applying winpdb_reborn

2021-05-28 Thread Rich Shepard

On Fri, 28 May 2021, Dennis Lee Bieber wrote:


It's apparently looking for some environment variable based upon the
code at
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjfpYmk3-zwAhULI6wKHSPjAFIQFnoECAUQAA&url=http%3A%2F%2Fphault.rhul.ac.uk%2Fpy%2F_spe%2Fplugins%2Fwinpdb%2Frpdb2.py&usg=AOvVaw12BuzlEMVXrEuOFLoQLpFX


Thanks, Dennis. It looked like an environment variable but I hadn't seen
that with the python2 winpdb.

I'll add that to ~/.bash_profile and see what happens.

Enjoy the holiday weekend,

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


Re: Applying winpdb_reborn

2021-05-29 Thread Rich Shepard

On Sat, 29 May 2021, Dennis Lee Bieber wrote:


Except the copy of winpdb source I looked at has

RPDBTERM = 'RPDBTERM'

near the top.

Then again, I don't know how up-to-date the OP's copy is -- I just
Googled for a repository with the module.

Let me check a Linux environment (Debian 10 VM) (Great -- I attempted
to use the default password of a Beaglebone Black )


I've removed winpdb here as recommended by Philippe Fremy. I don't use IDEs
other than emacs so I'll stick with pdb.

What I find interesting is that every web page I find on 'using pdb' does no
more than explain the available commands; they don't explain the debugging
process. That's like showing someone what the word processor menus do; it
doesn't teach the user how to be a writer.

I knew the debugging process with Fortran and C, but haven't learned how to
effectively use pdb to find bugs that don't issue a traceback or obvious
wrong answer such as my module displaying an empty window with no widgets.

Rich

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


Re: Applying winpdb_reborn

2021-05-29 Thread Rich Shepard

On Sun, 30 May 2021, Cameron Simpson wrote:


Also, searching for "pdb tutorial" seems to find a bunch of links.


Cameron,

That's true. All the ones I've read list the various pdb commands. Knowing
the commands is different from knowing when and how to apply them.

I'll work back to remembering how I debugged code years ago with stubs and
print() statements and use pdb with them.

Thanks,

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


Re: Applying winpdb_reborn

2021-05-29 Thread Rich Shepard

On Sun, 30 May 2021, Chris Angelico wrote:


(Plus, there's not always an opportunity to use a debug harness. Sometimes
you just have to put your prints into production and let it run for two
weeks in the hope that the bug will show itself.)


ChrisA,

Please excuse my long-winded description of a FORTRAN IV bug in an lake
ecosystem energy model I wrote at the University of Illinois in the early
1970s. It is an example of what you wrote above.

The program fill two boxes of 80-column Hollerith cards punched on an IBM
29 (if I correctly recall the model) keypuch machine. The output was written
on green-barred wide paper on a line printer.

Each time I ran the model it would produce one of four different, but wrong,
answers for one variable. I closely examined the 1.5" thick fan-folded line
printer output many times. I never saw the error, even with diagnostic stubs
added. When I took the output to the computer center they looked at it for a
week and couldn't find the error, either.

Shortly after that, when I again examined the code, line-by-line, I saw the
error: a line that should have read
FOR I=1 to N
actually read
FOR I=I to N

All of us saw the uppercase I as a 1 because a) that's what we expected to
see and b) line printer output on green-barred paper was not that clear,
even with fresh ribbons.

That lesson has stuck with me ever since.

Regards,

Rich

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


Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Sun, 30 May 2021, Cameron Simpson wrote:


I've only just started with pdb. As of Python 3.7 there's a builtin
function named breakpoint() which drops you into the debugger. I've never
been a big debugger person, historicly using print() and equivalent.
However, this makes it very easy to insert this call into a piece of code
instead of having to invoke one's programme in a special way.


I'm stuck with neither approach (pdb, print()) working. I moved the database
code to a separate module, datasource.py, and when I run the
activitytypes.py module (using pdb and having entered print() statements at
various places in both the datasource and activities modules all I get is a
small, empty window with the window title. The QSize() statement is never
reached.

The activitytypes.py module:

import sys
from PyQt5 import QtWidgets as qtw
from PyQt5 import QtGui as qtg
from PyQt5 import QtCore as qtc
from PyQt5 import QtSql as qts

from datasource import db

class ATMainWindow(qtw.QMainWindow):

def __init__(self):
super().__init__()

# Model/View here.
self.model = qts.QSqlTableModel(db=db) # for single table
self.model.setTable('activitytypes')
self.model.select()

self.table = qtw.QTableView()
self.table.setModel(self.model)

self.setFixedSize(qtc.QSize(800, 600))
self.setCentralWidget(self.table)


if __name__ == '__main__':
app = qtw.QApplication(sys.argv)
window = ATMainWindow()
window.show()
#sys.exit(app.exec())
app.exec_()

Running the module in pdb and using 'next' to step through it produces this
result:


$/development/business_tracker/activitytypes.py(29)()

-> window = ATMainWindow()
(Pdb) n
False

$/development/business_tracker/activitytypes.py(30)()

-> window.show()
(Pdb) n

$/development/business_tracker/activitytypes.py(32)()

-> app.exec_()
(Pdb) n
n

$/development/business_tracker/activitytypes.py(32)()->None

-> app.exec_()
(Pdb) n

and there it sits. No (Pdb) prompt, nothing. And no printed statements.

I'd appreciate recommendations on the process to find where the bug lives
since I can't seem to find it with print() or line-by-line in pdb.

TIA,

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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Rich Shepard wrote:


The QSize() statement is never reached.


Correction: the window is 800 x 600, but it's still empty.

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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Ethan Furman wrote:


Sounds like a console issue. Try using `logging` with a file... you could
even use `print` with a file if you wanted to.


Ethan,

Not before using logging I found a reference/example page
<https://devopslearning.medium.com/debugging-python-code-logging-pdb-a8ca08a6475e>
and modified the module to this:

# activitytypes.py
import sys
import logging

from PyQt5 import QtWidgets as qtw
from PyQt5 import QtGui as qtg
from PyQt5 import QtCore as qtc
from PyQt5 import QtSql as qts

from datasource import db

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s -%(levelname)s - 
%(message)s')
logging.debug("Start of Program")

class ATMainWindow(qtw.QMainWindow):

def __init__(self):
super().__init__()

# Model/View here.
self.model = qts.QSqlTableModel(db=db) # for single table
self.model.setTable('activitytypes')
self.model.select()

self.table = qtw.QTableView()
self.table.setModel(self.model)

self.setMinimumSize(qtc.QSize(800, 600))
self.setCentralWidget(self.table)


if __name__ == '__main__':
app = qtw.QApplication(sys.argv)
window = ATMainWindow()
window.show()
#sys.exit(app.exec())
app.exec_()

logging.debug("End of Program")

When I run it this is the output:
$ python activitytypes.py 
2021-06-01 13:39:10,219 -DEBUG - Start of Program

2021-06-01 13:39:15,229 -DEBUG - End of Program

Obviously I have much to learn about using python's logging capabilities.
I'll keep looking.

Thanks,

Rich




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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Ethan Furman wrote:


Well, you only had two logging statements in that code -- logging is like
print: if you want to see it, you have to call it:


Ethan,

Got it, thanks.

I believe my problem is with the datasource module. I'm focused on making it
work (using logging to confirm that it is doing so). Will report results
when they're available.

Regards,

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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Dennis Lee Bieber wrote:


I suspect you really should be stepping INTO the calls, not just
invoking the functions completely and going to the next LOCAL statement.



$ /development/business_tracker/activitytypes.py(1)()

-> import sys
(Pdb) s

$ /development/business_tracker/activitytypes.py(2)()

-> import logging
(Pdb) s
--Call--

(978)_find_and_load()

(Pdb) s

Now I'll go learn what this means.

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


Re: Neither pdb or print() displays the bug

2021-06-02 Thread Rich Shepard

On Wed, 2 Jun 2021, Peter Otten wrote:


Do you have unit tests? Those are an excellent tool to ensure that the
components of an application work as expected and that those components
have well-defined interfaces. Debugging a failing unittest is usually
easier than to debug a complex application. While I don't know if there is
a convenient way to test the GUI everything else should run reliably
*before* connecting it with the GUI.


Peter,

I believe there is a way to apply unit tests to PyQt and I'll certainly
learn to take this testing-while-developing approach.

Thanks,

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


Posting code on stackoverflow

2021-06-05 Thread Rich Shepard

I tried to post a question on stackoverflow.com which included a bunch of
code (entered after clicking the box 'code'). I noticed that lines were
wrapped but could not find how to expand the input box so they would not
wrap.

SO wouldn't let me post the question because of the wrapped code. As I've
not asked a question ther for a long time, and it didn't involve long lines
of code, I need to learn a) how to enter code if it's not just clicking on
the 'code' box before pasting text and b) how to keep code lines from
wrapping so a horizontal scroll bar is made available.

TIA,

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


Re: Posting code on stackoverflow

2021-06-05 Thread Rich Shepard

On Sun, 6 Jun 2021, Roel Schroeven wrote:


There are several ways to format code on StackOverflow, see
https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks


Roel,

Thanks very much for the URL.


What I do most of the time is indent the code by 4 spaces and make sure
there are blank lines before and after the code block.


Just now I noticed a link 'code' along the top of the window. Clicking on
that I read that a code block can be identified as such by surrounding it
with sets of three backticks (```). That worked.

Regards,

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


Re: Posting code on stackoverflow

2021-06-06 Thread Rich Shepard

On Sun, 6 Jun 2021, joseph pareti wrote:


you need to put the code between 2 lines defined as follows:
```
then it will be formatted for you


Thanks, Joseph. I figured that out on the web page.

Regards,

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


Re: Neither pdb or print() displays the bug

2021-06-06 Thread Rich Shepard

On Sun, 6 Jun 2021, Fabio Zadrozny wrote:


Hint: you should be able to use https://pypi.org/project/pytest-qt/ to
unit-test a PyQt application...


Fabio,

Thank you for confirming this. I hadn't remembered the name so your URL is
really helpful.

Regards,

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


Re: Posting code on stackoverflow

2021-06-06 Thread Rich Shepard

On Sat, 5 Jun 2021, Terry Reedy wrote:


Last time I tried *before*, it did not work. paste, reselect (a nuisance)
and click does.


Terry,

I had tried that and it didn't work any better. Bounding the code with two
sets of three backticks does work.

Regards,

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


Re: Neither pdb or print() displays the bug [FIXED]

2021-06-08 Thread Rich Shepard

On Tue, 1 Jun 2021, Rich Shepard wrote:


I'm stuck with neither approach (pdb, print()) working. I moved the
database code to a separate module, datasource.py, and when I run the
activitytypes.py module (using pdb and having entered print() statements
at various places in both the datasource and activities modules all I get
is a small, empty window with the window title. The QSize() statement is
never reached.


Found and fixed the problem. Qt5 added support for PostgreSQL-12 in
Qt5-5.15.0. I upgraded both Qt5 and PyQt5 to 5.15.2 and now the tables
display the rows in the one column of the table.

Thanks for all the suggestions,

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


Re: Recommendation for drawing graphs and creating tables, saving as PDF

2021-06-11 Thread Rich Shepard

On Fri, 11 Jun 2021, Jan Erik Moström wrote:


I looked around around but could only find two types of libraries for a)
libraries for creating histograms, bar charts, etc, b) very basic drawing
tools that requires me to figure out the layout etc. I would prefer a
library that would allow me to state "connect A to B", "connect C to B",
"connect B to D", and the library would do the whole layout.


JEM,

PSTricks 


(and yes, I could obviously use LaTeX ...)


They work well together.

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


Tkinter8.6: date picker

2021-06-11 Thread Rich Shepard

I need a date picker for a couple of Python-3.7.2/Tkinter8.6 applications. 
There seem
to be some available on the web. If you have experience with a date picker
(not a calendar that holds appointments for a given date) I'd like your
suggestions and recommendations for one.

TIA,

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


Re: Tkinter8.6: date picker

2021-06-11 Thread Rich Shepard

On Fri, 11 Jun 2021, Dan Stromberg wrote:


I think most Python folks are doing their GUI's with a web browser, Qt, or
GTK+. I mostly use GTK+. But best wishes on getting a recommendation for a
Tkinter date picker.


Dan,

I don't like working in a web browser; Qt apparently has very weak support
for multiple-table databases where joins involve several tables, and I've
never used GTK+ for UI.

One of the applications I'm developing will be for my clients to use. Most
of them run some flavor of Windows so I want to keep the software
requirements simple: Python3 and SQLite3.

Regards,

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


tkinter: tksheet

2021-06-16 Thread Rich Shepard

Reading the doc for tksheet tells me that it allows me to modify cells (or
entire rows) as well as display them. What I don't see is whether I can add
a new row using tksheet and change the column used for sorting (e.g.,
sorting by company number or company name).

If you have experience with tksheet perhaps you can answer my questions
about it's capabilities.

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


Re: tkinter: tksheet

2021-06-16 Thread Rich Shepard

On Wed, 16 Jun 2021, Terry Reedy wrote:


Somewhat sparse doc at
https://github.com/ragardner/tksheet/blob/master/DOCUMENTATION.md#5-modifying-table-data
insert_row()


Terry,

I'm reading this now and saw that.


and change the column used for sorting (e.g.,

sorting by company number or company name).


I did not see anything about sorting.  tksheet is generic 'table', not a 
database viewer


The two applications I'm building are both database applications. If
tksheet() is not the most appropriate widget to display database tables what
alternative would be better?

Thanks,

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


Re: tkinter: tksheet

2021-06-16 Thread Rich Shepard

On Wed, 16 Jun 2021, Dennis Lee Bieber wrote:


Scroll further down to "bindings"... rc_insert_row -- a 
menu binding


Dennis,

Yes, I saw that one, too.


As for sorting, I don't see anything that allows one to add custom
events to the bindings... best I can come up with is that if a header
column is selected you sort the data and reload the table.


My naive idea is to use two queries, one selects * from the company table
ordered by nunber, the other by name. The UI offers two radiobuttons when
viewing the results, one for each sort column.

Thanks,

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


Re: tkinter: tksheet

2021-06-16 Thread Rich Shepard

On Thu, 17 Jun 2021, dn via Python-list wrote:


Use the DBMS by retrieving the data in the desired sequence?


dn,

Yep. That's what I thought would be the best approach.

Thanks,

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


Re: tkinter: tksheet

2021-06-16 Thread Rich Shepard

On Wed, 16 Jun 2021, Alan Gauld via Python-list wrote:


But there is nothing I know of for Tkinter that provides views of database
tables in the way that Delphi or VB or C# do, for example.


Alan,

These are all Microsoft tools. I run linux only.


You have to extract the data using SQL and populate the table and manage
all changes (of both view and data) yourself.



From an incomplete reading of the tksheet() doc it looks to be the best way

to display tables returned by a SQL query. PyQt5 has a QTableView() that
does the job, and it works great for a single table, but apparently not so
well with complex joins on multiple tables.

When I view my contacts table it needs to includes attributes from the
company, people, and contacts tables so I can view all prior contacts with
that person.


If you do a lot of that kind of desktop apps then you could look at Dabo
which is built on wxPython but has links to databases. Unfortunately it
looks like work ground to a halt about 5 years ago.


Many years ago I used wxPython. For several reasons I decided to learn and
use tkinter from now one. One reason is that the application for my clients
will run mostly on windows hosts and I want to limit the software they need
to install and maintain in order to run it.

Regards,

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


Re: tkinter: tksheet

2021-06-17 Thread Rich Shepard

On Thu, 17 Jun 2021, Dennis Lee Bieber wrote:


My naive idea is to use two queries, one selects * from the company table
ordered by nunber, the other by name. The UI offers two radiobuttons when
viewing the results, one for each sort column.


Presuming all the data fits in memory, it may be faster to just define
the key structure for Python's internal sort() function than to go back out
to the database server, wait for it to gather the desired fields and sort
them, then transfer all the data back to your script.


Dennis,

That's a possibility.

Thanks,

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


Re: tkinter: tksheet

2021-06-17 Thread Rich Shepard

On Thu, 17 Jun 2021, Alan Gauld via Python-list wrote:


Sounds like a job for a database view. Can you modify the database schema?
Could you create a view - even a temporary one just while your app is
running?


Alan,

Yes, created views work well with postgres. Building one for complex,
multitable queries is always a good idea.

Thanks,

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


Re: tkinter: tksheet

2021-06-17 Thread Rich Shepard

On Thu, 17 Jun 2021, Dennis Lee Bieber wrote:


FreePascal/Lazarus is supposed to be similar to Delphi, and does
have Linux installs -- but I don't know what it provides for database
linkages. I do have it installed on my Windows box (the Linux install is
HUGE; takes up over 1/4 of the space on BeagleBone Black so I didn't
install it there).


Dennis,

In the 1980s I looked closely at Pascal. More recently I did so again
because the local linux/UNIX group had a presentation on its use. Decided
another language was not for me.

Thanks,

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


Faker package

2021-06-18 Thread Rich Shepard

I'm trying to use the faker package to generate data to load in a sample
postgres database so I can learn how to use tksheet and psycopg2.

The 8.8.1 documentation shows output on a root shell prompt (#), not a
python prompt (>>>). It also has a description of using faker from 'the
command line', which I assume is the python shell, and I can't get it to
work. I suppose that I can generate one name, address, etc. at a time and
them copy and concatenate them into table data, but I thought that the faker
package would do this all for me.

Is there a tool that will let me generate the equivalent of a database row
worth of data? That is, a set of strings of different types that can then be
inserted into the testing database?

Rich


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


Re: Faker package

2021-06-18 Thread Rich Shepard

On Fri, 18 Jun 2021, Terry Reedy wrote:


I would try using the 'given' function/decorator of hypothesis (on pypi)
to generate random data that conforms to whatever specification.


Thank you, Terry. I'll do that.

Regards,

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


Re: Faker package

2021-06-18 Thread Rich Shepard

On Sat, 19 Jun 2021, MRAB wrote:

When it says "command line" it means the operating system's command line. If 
it's the Python shell , it'll say "Python shell" or "Python prompt.


MRAB,

The root shell's (#) what I assumed. User shells (in bash, anyway) have $ as
the prompt.

Regardless,

$ faker -o temp.out faker.names()
-bash: syntax error near unexpected token `('
[rshepard@salmo ~]$ faker -o temp.out faker.names 
Traceback (most recent call last):

  File "/usr/bin/faker", line 8, in 
sys.exit(execute_from_command_line())
  File "/usr/lib64/python3.7/site-packages/faker/cli.py", line 264, in 
execute_from_command_line
command.execute()
  File "/usr/lib64/python3.7/site-packages/faker/cli.py", line 246, in execute
includes=arguments.include,
  File "/usr/lib64/python3.7/site-packages/faker/cli.py", line 67, in print_doc
provider_or_field], includes=includes)
  File "/usr/lib64/python3.7/site-packages/faker/proxy.py", line 63, in __init__
**config)
  File "/usr/lib64/python3.7/site-packages/faker/factory.py", line 56, in create
prov_cls, lang_found = cls._get_provider_class(prov_name, locale)
  File "/usr/lib64/python3.7/site-packages/faker/factory.py", line 68, in 
_get_provider_class
provider_class = cls._find_provider_class(provider, locale)
  File "/usr/lib64/python3.7/site-packages/faker/factory.py", line 90, in 
_find_provider_class
provider_module = import_module(provider_path)
  File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1006, in _gcd_import
  File "", line 983, in _find_and_load
  File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'faker.names'
[rshepard@salmo ~]$

It does not work from the bash command line as a user or as root.

The "root shell prompt (#)" suggests to  me that it's Linux, so if you're 
using Windows you'll need to use the equivalent for Windows.


I don't do windows; defenestrated 24 years ago.

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


Re: Faker package [RESOLVED]

2021-06-19 Thread Rich Shepard

On Sat, 19 Jun 2021, MRAB wrote:


It looks like you're mixing some Python usage ("faker.names()") in with
command line usage.


MRAB,

You are correct. That was my problem.


Judging from the docs, I'd say you need something more like:
   $ faker -o temp.out name
for 1 fake name or:
   $ faker -r=10 -o temp.out name
for 10 fake names.


Thank you. I didn't pick that up when I read the document.

Much appreciated,

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


Tkinter widgets for desktop database application

2021-07-13 Thread Rich Shepard

I'm writing a couple of database applications that use tkinter, and not a
web browser, for the UI and I'm still trying to determine the optimal way to
do this.

Individual tk and ttk widgets (LineEntry, Combobox, etc.) work for adding
and modifying individual database table rows but not for displaying multiple
rows returned by a SELECT statement. To view all rows returned by the SQL
statement would a pythonReport be used?

I'm working on learning to use tksheet as the sole widget because it can
display multiple rows from a database table as well as add new rows and
modify existing ones (one or more columns in each row).

What have other developers used for the UI on a stand-alone database
application not using a web browser? I've struggled with finding the most
efficient and optimal non-brower UI for months and would like to have a
solid path toward a working solution. I know too little to make this
decision and want advice, suggestions, and recommendations from experienced
developers.

TIA,

Rich

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


Re: Tkinter widgets for desktop database application

2021-07-14 Thread Rich Shepard

On Wed, 14 Jul 2021, Betty Hollinshead wrote:


So.I've had success with GTK3 (not Tkinter).


Betty,

There are multiple widget sets and all will work better with some
application types than others.

In the past I used wxPython but switched to Tkinter. Tried PyQt5 (doesn't do
complex, multi-table queries like it does single table queries) and
seriously considered GTK3. After all that time and effort I decided to stick
with tkinter for two reasons: 1) I know it better than PyQt5 and 2) most
users of one application I'm developing run Microsoft's OSes, some Apple.
Since Tkinter comes with Python3 it's one less thing for non-techical users
to struggle with if they decide to use this application.

Thanks for your suggestion,

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


Re: Unable to open Python

2022-03-28 Thread Rich Shepard

On Mon, 28 Mar 2022, kristine RABIA wrote:


I downloaded successfully Python, however when I am trying to open it,
brings the window repair, modify or uninstall, I tried to click on repair
and modify after all it came with the same window. Please advise the
further step.


Kristine,

What operating system do you use?

Python is a programming language, not an application. It is not 'opened' but
used to do a particular job. You use the language to tell the computer what
to do.

What do you want to do with Python?

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


Re: [OT] Security question

2016-12-22 Thread Rich Osman
Chris,

I compliment you on your succint and accurate summary of the issue.

Sounds like Frank's ISP is aspiring to be the next Yahoo...

On December 22, 2016 4:33:52 AM CST, Chris Angelico  wrote:
>On Thu, Dec 22, 2016 at 9:10 PM, Frank Millman 
>wrote:
>> What about the second part of my query? Is it acceptable that they
>keep
>> passwords on their system in clear text?
>
>Well no, absolutely not. I referred to "decrypting" the password,
>which is all you can actually be certain of here - they may well be
>storing the passwords in an encrypted form, but it can be decrypted.
>
>> From my first encounter with Unix over 30 years ago I was impressed
>with the
>> fact that no passwords are stored in clear text. Even with my own
>little
>> accounting system, I only store the SHA-1 hash of the password. I
>cannot
>> imagine why anyone would think that this is a good idea.
>
>From worst to best, here's some ways you can store passwords:
>
>1) Clear text. If anyone even just glances at your database, it's game
>over in one shot.
>2) Reversibly encrypted. If someone gets your database, s/he can
>decrypt the contents, but accidentally flashing a long string of
>nonsense won't instantly reveal everything.
>3) Encrypted with a key. To decode all the passwords, you would need
>additional information. That might come from the code, or from
>environment variables, or something, but you would need to attack
>something other than the database to completely decrypt people's
>passwords.
>4) Unsalted hashes. Instead of storing "password", you store
>"5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8". Can be broken with rainbow
>tables (or for common passwords, just Google the thing).
>5) Hashes salted with something predictable or calculable. Maybe you
>hash username+"blargh"+password, or something. Means the hashes don't
>look the same even for the same password.
>6) Hashes salted with arbitrary data that then gets stored alongside
>the password.
>
>Any of the first three could give the phenomenon you describe. And
>while the security is better on #3, it's still entirely vulnerable to
>the "disgruntled employee" attack (someone on the inside with complete
>information about the system).
>
>The last three all look similar in the database, but #4 is vulnerable
>to XKCD 1286 attacks, and even #5 has its vulnerabilities (for
>instance, setting your password to the same thing as it's previously
>been will set the hash to the same value). I would recommend the use
>of #6, but if someone's using #5, I wouldn't hate on them too hard -
>that's pretty secure.
>
>> The ISP is MWEB, one of the biggest service providers in South
>Africa, with
>> (I guess) millions of users.
>
>Thanks. MWEB, listen up: you are betraying your users' trust. A data
>breach could cost you dearly. Act *now*, before there is actually a
>breach, and go and hash all your passwords. And, of course, change
>your systems so you never need to send people their passwords.
>
>> If this is the standard of security out there, it is no wonder we
>hear of so
>> many attacks (and how many don't we hear of?)
>
>There are definitely a lot of nasty attacks out there, but these days,
>the most dangerous attacks are the social ones. It doesn't matter how
>good your password policy is if people will click on links in spam
>email and type their passwords into imitation login screens. It
>doesn't matter how well you salt your passwords if people write them
>down in insecure scribble pads. It makes no difference what you do on
>the back end if your users sign up for new services and use the same
>email address and password on them all. But here's the thing: social
>attacks are under the control of the individual user; database attacks
>are under the control of the central service. MWEB is responsible for
>what they do with their users' passwords, even if some of those users
>are vulnerable elsewhere.
>
>ChrisA
>-- 
>https://mail.python.org/mailman/listinfo/python-list

-- 
mailto:[email protected]
Oz
POB 93167 
Southlake, TX 76092 (Near DFW Airport
-- 
https://mail.python.org/mailman/listinfo/python-list


Understanding pdb result

2018-04-27 Thread Rich Shepard

  Running python3-3.6.5 and wxPython-4.0.1 on Slackware-14.2.

  The module begins this way:

#!/usr/bin/env python3

import sys, os
import pdb
import wx

  When pdb is invoked and I step through the code I get these results:

$ python3 -m pdb openEDMS.py

/home/rshepard/development/openEDMS/openEDMS.py(8)()

-> """
(Pdb) s

/home/rshepard/development/openEDMS/openEDMS.py(10)()

-> import sys, os
(Pdb) s

/home/rshepard/development/openEDMS/openEDMS.py(11)()

-> import pdb
(Pdb) 

/home/rshepard/development/openEDMS/openEDMS.py(12)()

-> import wx
(Pdb) --Call--

(966)_find_and_load()

(Pdb)

  My web search suggests that I need to import importlib, but doing so does
not change the results.

  Please pass me a pointer to a resource that teaches me how to avoid this
error.

TIA,

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


Re: Understanding pdb result

2018-04-28 Thread Rich Shepard

On Fri, 27 Apr 2018, Steven D'Aprano wrote:


What error are you referring to?


Steven,

  The menu does not display, only the frame and status bar.


Why are you using pdb in the first place?


  Because it is a debugger that allows me to process code line-by-line and
works with Python3.


If you're getting an error, the first thing to do is read the traceback.
If you're getting a traceback, tell us what it is. Don't paraphrase it,
copy and paste it.


  There is no traceback. Had there been I would have been able to find the
problem.


If you're not getting a traceback, please explain why you think you need
to use pdb and what error you think you are getting, because I have no
clue.


  See attached test.py.

Rich#!/usr/bin/env python3

import wx

#!/usr/bin/env python3

import sys, os, importlib
import pdb
import wx
import wx.grid
import sqlalchemy

class MainFrame(wx.Frame):
def __init__(self, parent, title='test'):
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title = title,
  size=wx.Size(800,600), style=wx.DEFAULT_FRAME_STYLE)

self.SetSizeHints(minSize=wx.Size(300,200), maxSize=wx.Size(900,700),
  incSize=wx.Size(50,50))

# Create status bar
self.CreateStatusBar()
self.SetStatusText("This is where you'll see helpful messages")

# Prepare the menu bar
menuBar = wx.MenuBar()

# 1st menu from left (File)
fileMenu = wx.Menu()
fileMenu.Append(wx.ID_NEW, '&New', 'Create new file')
fileMenu.Append(wx.ID_OPEN, '&Open', 'Open existing file')
fileMenu.Append(wx.ID_SAVE, '&Save', 'Save this file')
fileMenu.Append(wx.ID_SAVEAS, 'S&ave as ...', 'Save file with different 
name')
fileMenu.Append(105, '&Import', 'Import a file')
fileMenu.Append(106, '&Export', 'Export this file')
fileMenu.Append(wx.ID_CLOSE, '&Quit', 'Quit')
# Add menu to menu bar
menuBar.Append(fileMenu, '&File')


if __name__ == '__main__':
edms = wx.App()
top = MainFrame(None, 'test')
top.Show()
edms.MainLoop()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Understanding pdb result [RESOLVED]

2018-04-28 Thread Rich Shepard

On Sat, 28 Apr 2018, Rich Shepard wrote:


 The menu does not display, only the frame and status bar.


  Fixed the problem: I had neglected to attach the menu bar to the frame.

Mea culpa!

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


Re: The perils of multiple Pythons

2018-04-30 Thread Rich Shepard

On Mon, 30 Apr 2018, justin walters wrote:


With Python 3.5+, venv is a built in module. If using a venv, default to
using the binary in the venv. That's what I do anyways.


  I'm running Python3-3.6.5 and have a developing application in
~/development/project/. Can I run 'python3 -m venv ~/development/project/'
to install it in a directory with existing modules?

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


Re: The perils of multiple Pythons

2018-04-30 Thread Rich Shepard

On Mon, 30 Apr 2018, justin walters wrote:


Yes, you can create a virtual env with all of the global packages. Though,
you would probably want to run: `python3 -m venv
~/development/project/venv` to put the virtualenv files in their own
directory.


Justin,

  That's what I thought to be the case after reading the python docs about
the venv module.

Thanks!

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


venv: make installed modules visible

2018-05-01 Thread Rich Shepard

  Activating venv and trying to run the project Python tells me it cannot
find the wxPython4 modules:

Traceback (most recent call last):
  File "./openEDMS.py", line 12, in 
import wx
ModuleNotFoundError: No module named 'wx'

  I've read the Python3 venv standard library doc page (section 28.3)
without seeing how to make installed modules (such as wxPython, psycopg2,
and SQLAlchemy visible in the virtual environment. I suspect that EnvBuilder
is involved but I'm not seeing how to apply this class ... if that's how
modules are made visible in the venv.

  A clue is needed.

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


Re: venv: make installed modules visible

2018-05-01 Thread Rich Shepard

On Tue, 1 May 2018, Paul Moore wrote:


Maybe you need  --system-site-packages?


Paul,

  Thank you. I changed pyvenv.cfg to 'include-system-site-packages = true'.

Regards,

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


Re: venv: make installed modules visible

2018-05-01 Thread Rich Shepard

On Tue, 1 May 2018, Dennis Lee Bieber wrote:


Did you miss:


Dennis,

  Yes, I did.

Mea culpa,

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


  1   2   3   4   >