Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to make curses.border() use A_BOLD atttribute?
Post: How to make curses.border() use A_BOLD atttribute?

For a window in a curses screen for which you want a box around the window border, one uses window.border() to populate the border. However, there is no attribute argument available in the window.bor...
pjfarley3 General Coding Help 0 4,825 Feb-03-2021, 11:22 PM
    Thread: csv.reader(): Limit the number of columns read in Windows
Post: RE: csv.reader(): Limit the number of columns read...

Using a copy of the file you pasted in your last message stored on my machine in "utf-8" encoding, this seems to work: import csv file1 = 'C:/Users/MyUserId/envtest/testutf.csv' with open(file1, enc...
pjfarley3 General Coding Help 9 5,210 Jan-23-2021, 01:03 AM
    Thread: csv.reader(): Limit the number of columns read in Windows
Post: RE: csv.reader(): Limit the number of columns read...

Thanks for the example data line. When I try to run your original code (which opens the file in binary, mode "rb") in WSL Ubuntu Linux 20.04 under Win10-64 (python version 3.8.5) it gives this error:...
pjfarley3 General Coding Help 9 5,210 Dec-27-2020, 05:39 AM
    Thread: csv.reader(): Limit the number of columns read in Windows
Post: RE: csv.reader(): Limit the number of columns read...

It is hard to help resolve your issue without at least a few lines of input from your file. If you can paste two or three lines of your file into a reply (use the "Insert Output" button to surround t...
pjfarley3 General Coding Help 9 5,210 Dec-25-2020, 07:59 PM
    Thread: Why does unpickling only work ouside of a function?
Post: RE: Why does unpickling only work ouside of a func...

I have found the answer to my basic question in this tutorial: Pass by Reference in Python Understanding that function arguments are passed by *assignment* and not, as I incorrectly thought, by refe...
pjfarley3 General Coding Help 5 3,431 Dec-24-2020, 08:31 AM
    Thread: Why does unpickling only work ouside of a function?
Post: RE: Why does unpickling only work ouside of a func...

(Dec-04-2020, 07:19 AM)DeaD_EyE Wrote: Quote:My question is why does the function have to RETURN the value of pickle.load(fp)? Why can't a class instance be passed as an argument to a function that ...
pjfarley3 General Coding Help 5 3,431 Dec-05-2020, 06:34 AM
    Thread: Why does unpickling only work ouside of a function?
Post: RE: Why does unpickling only work ouside of a func...

(Dec-03-2020, 11:53 AM)DeaD_EyE Wrote: Example with pickle and json. <Example code snipped> Thanks for the response, but that does not answer my question. In your example you have this line i...
pjfarley3 General Coding Help 5 3,431 Dec-04-2020, 01:27 AM
    Thread: Why does unpickling only work ouside of a function?
Post: Why does unpickling only work ouside of a function...

I wrote a little test program to understand pickling and unpickling a custom class. Pickling a custom class by passing it as a parameter to a function that does the pickling works just fine. Trying ...
pjfarley3 General Coding Help 5 3,431 Dec-03-2020, 07:22 AM
    Thread: Why can't numpy array be restored to a saved value?
Post: RE: Why can't numpy array be restored to a saved v...

Never mind, I found the numpy.copy function which does what I need. Revised code below and output showing correct result (array values restored). Sorry for wasting bandwidth. Peter import numpy as...
pjfarley3 General Coding Help 1 1,710 Nov-25-2020, 07:40 AM
    Thread: Why can't numpy array be restored to a saved value?
Post: Why can't numpy array be restored to a saved value...

Why isn't the final value of the numpy array npary in the following code the same as the initial value before some but not all elements of the array were changed to a new value? I know I am missing s...
pjfarley3 General Coding Help 1 1,710 Nov-25-2020, 06:47 AM
    Thread: Can property getters and setters have additional arguments?
Post: RE: Can property getters and setters have addition...

I added your code and reduced the Matrix size from 10 to to 3 so output would be shorter. Below is the output. The arrays in the class and the Coord() value are NUMPY arrays, not regular python arra...
pjfarley3 General Coding Help 2 3,042 Oct-30-2020, 12:17 AM
    Thread: Can property getters and setters have additional arguments?
Post: Can property getters and setters have additional a...

I am trying to implement getters and setters in a class using a numpy array as the base instance value, but I am not able to pass an array index argument to the getter function (and probably not to th...
pjfarley3 General Coding Help 2 3,042 Oct-29-2020, 06:31 AM
    Thread: Does anyone have unicurses panel functions working on a Windows 10 platform?
Post: Does anyone have unicurses panel functions working...

I have been trying to get unicurses panel functions working on my Windows 10 machine, but without much success. I am running a Win 10 V2004 system, current on maintenance.  Python is 3.8.5.  I DL'ed ...
pjfarley3 General Coding Help 0 1,458 Oct-11-2020, 04:41 AM
    Thread: Why this pycharm warning for argparse formatter_class value?
Post: RE: Why this pycharm warning for argparse formatte...

It would seem to be a pycharm issue. Using argparse.ArgumentDefaultsHelpFormatter directly as the value of formatter_class generates the same (or at least very similar) warning about a mis-matched ar...
pjfarley3 General Coding Help 2 2,118 Sep-09-2020, 05:23 AM
    Thread: Why this pycharm warning for argparse formatter_class value?
Post: Why this pycharm warning for argparse formatter_cl...

The below script runs just fine from the command line, but pycharm complains that the formatter_class value in the call to argparse.ArgumentParser is of an "Unexpected type", it says it is expecting "...
pjfarley3 General Coding Help 2 2,118 Sep-04-2020, 09:10 PM
    Thread: Best way(s) to organize and use "global" values?
Post: RE: Best way(s) to organize and use "global" value...

Enum's and their derivatives IntEnum, IntFlag and Flag seem to do quite a lot of what I think I need to do, so I will study them carefully. Is there any syntactic sugar that would permit the names of...
pjfarley3 General Coding Help 6 2,638 Sep-03-2020, 12:27 AM
    Thread: Best way(s) to organize and use "global" values?
Post: RE: Best way(s) to organize and use "global" value...

That is a valid concern, but there are legitimate uses for globals, particularly "named constants". It isn't reasonable to pass dozens of "global" and/or static variables to functions, so even if one...
pjfarley3 General Coding Help 6 2,638 Sep-02-2020, 02:19 PM
    Thread: Best way(s) to organize and use "global" values?
Post: Best way(s) to organize and use "global" values?

When writing some applications (e.g., games), one ends up having perhaps dozens or even hundreds of "global" values, of several types: 1. Predefined static values one wishes to use as "named constant...
pjfarley3 General Coding Help 6 2,638 Sep-02-2020, 05:10 AM
    Thread: Can argparse support undocumented options?
Post: RE: Can argparse support undocumented options?

Thanks to both buran and bowlofred, I missed that in the documentation. Peter
pjfarley3 General Coding Help 3 2,191 Aug-14-2020, 06:13 AM
    Thread: Can argparse support undocumented options?
Post: Can argparse support undocumented options?

Suppose I want to have options that I do not normally want to tell the user about in the help message, but which are parsed and processed by argparse like all other defined options. For example, deb...
pjfarley3 General Coding Help 3 2,191 Aug-14-2020, 04:03 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020