Re: help

2024-05-13 Thread Thomas Passin via Python-list

On 5/12/2024 7:56 PM, Enrder via Python-list wrote:

good tader

I need help to install the bcml, and is that after installing the python
and I go to the command prompt and put ''pip install bcml'' to install it
tells me "pip" is not recognized as an internal or external command,
program or executable batch file.

I have tried everything, uninstalling and installing, restoring it,
activating and deactivating all the checkboxes that appear in the options
section, I searched the internet and the same thing keeps happening to me.



If you can help me, I would appreciate it very much.


Launch pip using the following command.  If you don't run python using 
the name "python" then use the name you usually use (e.g., "py", 
"python3", etc.) -


python -m pip install bcml

This command causes Python to load and run its own copy of pip.  So the 
fact that the operating system can't find it doesn't matter.  You should 
always run pip this way, especially if you end up with several different 
versions of Python on the same computer.


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


Re: help: pandas and 2d table

2024-04-16 Thread jak via Python-list

Stefan Ram ha scritto:

jak  wrote or quoted:

Stefan Ram ha scritto:

df = df.where( df == 'zz' ).stack().reset_index()
result ={ 'zz': list( zip( df.iloc[ :, 0 ], df.iloc[ :, 1 ]))}

Since I don't know Pandas, I will need a month at least to understand
these 2 lines of code. Thanks again.


   Here's a technique to better understand such code:

   Transform it into a program with small statements and small
   expressions with no more than one call per statement if possible.
   (After each litte change check that the output stays the same.)

import pandas as pd

# Warning! Will overwrite the file 'file_20240412201813_tmp_DML.csv'!
with open( 'file_20240412201813_tmp_DML.csv', 'w' )as out:
 print( '''obj,foo1,foo2,foo3,foo4,foo5,foo6
foo1,aa,ab,zz,ad,ae,af
foo2,ba,bb,bc,bd,zz,bf
foo3,ca,zz,cc,cd,ce,zz
foo4,da,db,dc,dd,de,df
foo5,ea,eb,ec,zz,ee,ef
foo6,fa,fb,fc,fd,fe,ff''', file=out )
# Note the "index_col=0" below, which is important here!
df = pd.read_csv( 'file_20240412201813_tmp_DML.csv', index_col=0 )

selection = df.where( df == 'zz' )
selection_stack = selection.stack()
df = selection_stack.reset_index()
df0 = df.iloc[ :, 0 ]
df1 = df.iloc[ :, 1 ]
z = zip( df0, df1 )
l = list( z )
result ={ 'zz': l }
print( result )

   I suggest to next insert print statements to print each intermediate
   value:

# Note the "index_col=0" below, which is important here!
df = pd.read_csv( 'file_20240412201813_tmp_DML.csv', index_col=0 )
print( 'df = \n', type( df ), ':\n"', df, '"\n' )

selection = df.where( df == 'zz' )
print( "result of where( df == 'zz' ) = \n", type( selection ), ':\n"',
   selection, '"\n' )

selection_stack = selection.stack()
print( 'result of stack() = \n', type( selection_stack ), ':\n"',
   selection_stack, '"\n' )

df = selection_stack.reset_index()
print( 'result of reset_index() = \n', type( df ), ':\n"', df, '"\n' )

df0 = df.iloc[ :, 0 ]
print( 'value of .iloc[ :, 0 ]= \n', type( df0 ), ':\n"', df0, '"\n' )

df1 = df.iloc[ :, 1 ]
print( 'value of .iloc[ :, 1 ] = \n', type( df1 ), ':\n"', df1, '"\n' )

z = zip( df0, df1 )
print( 'result of zip( df0, df1 )= \n', type( z ), ':\n"', z, '"\n' )

l = list( z )
print( 'result of list( z )= \n', type( l ), ':\n"', l, '"\n' )

result ={ 'zz': l }
print( "value of { 'zz': l }= \n", type( result ), ':\n"',
   result, '"\n' )

print( result )

   Now you can see what each single step does!

df =
   :
"  foo1 foo2 foo3 foo4 foo5 foo6
obj
foo1   aa   ab   zz   ad   ae   af
foo2   ba   bb   bc   bd   zz   bf
foo3   ca   zz   cc   cd   ce   zz
foo4   da   db   dc   dd   de   df
foo5   ea   eb   ec   zz   ee   ef
foo6   fa   fb   fc   fd   fe   ff "

result of where( df == 'zz' ) =
   :
"  foo1 foo2 foo3 foo4 foo5 foo6
obj
foo1  NaN  NaN   zz  NaN  NaN  NaN
foo2  NaN  NaN  NaN  NaN   zz  NaN
foo3  NaN   zz  NaN  NaN  NaN   zz
foo4  NaN  NaN  NaN  NaN  NaN  NaN
foo5  NaN  NaN  NaN   zz  NaN  NaN
foo6  NaN  NaN  NaN  NaN  NaN  NaN "

result of stack() =
   :
" obj
foo1  foo3zz
foo2  foo5zz
foo3  foo2zz
   foo6zz
foo5  foo4zz
dtype: object "

result of reset_index() =
   :
" obj level_1   0
0  foo1foo3  zz
1  foo2foo5  zz
2  foo3foo2  zz
3  foo3foo6  zz
4  foo5foo4  zz "

value of .iloc[ :, 0 ]=
   :
" 0foo1
1foo2
2foo3
3foo3
4foo5
Name: obj, dtype: object "

value of .iloc[ :, 1 ] =
   :
" 0foo3
1foo5
2foo2
3foo6
4foo4
Name: level_1, dtype: object "

result of zip( df0, df1 )=
   :
" "

result of list( z )=
   :
" [('foo1', 'foo3'), ('foo2', 'foo5'), ('foo3', 'foo2'), ('foo3', 'foo6'), ('foo5', 
'foo4')]"

value of { 'zz': l }=
   :
" {'zz': [('foo1', 'foo3'), ('foo2', 'foo5'), ('foo3', 'foo2'), ('foo3', 'foo6'), 
('foo5', 'foo4')]}"

{'zz': [('foo1', 'foo3'), ('foo2', 'foo5'), ('foo3', 'foo2'), ('foo3', 'foo6'), 
('foo5', 'foo4')]}

   The script reads a CSV file and stores the data in a Pandas
   DataFrame object named "df". The "index_col=0" parameter tells
   Pandas to use the first column as the index for the DataFrame,
   which is kinda like column headers.

   The "where" creates a new DataFrame selection that contains
   the same data as df, but with all values replaced by NaN (Not
   a Number) except for the values that are equal to 'zz'.

   "stack" returns a Series with a multi-level index created
   by pivoting the columns. Here it gives a Series with the
   row-col-addresses of a all the non-NaN values. The general
   meaning of "stack" might be the most complex operation of
   this script. It's explained in the pandas manual (see there).

   "reset_index" then just transforms this Series back into a
   DataFrame, and ".iloc[ :, 0 ]" and ".iloc[ :, 1 ]" are the
   first and second column, respectively, of that DataFrame. These
   then are zipped to get the desired form as a list of pairs.



And this is a technique very similar to reverse engineering. Thanks for
the explanation and examples. All this is really clear and I was able to
follow 

Re: help: pandas and 2d table

2024-04-16 Thread jak via Python-list

Stefan Ram ha scritto:

df = df.where( df == 'zz' ).stack().reset_index()
result ={ 'zz': list( zip( df.iloc[ :, 0 ], df.iloc[ :, 1 ]))}


Since I don't know Pandas, I will need a month at least to understand
these 2 lines of code. Thanks again.
--
https://mail.python.org/mailman/listinfo/python-list


Re: help: pandas and 2d table

2024-04-13 Thread Tim Williams via Python-list
On Sat, Apr 13, 2024 at 1:10 PM Mats Wichmann via Python-list <
python-list@python.org> wrote:

> On 4/13/24 07:00, jak via Python-list wrote:
>
> doesn't Pandas have a "where" method that can do this kind of thing? Or
> doesn't it match what you are looking for?  Pretty sure numpy does, but
> that's a lot to bring in if you don't need the rest of numpy.
>
> pandas.DataFrame.where — pandas 2.2.2 documentation (pydata.org)

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


Re: help: pandas and 2d table

2024-04-13 Thread Mats Wichmann via Python-list

On 4/13/24 07:00, jak via Python-list wrote:

Stefan Ram ha scritto:

jak  wrote or quoted:

Would you show me the path, please?


   I was not able to read xls here, so I used csv instead; Warning:
   the script will overwrite file "file_20240412201813_tmp_DML.csv"!

import pandas as pd

with open( 'file_20240412201813_tmp_DML.csv', 'w' )as out:
 print( '''obj,foo1,foo2,foo3,foo4,foo5,foo6
foo1,aa,ab,zz,ad,ae,af
foo2,ba,bb,bc,bd,zz,bf
foo3,ca,zz,cc,cd,ce,zz
foo4,da,db,dc,dd,de,df
foo5,ea,eb,ec,zz,ee,ef
foo6,fa,fb,fc,fd,fe,ff''', file=out )

df = pd.read_csv( 'file_20240412201813_tmp_DML.csv' )

result = {}

for rownum, row in df.iterrows():
 iterator = row.items()
 _, rowname = next( iterator )
 for colname, value in iterator:
 if value not in result: result[ value ]= []
 result[ value ].append( ( rowname, colname ))

print( result )



In reality what I wanted to achieve was this:

     what = 'zz'
     result = {what: []}

     for rownum, row in df.iterrows():
     iterator = row.items()
     _, rowname = next(iterator)
     for colname, value in iterator:
     if value == what:
     result[what] += [(rowname, colname)]
     print(result)

In any case, thank you again for pointing me in the right direction. I
had lost myself looking for a pandas method that would do this in a
single shot or almost.




doesn't Pandas have a "where" method that can do this kind of thing? Or 
doesn't it match what you are looking for?  Pretty sure numpy does, but 
that's a lot to bring in if you don't need the rest of numpy.



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


Re: help: pandas and 2d table

2024-04-13 Thread jak via Python-list

Stefan Ram ha scritto:

jak  wrote or quoted:

Would you show me the path, please?


   I was not able to read xls here, so I used csv instead; Warning:
   the script will overwrite file "file_20240412201813_tmp_DML.csv"!

import pandas as pd

with open( 'file_20240412201813_tmp_DML.csv', 'w' )as out:
 print( '''obj,foo1,foo2,foo3,foo4,foo5,foo6
foo1,aa,ab,zz,ad,ae,af
foo2,ba,bb,bc,bd,zz,bf
foo3,ca,zz,cc,cd,ce,zz
foo4,da,db,dc,dd,de,df
foo5,ea,eb,ec,zz,ee,ef
foo6,fa,fb,fc,fd,fe,ff''', file=out )

df = pd.read_csv( 'file_20240412201813_tmp_DML.csv' )

result = {}

for rownum, row in df.iterrows():
 iterator = row.items()
 _, rowname = next( iterator )
 for colname, value in iterator:
 if value not in result: result[ value ]= []
 result[ value ].append( ( rowname, colname ))

print( result )



In reality what I wanted to achieve was this:

what = 'zz'
result = {what: []}

for rownum, row in df.iterrows():
iterator = row.items()
_, rowname = next(iterator)
for colname, value in iterator:
if value == what:
result[what] += [(rowname, colname)]
print(result)

In any case, thank you again for pointing me in the right direction. I
had lost myself looking for a pandas method that would do this in a
single shot or almost.


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


Re: Help Needed With a Python Gaming Module

2024-04-03 Thread Thomas Passin via Python-list

On 4/3/2024 3:06 PM, WordWeaver Evangelist via Python-list wrote:

Hello everyone! It has been a l-o-n-g time -- nine years in fact --since I last 
participated on this mailing list.


[snip]

3. You are very familiar with the Jython 2 environment, which I am told is 
based on Python 2 and NOT Python 3.


Yes, Jython 2 is currently more or less even with Python 2.7.

You are presumably writing or hosting this in a java environment, and 
you may not realize that you can call Jython code from a java class 
(calling java classes from Jython code is dead simple).  For example, I 
have some java servlet classes that invoke Jython classes and call their 
methods.  If that sounds useful for your project, I can let you know how 
to do it.


[more snips...]

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


Re: Help

2023-11-07 Thread Mike Dewhirst via Python-list

On 7/11/2023 9:02 am, Jason Friedman via Python-list wrote:

On Sun, Nov 5, 2023 at 1:23 PM office officce via Python-list <
python-list@python.org> wrote:


which python version is better to be used and how to make sure it works on
my window 10 because i downloaded it and it never worked so I uninstall to
do that again please can you give me the steps on how it will work perfectly


1. Download from https://python.org (not Microsoft) and always choose 
the 64-bit stable version


2. Choose the installation location as C:\Python311 (avoid the default)

4. Accept other recommended installation options especially to include 
Python on the path (if offered)


Guaranteed to work. Also, you will never have to uninstall. Install the 
next version in C:\Python312 etc


In due course, investigate virtual environments so you can work on 
projects simultaneously using different versions of Python or different 
versions of various Python libraries.


Good luck

Mike





If you are just starting out, the most recent version is 3.12 and is
probably your best choice.

When you say it never worked, can you describe in more detail what you did
and what error messages you encountered?

This mailing list does not accept screenshots.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.



OpenPGP_signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help

2023-11-06 Thread Jason Friedman via Python-list
On Sun, Nov 5, 2023 at 1:23 PM office officce via Python-list <
python-list@python.org> wrote:

> which python version is better to be used and how to make sure it works on
> my window 10 because i downloaded it and it never worked so I uninstall to
> do that again please can you give me the steps on how it will work perfectly
>
>
If you are just starting out, the most recent version is 3.12 and is
probably your best choice.

When you say it never worked, can you describe in more detail what you did
and what error messages you encountered?

This mailing list does not accept screenshots.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry
 On 18 May 2023, at 13:56, Jason Qian  wrote:

 
 Hi Barry,
 void handleError(const char* msg)
 {
 ...
 PyErr_Fetch(, , );
 PyErr_NormalizeException(, , );

 PyObject* str_value = PyObject_Repr(pyExcValue);
 PyObject* pyExcValueStr = PyUnicode_AsEncodedString(str_value, "utf-8",
 "Error ~");
 const char *strErrValue = PyBytes_AS_STRING(pyExcValueStr);
 //where   strErrValue   = "ImportError('Error: Reinit is forbidden')"
 ...
 }
 What we imported is a Python file which import some pyd libraries.

   Please do not top post replies.
   Ok so assume the error is correct and hunt for the code that does the
   reimport.
   You may need to set break points in you C code to find tnw caller.
   Barry

 Thanks 
 Jason 
 On Thu, May 18, 2023 at 3:53 AM Barry <[1]ba...@barrys-emacs.org> wrote:

   > On 17 May 2023, at 20:35, Jason Qian via Python-list
   <[2]python-list@python.org> wrote:
   >
   >  Hi,
   >
   >   I Need some of your help.
   >
   > I have the following C code to import *Import python.*   It works
   99% of
   > the time, but sometimes  receives  "*ImportError('Error: Reinit is
   > forbidden')*". error.
   > **We run multiple instances of the app parallelly.
   >
   > *** Python version(3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51)
   [MSC
   > v.1914 64 bit (AMD64)]
   >
   > PyObject * importPythonModule(const char* pmodName)
   > {
   >    const char* errors = NULL;
   >     int nlen = strlen(pmodName);
   >     PyObject *pName = PyUnicode_DecodeUTF8(pmodName, nlen, errors);
   >     PyObject *pModule = *PyImport_Import*(pName);
   >     Py_DECREF(pName);
   >     if (pModule == NULL) {
   >     if (*PyErr_Occurred*()) {
   >            handleError("PyImport_Import()");
   >      }
   >   }
   > }
   > void handleError(const char* msg)
   > {
   >  ...
   >  "PyImport_Import() - ImportError('Error: Reinit is forbidden')"
   > }

   You do not seem to printing out msg, you have assumed it means reinit
   it seems.
   What does msg contain when it fails?

   Barry
   >
   >
   > Thanks
   > Jason
   > --
   > [3]https://mail.python.org/mailman/listinfo/python-list
   >

References

   Visible links
   1. mailto:ba...@barrys-emacs.org
   2. mailto:python-list@python.org
   3. https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Jason Qian via Python-list
Hi Barry,

void handleError(const char* msg)
{
...
PyErr_Fetch(, , );
PyErr_NormalizeException(, , );

PyObject* str_value = PyObject_Repr(pyExcValue);
PyObject* pyExcValueStr = PyUnicode_AsEncodedString(str_value, "utf-8",
"Error ~");
const char **strErrValue* = PyBytes_AS_STRING(pyExcValueStr);

//where   *strErrValue*   = "ImportError('Error: Reinit is forbidden')"
...
}

What we imported is a Python file which import some pyd libraries.


Thanks
Jason


On Thu, May 18, 2023 at 3:53 AM Barry  wrote:

>
>
> > On 17 May 2023, at 20:35, Jason Qian via Python-list <
> python-list@python.org> wrote:
> >
> >  Hi,
> >
> >   I Need some of your help.
> >
> > I have the following C code to import *Import python.*   It works 99% of
> > the time, but sometimes  receives  "*ImportError('Error: Reinit is
> > forbidden')*". error.
> > **We run multiple instances of the app parallelly.
> >
> > *** Python version(3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC
> > v.1914 64 bit (AMD64)]
> >
> > PyObject * importPythonModule(const char* pmodName)
> > {
> >const char* errors = NULL;
> > int nlen = strlen(pmodName);
> > PyObject *pName = PyUnicode_DecodeUTF8(pmodName, nlen, errors);
> > PyObject *pModule = *PyImport_Import*(pName);
> > Py_DECREF(pName);
> > if (pModule == NULL) {
> > if (*PyErr_Occurred*()) {
> >handleError("PyImport_Import()");
> >  }
> >   }
> > }
> > void handleError(const char* msg)
> > {
> >  ...
> >  "PyImport_Import() - ImportError('Error: Reinit is forbidden')"
> > }
>
> You do not seem to printing out msg, you have assumed it means reinit it
> seems.
> What does msg contain when it fails?
>
> Barry
> >
> >
> > Thanks
> > Jason
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry


> On 17 May 2023, at 20:35, Jason Qian via Python-list  
> wrote:
> 
>  Hi,
> 
>   I Need some of your help.
> 
> I have the following C code to import *Import python.*   It works 99% of
> the time, but sometimes  receives  "*ImportError('Error: Reinit is
> forbidden')*". error.
> **We run multiple instances of the app parallelly.
> 
> *** Python version(3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC
> v.1914 64 bit (AMD64)]
> 
> PyObject * importPythonModule(const char* pmodName)
> {
>const char* errors = NULL;
> int nlen = strlen(pmodName);
> PyObject *pName = PyUnicode_DecodeUTF8(pmodName, nlen, errors);
> PyObject *pModule = *PyImport_Import*(pName);
> Py_DECREF(pName);
> if (pModule == NULL) {
> if (*PyErr_Occurred*()) {
>handleError("PyImport_Import()");
>  }
>   }
> }
> void handleError(const char* msg)
> {
>  ...
>  "PyImport_Import() - ImportError('Error: Reinit is forbidden')"
> }

You do not seem to printing out msg, you have assumed it means reinit it seems.
What does msg contain when it fails?

Barry
> 
> 
> Thanks
> Jason
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Re: Help on ctypes.POINTER for Python array

2023-05-11 Thread Jason Qian via Python-list
Awesome, thanks!

On Thu, May 11, 2023 at 1:47 PM Eryk Sun  wrote:

> On 5/11/23, Jason Qian via Python-list  wrote:
> >
> > in the Python, I have a array of string
> > var_array=["Opt1=DG","Opt1=DG2"]
> > I need to call c library and  pass var_array as parameter
> > In the   argtypes,  how do I set up ctypes.POINTER(???)  for var_array?
> >
> > func.argtypes=[ctypes.c_void_p,ctypes.c_int, ctypes.POINTER()]
> >
> > In the c code:
> > int  func (void* obj, int index,  char** opt)
>
> The argument type is ctypes.POINTER(ctypes.c_char_p), but that's not
> sufficient. It doesn't implement converting a list of str objects into
> an array of c_char_p pointers that reference byte strings. You could
> write a wrapper function that implements the conversion before calling
> func(), or you could set the argument type to a custom subclass of
> ctypes.POINTER(ctypes.c_char_p) that implements the conversion via the
> from_param() class method.
>
> https://docs.python.org/3/library/ctypes.html#ctypes._CData.from_param
>
> Here's an example of the latter.
>
> C library:
>
> #include 
>
> int
> func(void *obj, int index, char **opt)
> {
> int length;
> for (length=0; opt[length]; length++);
> if (index < 0 || index >= length) {
> return -1;
> }
> return printf("%s\n", opt[index]);
> }
>
>
> Python:
>
> import os
> import ctypes
>
> lib = ctypes.CDLL('./lib.so')
> BaseOptions = ctypes.POINTER(ctypes.c_char_p)
>
> class Options(BaseOptions):
> @classmethod
> def from_param(cls, param):
> if isinstance(param, list):
> new_param = (ctypes.c_char_p * (len(param) + 1))()
> for i, p in enumerate(param):
> new_param[i] = os.fsencode(p)
> param = new_param
> return BaseOptions.from_param(param)
>
> lib.func.argtypes = (ctypes.c_void_p, ctypes.c_int, Options)
>
>
> demo:
>
> >>> opts = ['Opt1=DG', 'Opt1=DG2']
> >>> lib.func(None, 0, opts)
> Opt1=DG
> 8
> >>> lib.func(None, 1, opts)
> Opt1=DG2
> 9
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help on ctypes.POINTER for Python array

2023-05-11 Thread Eryk Sun
On 5/11/23, Jason Qian via Python-list  wrote:
>
> in the Python, I have a array of string
> var_array=["Opt1=DG","Opt1=DG2"]
> I need to call c library and  pass var_array as parameter
> In the   argtypes,  how do I set up ctypes.POINTER(???)  for var_array?
>
> func.argtypes=[ctypes.c_void_p,ctypes.c_int, ctypes.POINTER()]
>
> In the c code:
> int  func (void* obj, int index,  char** opt)

The argument type is ctypes.POINTER(ctypes.c_char_p), but that's not
sufficient. It doesn't implement converting a list of str objects into
an array of c_char_p pointers that reference byte strings. You could
write a wrapper function that implements the conversion before calling
func(), or you could set the argument type to a custom subclass of
ctypes.POINTER(ctypes.c_char_p) that implements the conversion via the
from_param() class method.

https://docs.python.org/3/library/ctypes.html#ctypes._CData.from_param

Here's an example of the latter.

C library:

#include 

int
func(void *obj, int index, char **opt)
{
int length;
for (length=0; opt[length]; length++);
if (index < 0 || index >= length) {
return -1;
}
return printf("%s\n", opt[index]);
}


Python:

import os
import ctypes

lib = ctypes.CDLL('./lib.so')
BaseOptions = ctypes.POINTER(ctypes.c_char_p)

class Options(BaseOptions):
@classmethod
def from_param(cls, param):
if isinstance(param, list):
new_param = (ctypes.c_char_p * (len(param) + 1))()
for i, p in enumerate(param):
new_param[i] = os.fsencode(p)
param = new_param
return BaseOptions.from_param(param)

lib.func.argtypes = (ctypes.c_void_p, ctypes.c_int, Options)


demo:

>>> opts = ['Opt1=DG', 'Opt1=DG2']
>>> lib.func(None, 0, opts)
Opt1=DG
8
>>> lib.func(None, 1, opts)
Opt1=DG2
9
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help on ctypes.POINTER for Python array

2023-05-11 Thread Jim Schwartz
I’m not sure this is the shortest method, but you could set up two python 
scripts to do the same thing and convert them to c using cython. I wouldn’t be 
able to read the c scripts, but maybe you could. 

Maybe someone else has a more direct answer. 

Sent from my iPhone

> On May 11, 2023, at 10:00 AM, Jason Qian via Python-list 
>  wrote:
> 
> Hi,
> 
> Need some help,
> 
> in the Python, I have a array of string
> 
> var_array=["Opt1=DG","Opt1=DG2"]
> 
> I need to call c library and  pass var_array as parameter
> 
> In the   argtypes,  how do I set up ctypes.POINTER(???)  for var_array?
> 
> func.argtypes=[ctypes.c_void_p,ctypes.c_int, ctypes.POINTER()]
> 
> In the c code:
> 
> int  func (void* obj, int index,  char** opt)
> 
> Thanks
> Jason
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: [Help Request] Embedding Python in a CPP Application Responsibly & Functionally

2023-01-26 Thread Dieter Maurer
John McCardle wrote at 2023-1-25 22:31 -0500:
> ...
>1) To get the compiled Python to run independently, I have to hack
>LD_LIBRARY_PATH to get it to execute. `LD_LIBRARY_PATH=./Python-3.11.1
>./Python-3.11.1/python` .

The need to set `LD_LIBRARY_PATH` usually can be avoided via
a link time option: it tells the linker to add library path
information into the created shared object.

Read the docs to find out which option this is (I think it
was `-r` but I am not sure).

>Even when trying to execute from the same
>directory as the binary & executable, I get an error, `/python: error
>while loading shared libraries: libpython3.11.so.1.0: cannot open shared
>object file: No such file or directory`.

It might be necessary, to provide the option mentioned above
for all shared libraries involved in your final application.

Alternatively, you could try to put the shared objects
into a stadard place (searched by default).

>2) When running the C++ program that embeds Python, I see these messages
>after initializing:
>`Could not find platform independent libraries 
>Could not find platform dependent libraries `

Again: either put your installation in a standard place
or tell the Python generation process about your non-standard place.


>This is seemingly connected to some issues regarding libraries: When I
>run the Python interpreter directly, I can get some of the way through
>the process of creating a virtual environment, but it doesn't seem to
>leave me with a working pip:
>
>`$ LD_LIBRARY_PATH=./Python-3.11.1 ./Python-3.11.1/python
> >>> import venv
> >>> venv.create("./venv", with_pip=True)
>subprocess.CalledProcessError: Command
>'['/home/john/Development/7DRL/cpp_embedded_python/venv/bin/python',
>'-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit
>status 127.`

Run the command manually and see what errors this gives.

> ...

>3) I'm not sure I even need to be statically linking the interpreter.

There should be no need (if all you want in the embedding).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help

2022-12-30 Thread Chris Grace
Hello,

The mailing list strips all images. We cannot see the error you posted. I'd
recommend posting it in text form.

What is the script you are running?

What do you expect your script to do?

On Fri, Dec 30, 2022, 3:14 PM Mor yosef  wrote:

> Hello guys,
> i install python 3.11.1, and i have google chrome so i download the
> Webdriver Chrome
> and i just add it on my c:// driver and when i add some script on my
> desktop i try to run it from the terminal and all the time i receive this
> error message : maybe you guys can help me with this one?
> when i add some random code the terminal like "python -m webbrowser
> https://www.google.com; it's just works (it's open the website in new tab)
> Regards
> Mor yosef
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help Merging Of Separate Python Codes

2022-11-19 Thread dn

On 20/11/2022 02.20, maria python wrote:
Hello, I have these two python codes that work well separately and I 
want to combine them, but I am not sure how to do it. Also after that, I 
want to print the result in txt cvs or another file format. Do you have 
a code for that? Thank you.



Have you tried joining them together, one after the other?

Have you looked at the Python docs?
eg https://docs.python.org/3/library/csv.html

Do you need the help of a professional to write code for you?

If you are learning Python, perhaps the Tutor list will be a more 
appropriate for you...


--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help, PyCharm fails to recognize my tab setting...See attached picture of the code.

2022-10-11 Thread dn

On 11/10/2022 10.48, Kevin M. Wilson via Python-list wrote:

C:\Users\kevin\PycharmProjects\Myfuturevalue\venv\Scripts\python.exe 
C:\Users\kevin\PycharmProjects\Myfuturevalue\FutureValueCal.py   File 
"C:\Users\kevin\PycharmProjects\Myfuturevalue\FutureValueCal.py", line 31    elif 
(years > 50.0) or (years < 1.0) :    ^IndentationError: expected an indented block after 
'if' statement on line 29
Process finished with exit code 1


Indentation depends upon what went before, as well as what is being 
indented 'right now'.


As you can see from the reproduction of the OP (above), any comment on 
formatting would be a guess.


Please copy-paste the entire block of the if-statement and its nested 
suites...

(this list will not pass-along images)
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread Dennis Lee Bieber
On Mon, 6 Jun 2022 12:37:47 +0200, Dave  declaimed
the following:

>Hi,
>
>I’m trying to get the ID3 tags of an mp3 file. I trying to use the 
>MusicCDIdFrame
> method but I can’t seem to get it right. Here is a code snippet:
>
>
> import eyed3
>import eyed3.id3
>import eyed3.id3.frames
>import eyed3.id3.apple

As I understand the documentation, The last is Apple
specific/non-standard information...
https://eyed3.readthedocs.io/en/latest/eyed3.id3.html

"""
eyed3.id3.apple module

Here lies Apple frames, all of which are non-standard. All of these would
have been standard user text frames by anyone not being a bastard, on
purpose.
"""

{I'm not thrilled by the documentation -- it is basically a collection on
one-line doc-strings with absolutely no hints as to proper usage}

>  File "/Documents/Python/Test1/main.py", line 94, in 
>myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>AttributeError: 'Mp3AudioFile' object has no attribute 'id3'

"""
 eyed3.core.load(path, tag_version=None)[source]

Loads the file identified by path and returns a concrete type of
eyed3.core.AudioFile. If path is not a file an IOError is raised. None is
returned when the file type (i.e. mime-type) is not recognized. The
following AudioFile types are supported:

eyed3.mp3.Mp3AudioFile - For mp3 audio files.

eyed3.id3.TagFile - For raw ID3 data files.
"""

eyed3.id3. would appear to be specific to non-MP3 data files.

So... I'd try the interactive environment and check each layer...

dir(myID3)

(based upon the error, there will not be a "id3" key; so try
dir(myID3.) for each key you do find).

>
>
>Any help or suggestion greatly appreciated.
>

Given this bit of source code from the documentation...

def initTag(self, version=id3.ID3_DEFAULT_VERSION):
"""Add a id3.Tag to the file (removing any existing tag if one
exists).
"""
self.tag = id3.Tag()
self.tag.version = version
self.tag.file_info = id3.FileInfo(self.path)
return self.tag

... you probably need to be looking at 
myID3.tag.

... try
dir(myID3.tag)
and see what all may appear...

IOW: the ID3 information has already been parsed into separate "tag"
fields.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread Dave
Thanks! That fixed it!

> On 6 Jun 2022, at 18:46, MRAB  wrote:
> 
> On 2022-06-06 11:37, Dave wrote:
>> Hi,
>> I’m trying to get the ID3 tags of an mp3 file. I trying to use the 
>> MusicCDIdFrame
>>  method but I can’t seem to get it right. Here is a code snippet:
>>  import eyed3
>> import eyed3.id3
>> import eyed3.id3.frames
>> import eyed3.id3.apple
>> import eyed3.mp3
>> myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
>> myTitle = myID3.tag.title
>> myArtist = myID3.tag.artist
>> myAlbum = myID3.tag.album
>> myAlbumArtist = myID3.tag.album_artist
>> myComposer = myID3.tag.composer
>> myPublisher = myID3.tag.publisher
>> myGenre = myID3.tag.genre.name
>> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>> When I run this, I get the following error:
>>   File "/Documents/Python/Test1/main.py", line 94, in 
>> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>> AttributeError: 'Mp3AudioFile' object has no attribute 'id3'
>> Any help or suggestion greatly appreciated.
> That line should be:
> 
> myCDID = eyed3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
> 
> Also remember that some attributes might be None, e.g. 'myID3.tag.genre' 
> might be None.
> 
> Another point: it's probably not worth importing the submodules of 'eyed3'; 
> you're not gaining anything from it.
> -- 
> https://mail.python.org/mailman/listinfo/python-list 
> 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread MRAB

On 2022-06-06 11:37, Dave wrote:

Hi,

I’m trying to get the ID3 tags of an mp3 file. I trying to use the 
MusicCDIdFrame
  method but I can’t seem to get it right. Here is a code snippet:


  import eyed3
import eyed3.id3
import eyed3.id3.frames
import eyed3.id3.apple
import eyed3.mp3
myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
myTitle = myID3.tag.title
myArtist = myID3.tag.artist
myAlbum = myID3.tag.album
myAlbumArtist = myID3.tag.album_artist
myComposer = myID3.tag.composer
myPublisher = myID3.tag.publisher
myGenre = myID3.tag.genre.name
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')

When I run this, I get the following error:

   File "/Documents/Python/Test1/main.py", line 94, in 
 myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
AttributeError: 'Mp3AudioFile' object has no attribute 'id3'


Any help or suggestion greatly appreciated.


That line should be:

myCDID = eyed3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')

Also remember that some attributes might be None, e.g. 'myID3.tag.genre' 
might be None.


Another point: it's probably not worth importing the submodules of 
'eyed3'; you're not gaining anything from it.

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


Re: help, please, with 3.10.4 install

2022-05-30 Thread Dennis Lee Bieber
On Sat, 28 May 2022 21:11:00 -0500, Jack Gilbert <00jhen...@gmail.com>
declaimed the following:

>also, the same line: Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022,
>23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 in CMD prompt
>
>for the life of me I can't figure out how to launch python??
>

Well, what did you type in that command shell to get the line you
report above? (Cut and Paste the TEXT from that command shell -- don't just
transcribe by hand). That version string is only displayed when one starts
Python in interactive mode.

-=-=-
Microsoft Windows [Version 10.0.19044.1706]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Wulfraed>python
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

-=-=-



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help, please, with 3.10.4 install

2022-05-30 Thread Mats Wichmann
On 5/28/22 20:11, Jack Gilbert wrote:
> I downloaded 3.10.4 on a 64 bit , 8.1

> also, the same line: Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022,
> 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 in CMD prompt
> 
> for the life of me I can't figure out how to launch python??

Sounds like you're launching it already?

In a cmd shell, type:

py


And you should be good to go.  See the page @dn pointed to.


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


Re: help, please, with 3.10.4 install

2022-05-29 Thread dn
On 29/05/2022 14.11, Jack Gilbert wrote:
> I downloaded 3.10.4 on a 64 bit , 8.1
> I can see IDLE shell 3.10.1, I see Python 3.10.4 (tags/v3.10.4:9d38120, Mar
> 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
> 
> also, the same line: Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022,
> 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 in CMD prompt
> 
> for the life of me I can't figure out how to launch python??
> 
> I did click add to path in the install
> 
> thanks


Please advise if https://docs.python.org/3/using/windows.html does not
answer the question...
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help: Unable to find IDLE folder inside the Python Lib folder

2022-03-05 Thread MRAB

On 2022-03-05 20:36, Deji Olofinboba via Python-list wrote:


Dear Python officer,
Please I am new to programming. I have justinstalled the python 3.10.2. After 
the installation, I was able to locate thePython Shell but unable to locate 
IDLE despite checking it before downloading in the python installation folder. 
I also reinstalled Python and checked IDLE; still the IDLE is still missing. 
Please. explain to me how I can retrieve the python IDLE.
Thank You,


If you're on Windows 10, type "idle" into the search box on the taskbar.
Alternatively, look in python_folder\Lib\idlelib for idle.bat if you're 
on an older version of Windows.

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


Re: help

2021-12-09 Thread Igor Korot
Hi,

On Thu, Dec 9, 2021 at 10:31 AM smita  wrote:
>
>
>
>I am not able to open python on my laptop plzz help

What do you mean by saying "open python"?

Thank you.

>
>
>
>Sent from [1]Mail for Windows
>
>
>
> References
>
>Visible links
>1. https://go.microsoft.com/fwlink/?LinkId=550986
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help

2021-12-09 Thread Mats Wichmann

On 12/9/21 03:39, smita wrote:
 


I am not able to open python on my laptop plzz help


You're going to have to provide some details.


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


Re: HELP - uninstall pyton error

2021-10-11 Thread Michel

give more details

OS, Python Version, Method of installation.. etc..


On 10/7/21 17:18, Almadar Plus wrote:

Could you please help me uninstall python?
see attached screenshots files
Regards

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


Re: HELP - uninstall pyton error

2021-10-08 Thread Mats Wichmann

On 10/7/21 10:18, Almadar Plus wrote:

Could you please help me uninstall python?
see attached screenshots files
Regards



the list doesn't pass on screenshots, so we see nothing.

you'll need to describe your problem.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help me split a string into elements

2021-09-04 Thread Neil
DFS  wrote:
> Typical cases:
>  lines = [('one\ntwo\nthree\n')]
>  print(str(lines[0]).splitlines())
>  ['one', 'two', 'three']
> 
>  lines = [('one two three\n')]
>  print(str(lines[0]).split())
>  ['one', 'two', 'three']
> 
> 
> That's the result I'm wanting, but I get data in a slightly different 
> format:
> 
> lines = [('one\ntwo\nthree\n',)]
> 
> Note the comma after the string data, but inside the paren. 
> splitlines() doesn't work on it:
> 
> print(str(lines[0]).splitlines())
> ["('one\\ntwo\\nthree\\n',)"]
> 
> 
> I've banged my head enough - can someone spot an easy fix?
> 
> Thanks

lines[0][0].splitlines()

(You have a list containing a tuple containing the string you want to
split up.)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help me split a string into elements

2021-09-04 Thread DFS

On 9/4/2021 5:55 PM, DFS wrote:

Typical cases:
  lines = [('one\ntwo\nthree\n')]
  print(str(lines[0]).splitlines())
  ['one', 'two', 'three']

  lines = [('one two three\n')]
  print(str(lines[0]).split())
  ['one', 'two', 'three']


That's the result I'm wanting, but I get data in a slightly different 
format:


lines = [('one\ntwo\nthree\n',)]

Note the comma after the string data, but inside the paren. splitlines() 
doesn't work on it:


print(str(lines[0]).splitlines())
["('one\\ntwo\\nthree\\n',)"]


I've banged my head enough - can someone spot an easy fix?

Thanks



I got it:

lines = [('one\ntwo\nthree\n',)]
print(str(lines[0][0]).splitlines())
['one', 'two', 'three']

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


Re: help me please. "install reppy"

2021-07-23 Thread Jack DeVries
See here for a discussion around this issue:
https://github.com/seomoz/reppy/issues/90

This project requires a C++ build environment to be setup on your computer.
The fact that your compiler is reporting that `std=c++11` as an unknown
option shows that you don't have a C++ build environment set up. As you
will see, at the end of the issue above, they link to this issue:

https://github.com/Benny-/Yahoo-ticker-symbol-downloader/issues/46

In that second issue, a user reports:
> hey all. I solved the issue by installing Build tools for visual c++ 2015
(v14). The link does not work.
> You have to look for build tools for visual studio 2017 (v15) and look at
the options in the installer.

As a side note, you might consider using this robots.txt parser from the
standard library instead. It's already installed and ready to go, and
doesn't use very-overkill C++ dependencies!

Good luck!


On Thu, Jul 22, 2021 at 8:44 PM たこしたこし  wrote:

> I get an error so please help.
> I don't know what to do.
>
> Windows 10
> Python 3.9.6
>
> from takashi in Japan
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help me please. "install reppy"

2021-07-23 Thread Jack DeVries
Oops, forgot the link to the standard library robots.txt parser. Here are
the docs!


https://docs.python.org/3/library/urllib.robotparser.html

*sorry for the noise*

On Thu, Jul 22, 2021 at 11:34 PM Jack DeVries 
wrote:

> See here for a discussion around this issue:
> https://github.com/seomoz/reppy/issues/90
>
> This project requires a C++ build environment to be setup on your
> computer. The fact that your compiler is reporting that `std=c++11` as an
> unknown option shows that you don't have a C++ build environment set up. As
> you will see, at the end of the issue above, they link to this issue:
>
> https://github.com/Benny-/Yahoo-ticker-symbol-downloader/issues/46
>
> In that second issue, a user reports:
> > hey all. I solved the issue by installing Build tools for visual c++
> 2015 (v14). The link does not work.
> > You have to look for build tools for visual studio 2017 (v15) and look
> at the options in the installer.
>
> As a side note, you might consider using this robots.txt parser from the
> standard library instead. It's already installed and ready to go, and
> doesn't use very-overkill C++ dependencies!
>
> Good luck!
>
>
> On Thu, Jul 22, 2021 at 8:44 PM たこしたこし  wrote:
>
>> I get an error so please help.
>> I don't know what to do.
>>
>> Windows 10
>> Python 3.9.6
>>
>> from takashi in Japan
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with gaussian filter from scipy

2021-07-07 Thread Ben Bacarisse
Arak Rachael  writes:

> On Wednesday, 7 July 2021 at 12:47:40 UTC+2, Arak Rachael wrote:
>> On Wednesday, 7 July 2021 at 12:41:44 UTC+2, Ben Bacarisse wrote: 
>> > Arak Rachael  writes: 
>> > 
>> > > this time I am stuck on gaussian_filter scipy returns none instead of 
>> > > some valid gaussian filtered image, can someone help me please. 
>> > > 
>> > > Here is the full code: 
>> > > https://www.dropbox.com/s/18ylpiwmhlu5n62/test_filter_xdog.ipynb?dl=0 
>> > It might help to link to the code itself so people can look at it 
>> > without having to load up a project. 
>> > 
>> > -- 
>> > Ben.
>> Sorry I don't have this option. 
>> 
>> I loaded it in PyCharm and this is what I got: 
>> 
>> /home/yordan/anaconda3/envs/testing/bin/python 
>> /home/yordan/pycharm/plugins/python-ce/helpers/pydev/pydevd.py --multiproc 
>> --qt-support=auto --client 127.0.0.1 --port 36321 --file 
>> /home/yordan/devel/python.assignments/topgis-viz/topgisviz/xdog.py 
>> Connected to pydev debugger (build 211.7442.45) 
>> Usage: python xdog.py FILE OUTPUT 
>> 
>> I tried creating "'./textures/hatch.jpg" image, but it did not work.
>
> Sorry for taking your time, this turns to be a dum question, I needed
> to supply in file and out file in the command line.

No worries. Sometimes just posting the question make you look at it
differently. If you can post code, it's much better to do that.  Had it
been a little bit more obscure a problem, someone might have spotted it
but they may not have wanted to load a project file.

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


Re: Help with gaussian filter from scipy

2021-07-07 Thread Arak Rachael
On Wednesday, 7 July 2021 at 12:47:40 UTC+2, Arak Rachael wrote:
> On Wednesday, 7 July 2021 at 12:41:44 UTC+2, Ben Bacarisse wrote: 
> > Arak Rachael  writes: 
> > 
> > > this time I am stuck on gaussian_filter scipy returns none instead of 
> > > some valid gaussian filtered image, can someone help me please. 
> > > 
> > > Here is the full code: 
> > > https://www.dropbox.com/s/18ylpiwmhlu5n62/test_filter_xdog.ipynb?dl=0 
> > It might help to link to the code itself so people can look at it 
> > without having to load up a project. 
> > 
> > -- 
> > Ben.
> Sorry I don't have this option. 
> 
> I loaded it in PyCharm and this is what I got: 
> 
> /home/yordan/anaconda3/envs/testing/bin/python 
> /home/yordan/pycharm/plugins/python-ce/helpers/pydev/pydevd.py --multiproc 
> --qt-support=auto --client 127.0.0.1 --port 36321 --file 
> /home/yordan/devel/python.assignments/topgis-viz/topgisviz/xdog.py 
> Connected to pydev debugger (build 211.7442.45) 
> Usage: python xdog.py FILE OUTPUT 
> 
> I tried creating "'./textures/hatch.jpg" image, but it did not work.

Sorry for taking your time, this turns to be a dum question, I needed to supply 
in file and out file in the command line.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with gaussian filter from scipy

2021-07-07 Thread Ben Bacarisse
Arak Rachael  writes:

> this time I am stuck on gaussian_filter scipy returns none instead of some 
> valid gaussian filtered image, can someone help me please.
>
> Here is the full code:
> https://www.dropbox.com/s/18ylpiwmhlu5n62/test_filter_xdog.ipynb?dl=0

It might help to link to the code itself so people can look at it
without having to load up a project.

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


Re: Help with gaussian filter from scipy

2021-07-07 Thread Arak Rachael
On Wednesday, 7 July 2021 at 12:41:44 UTC+2, Ben Bacarisse wrote:
> Arak Rachael  writes: 
> 
> > this time I am stuck on gaussian_filter scipy returns none instead of some 
> > valid gaussian filtered image, can someone help me please. 
> > 
> > Here is the full code: 
> > https://www.dropbox.com/s/18ylpiwmhlu5n62/test_filter_xdog.ipynb?dl=0
> It might help to link to the code itself so people can look at it 
> without having to load up a project. 
> 
> -- 
> Ben.
Sorry I don't have this option.

I loaded it in PyCharm and this is what I got:

/home/yordan/anaconda3/envs/testing/bin/python 
/home/yordan/pycharm/plugins/python-ce/helpers/pydev/pydevd.py --multiproc 
--qt-support=auto --client 127.0.0.1 --port 36321 --file 
/home/yordan/devel/python.assignments/topgis-viz/topgisviz/xdog.py
Connected to pydev debugger (build 211.7442.45)
Usage: python xdog.py FILE OUTPUT

I tried creating "'./textures/hatch.jpg" image, but it did not work.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python circular error

2021-06-16 Thread Arak Rachael
On Tuesday, 15 June 2021 at 19:30:28 UTC+2, Chris Angelico wrote:
> On Wed, Jun 16, 2021 at 3:17 AM MRAB  wrote: 
> > 
> > On 2021-06-15 17:49, Chris Angelico wrote: 
> > > On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael  
> > > wrote: 
> > >>
> > >> Hi to everyone, 
> > >> 
> > >> I am having a problem with this error, I created a package and uploaded 
> > >> it to Test PyPi, but I can not get it to work, can someone help me 
> > >> please? 
> > >> 
> > >> https://test.pypi.org/manage/project/videotesting/releases/' 
> > >> 
> > >> The error: 
> > >> 
> > >> /home/user/anaconda3/envs/testing/bin/python 
> > >> /home/user/devel/python.assignments/topgis-viz/topgis-test.py 
> > >> Traceback (most recent call last): 
> > >> File "/home/user/devel/python.assignments/topgis-viz/topgis-test.py", 
> > >> line 10, in  
> > >> from videotesting import downsample_and_save_npz 
> > >> File 
> > >> "/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py",
> > >>  line 7, in  
> > >> from videotesting import extract_video 
> > >> ImportError: cannot import name 'extract_video' from partially 
> > >> initialized module 'videotesting' (most likely due to a circular import) 
> > >> (/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py)
> > >>  
> > >> 
> > >
> > > Hard to diagnose without the source code, but I'm thinking that your 
> > > __init__.py is probably trying to import from elsewhere in the 
> > > package? If so, try "from . import extract_video" instead. 
> > > 
> > Well, the traceback says that videotesting/__init__.py has: 
> > from videotesting import extract_video 
> > 
> > so it is trying to import from itself during initialisation.
> Yes, but what we can't tell is what the intention is. It could be 
> trying to import from its own package (in which case my suggestion 
> would be correct), or it could be trying to import from something 
> completely different (in which case the solution is to rename 
> something to avoid the conflict). Or it could be something else 
> entirely. 
> 
> ChrisA
Thanks all!


I have __init__.py in the create and uploaded package and I have __init_.py in 
the new package, which is not ready yet. Its 2 projects, but I am using project 
1 into project 2.

Here is the first package as a .zip
https://www.dropbox.com/s/lkz0qf4mq9afpaz/video-testing-package1.zip?dl=0

Here is the second project in which I try to use the first one:
https://www.dropbox.com/s/sxjpip23619fven/topgis-viz-package2.zip?dl=0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python circular error

2021-06-16 Thread Arak Rachael
On Wednesday, 16 June 2021 at 10:32:50 UTC+2, Arak Rachael wrote:
> On Tuesday, 15 June 2021 at 19:30:28 UTC+2, Chris Angelico wrote: 
> > On Wed, Jun 16, 2021 at 3:17 AM MRAB  wrote: 
> > > 
> > > On 2021-06-15 17:49, Chris Angelico wrote: 
> > > > On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael  
> > > > wrote: 
> > > >> 
> > > >> Hi to everyone, 
> > > >> 
> > > >> I am having a problem with this error, I created a package and 
> > > >> uploaded it to Test PyPi, but I can not get it to work, can someone 
> > > >> help me please? 
> > > >> 
> > > >> https://test.pypi.org/manage/project/videotesting/releases/' 
> > > >> 
> > > >> The error: 
> > > >> 
> > > >> /home/user/anaconda3/envs/testing/bin/python 
> > > >> /home/user/devel/python.assignments/topgis-viz/topgis-test.py 
> > > >> Traceback (most recent call last): 
> > > >> File "/home/user/devel/python.assignments/topgis-viz/topgis-test.py", 
> > > >> line 10, in  
> > > >> from videotesting import downsample_and_save_npz 
> > > >> File 
> > > >> "/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py",
> > > >>  line 7, in  
> > > >> from videotesting import extract_video 
> > > >> ImportError: cannot import name 'extract_video' from partially 
> > > >> initialized module 'videotesting' (most likely due to a circular 
> > > >> import) 
> > > >> (/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py)
> > > >>  
> > > >> 
> > > > 
> > > > Hard to diagnose without the source code, but I'm thinking that your 
> > > > __init__.py is probably trying to import from elsewhere in the 
> > > > package? If so, try "from . import extract_video" instead. 
> > > > 
> > > Well, the traceback says that videotesting/__init__.py has: 
> > > from videotesting import extract_video 
> > > 
> > > so it is trying to import from itself during initialisation. 
> > Yes, but what we can't tell is what the intention is. It could be 
> > trying to import from its own package (in which case my suggestion 
> > would be correct), or it could be trying to import from something 
> > completely different (in which case the solution is to rename 
> > something to avoid the conflict). Or it could be something else 
> > entirely. 
> > 
> > ChrisA
> Thanks all! 
> 
> 
> I have __init__.py in the create and uploaded package and I have __init_.py 
> in the new package, which is not ready yet. Its 2 projects, but I am using 
> project 1 into project 2. 
> 
> Here is the first package as a .zip 
> https://www.dropbox.com/s/lkz0qf4mq9afpaz/video-testing-package1.zip?dl=0 
> 
> Here is the second project in which I try to use the first one: 
> https://www.dropbox.com/s/sxjpip23619fven/topgis-viz-package2.zip?dl=0

The problems were 2:

1. This has to be in __init__.py:

import pipreqs
import cv2
import numpy
import os
import PIL
#import videotesting
from .videotest import extract_video
from .videotest import resize_and_grayscale
from .videotest import add_progress_bar
from .videotest import downsample_and_save_npz

the dots before videotest are critical

2. The module is named videotest as the file videotest.py, not videotesting
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python circular error

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 3:17 AM MRAB  wrote:
>
> On 2021-06-15 17:49, Chris Angelico wrote:
> > On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael  
> > wrote:
> >>
> >> Hi to everyone,
> >>
> >> I am having a problem with this error, I created a package and uploaded it 
> >> to Test PyPi, but I can not get it to work, can someone help me please?
> >>
> >> https://test.pypi.org/manage/project/videotesting/releases/'
> >>
> >> The error:
> >>
> >> /home/user/anaconda3/envs/testing/bin/python 
> >> /home/user/devel/python.assignments/topgis-viz/topgis-test.py
> >> Traceback (most recent call last):
> >>   File "/home/user/devel/python.assignments/topgis-viz/topgis-test.py", 
> >> line 10, in 
> >> from videotesting import downsample_and_save_npz
> >>   File 
> >> "/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py",
> >>  line 7, in 
> >> from videotesting import extract_video
> >> ImportError: cannot import name 'extract_video' from partially initialized 
> >> module 'videotesting' (most likely due to a circular import) 
> >> (/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py)
> >>
> >
> > Hard to diagnose without the source code, but I'm thinking that your
> > __init__.py is probably trying to import from elsewhere in the
> > package? If so, try "from . import extract_video" instead.
> >
> Well, the traceback says that videotesting/__init__.py has:
>  from videotesting import extract_video
>
> so it is trying to import from itself during initialisation.

Yes, but what we can't tell is what the intention is. It could be
trying to import from its own package (in which case my suggestion
would be correct), or it could be trying to import from something
completely different (in which case the solution is to rename
something to avoid the conflict). Or it could be something else
entirely.

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


Re: Help with Python circular error

2021-06-15 Thread MRAB

On 2021-06-15 17:49, Chris Angelico wrote:

On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael  wrote:


Hi to everyone,

I am having a problem with this error, I created a package and uploaded it to 
Test PyPi, but I can not get it to work, can someone help me please?

https://test.pypi.org/manage/project/videotesting/releases/'

The error:

/home/user/anaconda3/envs/testing/bin/python 
/home/user/devel/python.assignments/topgis-viz/topgis-test.py
Traceback (most recent call last):
  File "/home/user/devel/python.assignments/topgis-viz/topgis-test.py", line 10, in 

from videotesting import downsample_and_save_npz
  File 
"/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py",
 line 7, in 
from videotesting import extract_video
ImportError: cannot import name 'extract_video' from partially initialized 
module 'videotesting' (most likely due to a circular import) 
(/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py)



Hard to diagnose without the source code, but I'm thinking that your
__init__.py is probably trying to import from elsewhere in the
package? If so, try "from . import extract_video" instead.


Well, the traceback says that videotesting/__init__.py has:
from videotesting import extract_video

so it is trying to import from itself during initialisation.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python circular error

2021-06-15 Thread Chris Angelico
On Wed, Jun 16, 2021 at 2:45 AM Arak Rachael  wrote:
>
> Hi to everyone,
>
> I am having a problem with this error, I created a package and uploaded it to 
> Test PyPi, but I can not get it to work, can someone help me please?
>
> https://test.pypi.org/manage/project/videotesting/releases/'
>
> The error:
>
> /home/user/anaconda3/envs/testing/bin/python 
> /home/user/devel/python.assignments/topgis-viz/topgis-test.py
> Traceback (most recent call last):
>   File "/home/user/devel/python.assignments/topgis-viz/topgis-test.py", line 
> 10, in 
> from videotesting import downsample_and_save_npz
>   File 
> "/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py",
>  line 7, in 
> from videotesting import extract_video
> ImportError: cannot import name 'extract_video' from partially initialized 
> module 'videotesting' (most likely due to a circular import) 
> (/home/user/anaconda3/envs/testing/lib/python3.8/site-packages/videotesting/__init__.py)
>

Hard to diagnose without the source code, but I'm thinking that your
__init__.py is probably trying to import from elsewhere in the
package? If so, try "from . import extract_video" instead.

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


Re: HELP Please, Python Program Help

2021-04-10 Thread dn via Python-list
On 10/04/2021 22.57, Joseph Roffey wrote:
> Hi, Im looking for some help with my program, I have been set a task to make 
> a Strain Calculator. I need it to input two numbers, choosing either Metres 
> or Inches for the 'Change in Length' divided by the 'Original Length' which 
> can also be in Metres or Inches, the out put number also needs to give an 
> option for the answer to be in metres or inches.
> 
> this is what i have come up with so far...

What is the problem?


> txt = "Strain Calculator"
> x = txt.title()

what is the above/


> print(x)
> 
> # This function divides two numbers
> def divide(x, y):
>   return x / y

Why use a function instead of operating in-line?

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help Please

2021-03-28 Thread D'Arcy Cain

On 2021-03-26 12:42 p.m., Igor Korot wrote:

On top of that - usual stanza applies:

1. OS - Windows, Linux, Mac?
2. OS version?
3. Python version?
4. Are you able to run python interpretor?
5. Socks version you are trying to install?
6. Was install successful?


7. Use a subject that describes the actual issue.

--
D'Arcy J.M. Cain
Vybe Networks Inc.
A unit of Excelsior Solutions Corporation - Propelling Business Forward
http://www.VybeNetworks.com/
IM:da...@vybenetworks.com VoIP: sip:da...@vybenetworks.com
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help Please

2021-03-26 Thread Igor Korot
Hi,

On Fri, Mar 26, 2021 at 11:36 AM Anis4Games  wrote:

> Hello python support team , i need help about packages and python modules
>
> That Video Will Explain My Problem
>

Please don't send any attachment to the list - it will be dropped from the
E-mail.

Cut'n'paste any errors you receive directly in the body of the message.

On top of that - usual stanza applies:

1. OS - Windows, Linux, Mac?
2. OS version?
3. Python version?
4. Are you able to run python interpretor?
5. Socks version you are trying to install?
6. Was install successful?

Thank you.


> The Problem : Is Im Installed [Socks] Alredy With Command => pip install
> socks
>
> But When i run some script using socks pack its show a error with message "
> import socks " no socks modules found
>
> So Please Help Me
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help

2021-01-26 Thread Ethan Furman

On 1/26/21 9:05 AM, Terry Reedy wrote:

On 1/26/2021 4:01 AM, Maziar Ghasemi wrote:



...


Please do not repost, especially the same day.


Maziar Ghasemi appears to be a new user, and had to sign up to the Python List mailing list.  Are you seeing his request 
twice because you use gmane?


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


Re: help

2021-01-26 Thread Terry Reedy

On 1/26/2021 4:01 AM, Maziar Ghasemi wrote:

Hi
help me to repair this erorr:
Warning: translation file 'git_en_US' could not be loaded.
Using default.
and download python39.dll


Please do not repost, especially the same day.


On 1/26/21, Maziar Ghasemi  wrote:

Hi
help me to repair this erorr:
Warning: translation file 'git_en_US' could not be loaded.
Using default.
and download python39.dll


You ran some python software that wants a missing translation file.  Ask 
the help forum for that software.


If you ran Eric IDE, perhaps
https://tracker.die-offenbachs.homelinux.org/eric/issue293
will help.  I found this by searching the web (google) for 'git_en_us'.

--
Terry Jan Reedy

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


Re: help

2021-01-26 Thread Maziar Ghasemi
Hi
help me to repair this erorr:
Warning: translation file 'git_en_US' could not be loaded.
Using default.
and download python39.dll

On 1/26/21, Maziar Ghasemi  wrote:
> Hi
> help me to repair this erorr:
> Warning: translation file 'git_en_US' could not be loaded.
> Using default.
> and download python39.dll
> --
> mazyar ghasemi
> MS student of Razi university
>


-- 
mazyar ghasemi
MS student of Razi university
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help

2021-01-01 Thread Eryk Sun
On 1/1/21, Sibylle Koczian  wrote:
>
> But that doesn't help, if the script raises an exception. In that case
> the input() call won't be reached and the window will close anyway
> before you could see anything. And in a script with errors that's even
> worse. Same effect with the "run" window.

The simplest, best option is running the script from an existing shell
that owns the console session.  That said, here are a couple
alternatives to calling input() in a `finally` block.

If you have .py files associated with the py launcher, for testing you
can use a shebang such as `#!/usr/bin/python3 -i`. The "-i" option
enters interactive mode after executing the script, even if there's an
unhandled Python exception.

Entering interactive mode won't work if the process crashes at a low
level. To handle that, you can instead spawn a child process in the
console session that waits forever. A good candidate is "waitfor.exe",
which opens a mailslot and waits for it to be signaled. For example:

import subprocess
subprocess.Popen('waitfor.exe ever')

This process will still be attached to the console session after
Python exits. You can kill it by closing the console window, or by
running `waitfor.exe /si ever` to signal it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help

2021-01-01 Thread Sibylle Koczian

Am 31.12.2020 um 18:06 schrieb Mats Wichmann:
What you're doing is going to give you probably unexpected results 
anyway. Here's why:  (when it's set up properly) when clicking from 
explorer Windows will create a window to run the Python interpreter in, 
and when your script finishes, Python quits. Windows will take that as a 
clue that the window is no longer needed, and it will be discarded. This 
will usually have the visual effect of a window flashing onto the screen 
and then vanishing, as if things were broken, but they're not.  Only a 
Python script that is written to manage a display window, is going to 
stay around. An old is to add an input() call at the end of your script, 
so it waits for you to hit the enter key before finishing, and that will 
leave the window open)


But that doesn't help, if the script raises an exception. In that case 
the input() call won't be reached and the window will close anyway 
before you could see anything. And in a script with errors that's even 
worse. Same effect with the "run" window.



Either run your scripts from a command shell...

It's really bad that Windows doesn't put links to the command shell on 
the desktop and into the task bar on installation.


Or use an editor or IDE that has an integrated way to run your programs 
there in the editor's environment - here the IDE manages the windows so 
you don't get the opens-then-closes effect.


Hope this helps.




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


Re: help

2020-12-31 Thread Mats Wichmann

On 12/31/20 8:11 AM, BearGod777 wrote:

i am trying to open it by just left clicking the file in file explorer and
i tried right clicking it and then pressing open with python 3.9.1 64-bit


That *shouldn't* open the installer... (you can actually remove the 
installer file once you're done installing, it can maybe reduce some 
confusion).


What you're doing is going to give you probably unexpected results 
anyway. Here's why:  (when it's set up properly) when clicking from 
explorer Windows will create a window to run the Python interpreter in, 
and when your script finishes, Python quits. Windows will take that as a 
clue that the window is no longer needed, and it will be discarded. This 
will usually have the visual effect of a window flashing onto the screen 
and then vanishing, as if things were broken, but they're not.  Only a 
Python script that is written to manage a display window, is going to 
stay around. An old is to add an input() call at the end of your script, 
so it waits for you to hit the enter key before finishing, and that will 
leave the window open)


Either run your scripts from a command shell...

Or use an editor or IDE that has an integrated way to run your programs 
there in the editor's environment - here the IDE manages the windows so 
you don't get the opens-then-closes effect.


Hope this helps.

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


Re: help

2020-12-31 Thread BearGod777
i am trying to open it by just left clicking the file in file explorer and
i tried right clicking it and then pressing open with python 3.9.1 64-bit

On Thu, 31 Dec 2020 at 00:52, Mats Wichmann  wrote:

> On 12/30/20 2:14 PM, BearGod777 wrote:
> > every time i try and open a .py file it just ciomes up with either
> modify,
> > uninstall or repair. i have tried every single one of these and i have
> > tried to install another version (it couldnt run on that version) and it
> > just doesnt load up. if i try and open a new file it works but if i try
> and
> > open a file that my friend made it just comes up with those options.
> please
> > help
>
> you're rerunning the installer, don't do that.
>
> that sounds rude. but isn't meant to be.  somehow in recent times, the
> installer program - whose job it is indeed to install, uninstall, repair
> - is getting picked up by Windows when you try to run Python in certain
> ways - the installer should certainly not be getting associated with .py
> files as the way to run them. It might help diagnose how this happens if
> you describe what you're doing ("try and open a .py file" doesn't say
> enough, how are you trying to open it?)
>
> open a command shell (cmd.exe or powershell) and run your script foo.py
> with "py foo.py", assuming you chose to install the Python Launcher,
> which you should do if using the Python that comes from python.org.
>
>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help

2020-12-30 Thread Mats Wichmann

On 12/30/20 2:14 PM, BearGod777 wrote:

every time i try and open a .py file it just ciomes up with either modify,
uninstall or repair. i have tried every single one of these and i have
tried to install another version (it couldnt run on that version) and it
just doesnt load up. if i try and open a new file it works but if i try and
open a file that my friend made it just comes up with those options. please
help


you're rerunning the installer, don't do that.

that sounds rude. but isn't meant to be.  somehow in recent times, the 
installer program - whose job it is indeed to install, uninstall, repair 
- is getting picked up by Windows when you try to run Python in certain 
ways - the installer should certainly not be getting associated with .py 
files as the way to run them. It might help diagnose how this happens if 
you describe what you're doing ("try and open a .py file" doesn't say 
enough, how are you trying to open it?)


open a command shell (cmd.exe or powershell) and run your script foo.py 
with "py foo.py", assuming you chose to install the Python Launcher, 
which you should do if using the Python that comes from python.org.




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


Re: help

2020-12-30 Thread Igor Korot
Hi,

On Wed, Dec 30, 2020 at 4:40 PM BearGod777  wrote:
>
> every time i try and open a .py file

How are you trying to open the py file?
Also - I presume you are using Windows 10 + latest version of python, right?

Thank you.

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


Re: help(list[int]) → TypeError

2020-12-04 Thread Paul Bryan
Thanks, will bring it to the dev list.

On Fri, 2020-12-04 at 07:07 -0800, Julio Di Egidio wrote:
> On Thursday, 3 December 2020 at 19:28:19 UTC+1, Paul Bryan wrote:
> > Is this the correct behavior? 
> > 
> > Python 3.9.0 (default, Oct 7 2020, 23:09:01) 
> > [GCC 10.2.0] on linux 
> > Type "help", "copyright", "credits" or "license" for more
> > information. 
> > > > > help(list[int]) 
> > Traceback (most recent call last): 
> > File "", line 1, in  
> > File "/usr/lib/python3.9/_sitebuiltins.py", line 103, in __call__ 
> > return pydoc.help(*args, **kwds) 
> > File "/usr/lib/python3.9/pydoc.py", line 2001, in __call__ 
> > self.help(request) 
> > File "/usr/lib/python3.9/pydoc.py", line 2060, in help 
> > else: doc(request, 'Help on %s:', output=self._output) 
> > File "/usr/lib/python3.9/pydoc.py", line 1779, in doc 
> > pager(render_doc(thing, title, forceload)) 
> > File "/usr/lib/python3.9/pydoc.py", line 1772, in render_doc 
> > return title % desc + '\n\n' + renderer.document(object, name) 
> > File "/usr/lib/python3.9/pydoc.py", line 473, in document 
> > if inspect.isclass(object): return self.docclass(*args) 
> > File "/usr/lib/python3.9/pydoc.py", line 1343, in docclass 
> > (str(cls.__name__) for cls in type.__subclasses__(object) 
> > TypeError: descriptor '__subclasses__' for 'type' objects doesn't
> > apply to a 'types.GenericAlias' object 
> > > > > 
> > 
> > I would have expected the output to the identical to help(list).
> 
> As I get it from the docs (*), these new generics still only work in
> type hinting contexts,
> and I'd rather have expected a more useful error message: but,
> whether that is temporary
> (possibly a plain bug, as in a forgotten case) or, instead, just "how
> things are", I wouldn't
> know... might be a good question for Python developers.
> 
> (*) As in this one for a starter, but see also PEP 585:
> "*In type annotations* you can now use ...", my emphasis.
>  >
> 
> Julio

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


Re: help(list[int]) → TypeError

2020-12-04 Thread Julio Di Egidio
On Thursday, 3 December 2020 at 19:28:19 UTC+1, Paul Bryan wrote:
> Is this the correct behavior? 
> 
> Python 3.9.0 (default, Oct 7 2020, 23:09:01) 
> [GCC 10.2.0] on linux 
> Type "help", "copyright", "credits" or "license" for more information. 
> >>> help(list[int]) 
> Traceback (most recent call last): 
> File "", line 1, in  
> File "/usr/lib/python3.9/_sitebuiltins.py", line 103, in __call__ 
> return pydoc.help(*args, **kwds) 
> File "/usr/lib/python3.9/pydoc.py", line 2001, in __call__ 
> self.help(request) 
> File "/usr/lib/python3.9/pydoc.py", line 2060, in help 
> else: doc(request, 'Help on %s:', output=self._output) 
> File "/usr/lib/python3.9/pydoc.py", line 1779, in doc 
> pager(render_doc(thing, title, forceload)) 
> File "/usr/lib/python3.9/pydoc.py", line 1772, in render_doc 
> return title % desc + '\n\n' + renderer.document(object, name) 
> File "/usr/lib/python3.9/pydoc.py", line 473, in document 
> if inspect.isclass(object): return self.docclass(*args) 
> File "/usr/lib/python3.9/pydoc.py", line 1343, in docclass 
> (str(cls.__name__) for cls in type.__subclasses__(object) 
> TypeError: descriptor '__subclasses__' for 'type' objects doesn't apply to a 
> 'types.GenericAlias' object 
> >>> 
> 
> I would have expected the output to the identical to help(list).

As I get it from the docs (*), these new generics still only work in type 
hinting contexts,
and I'd rather have expected a more useful error message: but, whether that is 
temporary
(possibly a plain bug, as in a forgotten case) or, instead, just "how things 
are", I wouldn't
know... might be a good question for Python developers.

(*) As in this one for a starter, but see also PEP 585:
"*In type annotations* you can now use ...", my emphasis.


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


Re: Help

2020-11-03 Thread Grant Edwards
On 2020-11-04, Quentin Bock  wrote:
> So, I'm newer to Python and I'm messing around with math functions and
> multiplication, etc. here is my line of code:
>
> def multiply(numbers):
>   total = 1
>  for x in numbers:
>  total *= x
>  return total
> print(multiply((8, 2, 3, -1, 7)))
>
> When I run this, my answer is 8 but it should be 336 can some help ._.

1. If you're using tabs to indent; don't. It results in hard-to
   diagnose problems. Use spaces to indent.

2. Cut/past the exact code when asking questions. The code you
   posted does not print 8. It doesn't run at all:

$ cat bar.py
def multiply(numbers):
  total = 1
 for x in numbers:
 total *= x
 return total
print(multiply((8, 2, 3, -1, 7)))

$ python bar.py

  File "bar.py", line 3
for x in numbers:
^
IndentationError: unexpected indent

3. The answer you want is not 336, it's -336:

$ cat foo.py
def multiply(numbers):
total = 1
for x in numbers:
total *= x
return total

print(multiply((8,2,3,-1,7)))

$ python foo.py
-336

4. I suspect that your actual code looks like this:

$ cat foo.py
def multiply(numbers):
total = 1
for x in numbers:
total *= x
return total

print(multiply((8,2,3,-1,7)))

$ python foo.py
8

See the difference between #3 and #4?


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


Re: Help

2020-11-03 Thread Skip Montanaro
>
> When I run this, my answer is 8 but it should be 336 can some help ._.
>

Looks like you are returning from inside the loop.

Skip

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


Re: Help with the best practice to learn python

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

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


Re: Help with the best practice to learn python

2020-10-19 Thread dn via Python-list

On 20/10/2020 04:12, Azhar Ansari wrote:

Hello Python Community,
Kindly help me with the best practice to learn python.
Lots of material over net but its very confusing.



You are so right - it is very confusing!

Different people have different preferences for 'the best way to learn'. 
Also, we probably have widely-different reasons for wanting to learn 
Python, and/or what we plan to do with such skills 'afterwards'*.


Some people are keen on the (apparent) brevity of a 'code camp' approach 
- rapid learning under pressure, with a view to quickly acquiring the 
skills which will (supposedly) justify a job application. It is 
necessary though, to understand the difference between "job" and 
"career". At the other end of the scale, one can study at a university 
for three/four years.


Some take the simplistic approach of visiting YouTube's web-site and 
'clicking on' anything that looks-likely. I recommend a more structured 
approach that will 'cover the ground' in a logical learning-path, and 
with consistency.


As well as the Python Tutorial (mentioned elsewhere), @Alan over on the 
Python-Tutor discussion list*, also maintains something similar.


A good book or two will provide structure and coverage - again though, 
many texts aim in a particular direction, eg Data Science, which may/not 
suit your own interests/objectives.


I recommend on-line courses using reputable platforms such as Coursera 
and edX*, which can be attempted for $free, or to gain certification, 
paid. These are offered by various educational institutions and include 
discussion lists to enable trainees to 'compare notes' and discuss 
questions that will assist understanding (which a text book cannot do).



*
- most professionals understand that "continuing education" or 
'continual learning' is a feature of this business - there's no such 
thing as 'leaving school' knowing it all!
- the 'Tutor' list is an helpful environment for learners to ask 
questions which might seem 'simple' to professionals and 
skilled-practitioners: https://mail.python.org/mailman/listinfo/tutor

- I use the edX platform (for non-Python training)
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help with the best practice to learn python

2020-10-19 Thread Marco Sulla
The first time I started python I simply followed the official tutorial:

https://docs.python.org/3.9/tutorial/introduction.html

PS: Note that this is for Python 3.9. You can change the version in the
page if you have another one.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help! I broke python 3.9 installation on macOS

2020-10-09 Thread Chris Angelico
On Fri, Oct 9, 2020 at 9:11 PM Elliott Roper  wrote:
>
> On 9 Oct 2020 at 02:29:05 BST, "Richard Damon" 
> wrote:
>
> > On 10/8/20 7:31 PM, Elliott Roper wrote:
> >>  First problem: I can no longer say
> >>  Obfuscated@MyMac ~ % python3 pip -m list
> >
> > isn't that supposed to be python3 -m pip list
>
> Oh! (insert embarrassed grin here)
>
> Thank you, and Chris.
>

It's no shame to fail to spot things... we've all done it. Many times.
It's great to know that the solution was easy :)

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


Re: Help! I broke python 3.9 installation on macOS

2020-10-09 Thread Elliott Roper
On 9 Oct 2020 at 02:29:05 BST, "Richard Damon" 
wrote:

> On 10/8/20 7:31 PM, Elliott Roper wrote:
>>  First problem: I can no longer say
>>  Obfuscated@MyMac ~ % python3 pip -m list
> 
> isn't that supposed to be python3 -m pip list

Oh! (insert embarrassed grin here)

Thank you, and Chris.

-- 
To de-mung my e-mail address:- fsnospam$elliott$$
PGP Fingerprint: 1A96 3CF7 637F 896B C810  E199 7E5C A9E4 8E59 E248


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


Re: Help! I broke python 3.9 installation on macOS

2020-10-08 Thread Richard Damon
On 10/8/20 7:31 PM, Elliott Roper wrote:
> First problem: I can no longer say
> Obfuscated@MyMac ~ % python3 pip -m list

isn't that supposed to be python3 -m pip list


-- 
Richard Damon

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


Re: Help! I broke python 3.9 installation on macOS

2020-10-08 Thread Chris Angelico
On Fri, Oct 9, 2020 at 10:36 AM Elliott Roper  wrote:
>
> First problem: I can no longer say
> Obfuscated@MyMac ~ % python3 pip -m list
>
> It cries in pain with:
>
> /Library/Frameworks/Python.framework/Versions/3.9/bin/python3: can't open file
> '/Users/Obfuscated/pip': [Errno 2] No such file or directory.
> Why is it looking at my $HOME??
>

If that's an exact copy/paste from your terminal session, I may have
some good news for you: the solution is easy. Try "python3 -m pip
list" instead - putting the "-m" before "pip" instead of after it -
and see if that solves your problem :)

It's looking in your home directory because that's the current
directory. If you'd typed "python3 pip.py" with no other arguments,
it's more obvious that it should be reading that file from the current
directory.

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


Re: help with installation

2020-10-08 Thread MRAB

On 2020-10-08 17:28, Mats Wichmann wrote:

On 10/7/20 2:00 AM, rebecca kahn wrote:

Good morning.
I need to install numpy and matplotlib  for school. But everytime I run the 
comand i get a error on the metadata fase. Can you offer assistance?
Sincerely Rebecca Kahn

Microsoft Windows [Version 10.0.18362.1082]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Acer>python -m pip install numpy
Collecting numpy
  Using cached numpy-1.19.2.zip (7.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:


Short answer: be patient.

The root of this problem is Python 3.9 was *just* released, and some
(many?) of the packages on PyPI that include version-specific wheels
have not been updated yet.

Use a Python 3.8 version if you're in a hurry.  There is a site that has
unofficial builds of many interesting packages for Windows, but
personally I'm a little reluctant to point people there, as they're
unsupported if there are problems.

You can check the numpy status, as for any package on PyPI by searching
it and going to the list of downloadable files.  Here:

https://pypi.org/project/numpy/#files

Slightly longer description - why you see lots of scary error messages -
is since pip doesn't find an appropriate wheel, it embarks on the
process of building one from the source distribution.  This nearly
always fails for the ordinary Windows user, since the required build
setup will not be present, complete, or configured.  The errors come
from this, but that's only because the per-built wheel was not found.

(this happens every time a new Python version, that is X in 3.X comes out)


It's always worth looking at Christoph Gohlke's site:

https://www.lfd.uci.edu/~gohlke/pythonlibs/

Yes, it does have numpy and matplotlib.
--
https://mail.python.org/mailman/listinfo/python-list


Re: help with installation

2020-10-08 Thread Mats Wichmann
On 10/7/20 2:00 AM, rebecca kahn wrote:
> Good morning.
> I need to install numpy and matplotlib  for school. But everytime I run the 
> comand i get a error on the metadata fase. Can you offer assistance?
> Sincerely Rebecca Kahn
> 
> Microsoft Windows [Version 10.0.18362.1082]
> (c) 2019 Microsoft Corporation. Todos os direitos reservados.
> 
> C:\Users\Acer>python -m pip install numpy
> Collecting numpy
>   Using cached numpy-1.19.2.zip (7.3 MB)
>   Installing build dependencies ... done
>   Getting requirements to build wheel ... done
> Preparing wheel metadata ... error
> ERROR: Command errored out with exit status 1:

Short answer: be patient.

The root of this problem is Python 3.9 was *just* released, and some
(many?) of the packages on PyPI that include version-specific wheels
have not been updated yet.

Use a Python 3.8 version if you're in a hurry.  There is a site that has
unofficial builds of many interesting packages for Windows, but
personally I'm a little reluctant to point people there, as they're
unsupported if there are problems.

You can check the numpy status, as for any package on PyPI by searching
it and going to the list of downloadable files.  Here:

https://pypi.org/project/numpy/#files

Slightly longer description - why you see lots of scary error messages -
is since pip doesn't find an appropriate wheel, it embarks on the
process of building one from the source distribution.  This nearly
always fails for the ordinary Windows user, since the required build
setup will not be present, complete, or configured.  The errors come
from this, but that's only because the per-built wheel was not found.

(this happens every time a new Python version, that is X in 3.X comes out)

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


Re: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-19 Thread Mats Wichmann
On 7/18/20 5:02 PM, dn via Python-list wrote:

> - most docs seem to try to be 'all things to all people', whereas the
> differences between platforms inevitably make the writing complicated
> and the reading difficult to follow. Thus, consider separating entries
> by OpSys and/or installation method.

Like https://docs.python.org/3/using/index.html ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-18 Thread dn via Python-list

On 18/07/20 11:48 PM, Oscar Benjamin wrote:

On Sat, 18 Jul 2020 at 05:39, dn via Python-list  wrote:


On 18/07/20 3:29 PM, boB Stepp wrote:

On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list
 wrote:


On 18/07/20 1:53 PM, Castillo, Herbert S wrote:

I downloaded python not to long ago, and today when I opened Python on Windows 
it gave me a modify setup prompt. I have tried to click on modify , repair and 
even uninstalled and installed it back, but when I try to open Python up again, 
I keep on getting the same modify setup prompt. I am not sure of what to do? 
Thank you in advance.



Just for grins I just now glanced at the link dn provided.  Yes, this
is a very thorough, very accurate, very *technical* help resource.
But if I were a person who had never seen a shell, cmd.exe or
Powershell window, never programmed before, had no clue about how to
truly use my OS, etc., I don't think I would understand a bit of this
"help" document, and, at best, would find it very intimidating.  If
this community does wish to cater to those who are totally new to the
world of programming and learning how to really use their PC at any
depth, then I think a different approach or set of documents is
needed.  And an easier way for those playing with the idea of learning
programming and Python to connect with such documentation.


[snip]


There is also THE Python Tutorial - the opening action is two?three
pages 'in'. Is that suitably less-technical and more usable to a 'beginner'?
https://docs.python.org/3/tutorial/index.html


I would say that the official tutorial is not targeted at the total
novice. I think it used to be described as the tutorial for people
with experience of programming in other languages but I might be
misremembering.

The main python.org page links to a "beginners guide" well actually
there are two beginners guides...
https://www.python.org/

...


Certainly I don't see it if I go straight to the download pages:
https://www.python.org/downloads/
https://www.python.org/downloads/windows/

I think if I was new to programming or installing software in general
I would find all of this quite bewildering.

My experience of teaching total novice programmers is that you really
can't shirk the fundamental question: how should I install this thing
and start using it *before* I have any idea what I'm doing? Novices
don't need to be told that there are 100 ways to do it: they need to
be told exactly how to do it in a way that will work for them.

...

+1, well written!


For grins (as boB would say) I scanned Oracle's intro pages to Java 
programming (JDK), and they have a logical progression from installation 
instructions to "proving" the installation with the ubiquitous 
Hello-World first-program.


Whereas the MySQL web site requires one to select the appropriate 
download and then remember (!) to keep reading. Whereupon the manual 
offers advice about testing the server, etc.


Whereas those are decades old and well-established, in case of 
comparison the 'younger' MongoDB's documentation was more complicated. 
The installation of the server was not followed by a link to information 
about running the client, to be able to assure the system and understand 
the most basic (debugging?) linkage.



None of these are suited to the 'smart phone' world, where software is 
selected from an 'app store' and once installed, 'it just works'. Is 
that where these neophyte users' troubles start - a disconnect between 
such expectations and the Python reality?
(it's all very alien to my Linux world/memories of MS-Win .msi files 
with a check-box at the end which invited a start-up or display of 
suitable help files)


Yes, the observation that we have folk who are quite probably 
downloading a command-line program(me) for the first time in their 
lives, but is that a valid excuse?



What I've run out of time to compare-and-contrast is the advantage of 
pointing users at a Python-environment distribution, eg Anaconda. If 
'we' are less interested in caring for beginners and their basic needs, 
should we point them at others who are?



Observations (further to/underlining @Oscar's points):

- the requirements of a beginner installing for the first time (and 
maybe his/her first programming language) are totally different to 
someone wanting to install a new version of Python or on a new machine. 
(ie done-it-all-before/want it to be quick-and-easy/don't bother me with 
loads of docs)


- most docs seem to try to be 'all things to all people', whereas the 
differences between platforms inevitably make the writing complicated 
and the reading difficult to follow. Thus, consider separating entries 
by OpSys and/or installation method.


- a reference manual is not 'the place' for beginners, who require a 
more tutorial/hand-holding approach


- a beginners' installation tutorial should include a first program(me) 
and thus run through the command-line/editor/execute/REPL etc 
philosophies. This may be opening yet 

RE: help

2020-07-18 Thread Castillo, Herbert S
Thank you, boB! Yes, I kept on opening the installer. Your directions were 
great from memory, and I will look into the Python tutor mailing list. Thanks 
again.

Herbert

-Original Message-
From: boB Stepp  
Sent: Friday, July 17, 2020 7:43 PM
To: Castillo, Herbert S 
Cc: python-list@python.org
Subject: Re: help

On Fri, Jul 17, 2020 at 9:00 PM Castillo, Herbert S  
wrote:

> I downloaded python not to long ago, and today when I opened Python on 
> Windows it gave me a modify setup prompt. I have tried to click on modify , 
> repair and even uninstalled and installed it back, but when I try to open 
> Python up again, I keep on getting the same modify setup prompt. I am not 
> sure of what to do? Thank you in advance.

It sounds like you are just rerunning the python installer.  Instead, open a 
command prompt or Powershell and type "py".  That will bring up the Python 
interactive environment where you can type Python commands.
Or, probably better, open IDLE -- the provided Python editing environment -- by 
pressing your Windows key which brings up the list of available 
programs/program folders, find Python, expand that if needed by clicking on it 
and then clicking on "IDLE".  That will bring up the Python interactive prompt 
as well.  You can also create a new Python file using the provided "File" menu, 
etc.  BTW, I am doing this from memory.  I don't have a Windows PC handy, but 
hopefully it is enough to get you over the hump.

BTW, there is a Python Tutor mailing list designed for those learning Python.  
Also, the main Python website has documentation, lists of resources, tutorial, 
etc., to also help jumpstart your learning.  Have fun!

HTH!



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


Re: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-18 Thread Oscar Benjamin
On Sat, 18 Jul 2020 at 05:39, dn via Python-list  wrote:
>
> On 18/07/20 3:29 PM, boB Stepp wrote:
> > On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list
> >  wrote:
> >>
> >> On 18/07/20 1:53 PM, Castillo, Herbert S wrote:
> >>> I downloaded python not to long ago, and today when I opened Python on 
> >>> Windows it gave me a modify setup prompt. I have tried to click on modify 
> >>> , repair and even uninstalled and installed it back, but when I try to 
> >>> open Python up again, I keep on getting the same modify setup prompt. I 
> >>> am not sure of what to do? Thank you in advance.
> >>
> >>
> >> Regret that this mailing list does not support graphics attachments.
> >>
> >> Which part of https://docs.python.org/dev/using/windows.html failed?
> >
> > Just for grins I just now glanced at the link dn provided.  Yes, this
> > is a very thorough, very accurate, very *technical* help resource.
> > But if I were a person who had never seen a shell, cmd.exe or
> > Powershell window, never programmed before, had no clue about how to
> > truly use my OS, etc., I don't think I would understand a bit of this
> > "help" document, and, at best, would find it very intimidating.  If
> > this community does wish to cater to those who are totally new to the
> > world of programming and learning how to really use their PC at any
> > depth, then I think a different approach or set of documents is
> > needed.  And an easier way for those playing with the idea of learning
> > programming and Python to connect with such documentation.
> >
[snip]
>
> There is also THE Python Tutorial - the opening action is two?three
> pages 'in'. Is that suitably less-technical and more usable to a 'beginner'?
> https://docs.python.org/3/tutorial/index.html

I would say that the official tutorial is not targeted at the total
novice. I think it used to be described as the tutorial for people
with experience of programming in other languages but I might be
misremembering.

The main python.org page links to a "beginners guide" well actually
there are two beginners guides...
https://www.python.org/

Under "get started" there is a link to this beginners guide:
https://www.python.org/about/gettingstarted/

You can also hover over documentation and choose beginners guide to
get this one:
https://wiki.python.org/moin/BeginnersGuide

The former starts by asking whether you are new to programming and if
so suggests this page:
https://wiki.python.org/moin/BeginnersGuide/NonProgrammers

It also has an "installing" section which links to here:
https://wiki.python.org/moin/BeginnersGuide/Download

All of these have lots of information and many links to other pages.
I'm not sure how you'd find the page dn linked to which is at least
more direct about how to install:
https://docs.python.org/dev/using/windows.html

Certainly I don't see it if I go straight to the download pages:
https://www.python.org/downloads/
https://www.python.org/downloads/windows/

I think if I was new to programming or installing software in general
I would find all of this quite bewildering.

My experience of teaching total novice programmers is that you really
can't shirk the fundamental question: how should I install this thing
and start using it *before* I have any idea what I'm doing? Novices
don't need to be told that there are 100 ways to do it: they need to
be told exactly how to do it in a way that will work for them.

If I was writing the tutorial but aiming at total novices I would
probably begin by suggesting to use an online shell:
https://www.python.org/shell/

There could be a short guide there that explains very clearly how to
do simple commands in that online shell. At that point you are ready
to test the examples from page 3 of the official tutorial but I think
it is still not pitched at novices:
https://docs.python.org/3/tutorial/introduction.html

Then after a few examples and some familiarity it could be time to
suggest installing locally. That should be with a no nonsense
explanation that makes no reference to terminals, PATH, etc because
those are just intimidating distractions to a novice at that point in
time.

The sympy docs have a lot of room for improvement but one of the
things that is very useful for beginners there is the "Run code block
in sympy live" button which means that you can follow the
tutorial/docs and try things out before having anything installed
locally:
https://docs.sympy.org/latest/tutorial/intro.html#introduction

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


Re: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-17 Thread dn via Python-list

On 18/07/20 3:29 PM, boB Stepp wrote:

On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list
 wrote:


On 18/07/20 1:53 PM, Castillo, Herbert S wrote:

I downloaded python not to long ago, and today when I opened Python on Windows 
it gave me a modify setup prompt. I have tried to click on modify , repair and 
even uninstalled and installed it back, but when I try to open Python up again, 
I keep on getting the same modify setup prompt. I am not sure of what to do? 
Thank you in advance.



Regret that this mailing list does not support graphics attachments.

Which part of https://docs.python.org/dev/using/windows.html failed?


Just for grins I just now glanced at the link dn provided.  Yes, this
is a very thorough, very accurate, very *technical* help resource.
But if I were a person who had never seen a shell, cmd.exe or
Powershell window, never programmed before, had no clue about how to
truly use my OS, etc., I don't think I would understand a bit of this
"help" document, and, at best, would find it very intimidating.  If
this community does wish to cater to those who are totally new to the
world of programming and learning how to really use their PC at any
depth, then I think a different approach or set of documents is
needed.  And an easier way for those playing with the idea of learning
programming and Python to connect with such documentation.

I think that we take a lot for granted that is second nature to most
of us.  Also, most of us have the mindset that even when all of this
programming stuff was new to us (If we can even truly remember that
anymore.), we would have the problem-solving chops to get over these
hurdles.  Many don't have these native inclinations.  Searching online
for technical solutions is completely foreign to many.  Even searching
for anything may be more challenging than we suspect for some.

I am just a Python hobbyist/dabbler, not a pro like most of you, but I
have taught kids through adults various subjects in the past, helped
seniors, etc., and a lot of what we take for granted is *not* easy for
many.  But I believe that almost everyone that can get to the point of
believing that they can perhaps learn programming, can do so, but may
need some encouragement to get to that point of "self-belief".

Sure, some people are just too lazy and want to be spoon-fed, but I
truly believe that is a minority.  Can we make this easier for those
who really would like to try?

Just some thoughts that I hope will be constructively received.



There is also THE Python Tutorial - the opening action is two?three 
pages 'in'. Is that suitably less-technical and more usable to a 'beginner'?

https://docs.python.org/3/tutorial/index.html
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-17 Thread boB Stepp
On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list
 wrote:
>
> On 18/07/20 1:53 PM, Castillo, Herbert S wrote:
> > I downloaded python not to long ago, and today when I opened Python on 
> > Windows it gave me a modify setup prompt. I have tried to click on modify , 
> > repair and even uninstalled and installed it back, but when I try to open 
> > Python up again, I keep on getting the same modify setup prompt. I am not 
> > sure of what to do? Thank you in advance.
>
>
> Regret that this mailing list does not support graphics attachments.
>
> Which part of https://docs.python.org/dev/using/windows.html failed?

Just for grins I just now glanced at the link dn provided.  Yes, this
is a very thorough, very accurate, very *technical* help resource.
But if I were a person who had never seen a shell, cmd.exe or
Powershell window, never programmed before, had no clue about how to
truly use my OS, etc., I don't think I would understand a bit of this
"help" document, and, at best, would find it very intimidating.  If
this community does wish to cater to those who are totally new to the
world of programming and learning how to really use their PC at any
depth, then I think a different approach or set of documents is
needed.  And an easier way for those playing with the idea of learning
programming and Python to connect with such documentation.

I think that we take a lot for granted that is second nature to most
of us.  Also, most of us have the mindset that even when all of this
programming stuff was new to us (If we can even truly remember that
anymore.), we would have the problem-solving chops to get over these
hurdles.  Many don't have these native inclinations.  Searching online
for technical solutions is completely foreign to many.  Even searching
for anything may be more challenging than we suspect for some.

I am just a Python hobbyist/dabbler, not a pro like most of you, but I
have taught kids through adults various subjects in the past, helped
seniors, etc., and a lot of what we take for granted is *not* easy for
many.  But I believe that almost everyone that can get to the point of
believing that they can perhaps learn programming, can do so, but may
need some encouragement to get to that point of "self-belief".

Sure, some people are just too lazy and want to be spoon-fed, but I
truly believe that is a minority.  Can we make this easier for those
who really would like to try?

Just some thoughts that I hope will be constructively received.

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


Re: help

2020-07-17 Thread dn via Python-list

On 18/07/20 1:53 PM, Castillo, Herbert S wrote:

I downloaded python not to long ago, and today when I opened Python on Windows 
it gave me a modify setup prompt. I have tried to click on modify , repair and 
even uninstalled and installed it back, but when I try to open Python up again, 
I keep on getting the same modify setup prompt. I am not sure of what to do? 
Thank you in advance.



Regret that this mailing list does not support graphics attachments.

Which part of https://docs.python.org/dev/using/windows.html failed?
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: help

2020-07-17 Thread boB Stepp
On Fri, Jul 17, 2020 at 9:00 PM Castillo, Herbert S
 wrote:

> I downloaded python not to long ago, and today when I opened Python on 
> Windows it gave me a modify setup prompt. I have tried to click on modify , 
> repair and even uninstalled and installed it back, but when I try to open 
> Python up again, I keep on getting the same modify setup prompt. I am not 
> sure of what to do? Thank you in advance.

It sounds like you are just rerunning the python installer.  Instead,
open a command prompt or Powershell and type "py".  That will bring up
the Python interactive environment where you can type Python commands.
Or, probably better, open IDLE -- the provided Python editing
environment -- by pressing your Windows key which brings up the list
of available programs/program folders, find Python, expand that if
needed by clicking on it and then clicking on "IDLE".  That will bring
up the Python interactive prompt as well.  You can also create a new
Python file using the provided "File" menu, etc.  BTW, I am doing this
from memory.  I don't have a Windows PC handy, but hopefully it is
enough to get you over the hump.

BTW, there is a Python Tutor mailing list designed for those learning
Python.  Also, the main Python website has documentation, lists of
resources, tutorial, etc., to also help jumpstart your learning.  Have
fun!

HTH!



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


Re: Help with installation please

2020-05-17 Thread DL Neil via Python-list

On 18/05/20 10:52 AM, Oscar Benjamin wrote:

On Sun, 17 May 2020 at 15:21, Mats Wichmann  wrote:


On 5/15/20 9:47 PM, Souvik Dutta wrote:

I dont know if you should shift from powershell to cmd. Python kinda does
not work in powershell.


Powershell has a funky way of looking up programs, with the result that
you have to type the full name for many.

python.exe - should work, probably. maybe.

Using the Python Launcher helps: it works without extra games

py


If you install the Python from the Microsoft Store it will work more
"predicatably" - python, and python3, will work from both a cmd and a
powershell commandline.  on the other hand, you will have no Python
Launcher on such a setup.


I find the inconsistencies when it comes to "running Python" in a
terminal in different operating systems or environments very
frustrating. When teaching a class of 200 students who are new to
programming it is really important that you can give a simple
instruction that works. I'm yet to find that simple instruction for
the basic task of starting a Python interpreter.

I hope that one day we can get to a situation where once Python is
installed it can be run by typing "python" in whatever terminal you
want.
At last, someone who understands the problem when it is bigger than one 
person!


To be fair, the issue is caused by the likes of Microsoft and Apple 
deciding that they have 'the one true way'. However, wishing ain't going 
to make the problem go-away!


This question (and its predecessor: "how do I install") is asked so 
frequently it is obviously a major bug-bear. Yet, it is something I (and 
most others with Python experience) do from 'muscle-memory' and without 
thinking...


In the spirit of F/LOSS, if the previously-mentioned web-ref is not 
sufficient, and  you are able to outline simple instructions to start a 
DOS-box (or whatever they call it these days) and the equivalent on 
Apple (as relevant to your environment), that's probably the best we can 
do at the applications level - and we should use that to update/improve 
the docs...

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-17 Thread boB Stepp

On Sun, May 17, 2020 at 11:52:29PM +0100, Oscar Benjamin wrote:

I find the inconsistencies when it comes to "running Python" in a
terminal in different operating systems or environments very
frustrating. When teaching a class of 200 students who are new to
programming it is really important that you can give a simple
instruction that works. I'm yet to find that simple instruction for
the basic task of starting a Python interpreter.

I hope that one day we can get to a situation where once Python is
installed it can be run by typing "python" in whatever terminal you
want.


Amen!!!

--
Wishing you only the best,

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


Re: Help with installation please

2020-05-17 Thread Oscar Benjamin
On Sun, 17 May 2020 at 15:21, Mats Wichmann  wrote:
>
> On 5/15/20 9:47 PM, Souvik Dutta wrote:
> > I dont know if you should shift from powershell to cmd. Python kinda does
> > not work in powershell.
>
> Powershell has a funky way of looking up programs, with the result that
> you have to type the full name for many.
>
> python.exe - should work, probably. maybe.
>
> Using the Python Launcher helps: it works without extra games
>
> py
>
>
> If you install the Python from the Microsoft Store it will work more
> "predicatably" - python, and python3, will work from both a cmd and a
> powershell commandline.  on the other hand, you will have no Python
> Launcher on such a setup.

I find the inconsistencies when it comes to "running Python" in a
terminal in different operating systems or environments very
frustrating. When teaching a class of 200 students who are new to
programming it is really important that you can give a simple
instruction that works. I'm yet to find that simple instruction for
the basic task of starting a Python interpreter.

I hope that one day we can get to a situation where once Python is
installed it can be run by typing "python" in whatever terminal you
want.

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


Re: Help with installation please

2020-05-17 Thread Mats Wichmann
On 5/15/20 9:47 PM, Souvik Dutta wrote:
> I dont know if you should shift from powershell to cmd. Python kinda does
> not work in powershell.

Powershell has a funky way of looking up programs, with the result that
you have to type the full name for many.

python.exe - should work, probably. maybe.

Using the Python Launcher helps: it works without extra games

py


If you install the Python from the Microsoft Store it will work more
"predicatably" - python, and python3, will work from both a cmd and a
powershell commandline.  on the other hand, you will have no Python
Launcher on such a setup.



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


Re: Help with installation please

2020-05-15 Thread DL Neil via Python-list

On 15/05/20 4:18 PM, Jhoana Kacheva Melissa Joseph wrote:

Hello,

I downloaded python 3.8 in my windows, I selected the box for the path but
when I try to run it in powershell it brought me to app store to get it
again.



Please advise if the following reference is accurate, and works for you:
https://docs.python.org/3/using/windows.html
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-15 Thread Jhoana Kacheva Melissa Joseph
Ok, thanks Souvik. Appreciate your help.

On Fri, May 15, 2020, 11:47 PM Souvik Dutta  wrote:

> I dont know if you should shift from powershell to cmd. Python kinda does
> not work in powershell.
>
> Souvik flutter dev
>
> On Sat, May 16, 2020, 8:54 AM Jhoana Kacheva Melissa Joseph <
> kachev...@gmail.com> wrote:
>
>> 藍藍 but I still get the error in powershell. What should I do Souvik?
>>
>> On Fri, May 15, 2020, 11:20 PM Souvik Dutta 
>> wrote:
>>
>>> Then you will have to use python3 forever in your life (atleast as long
>>> as you don't change your os... 藍藍).
>>>
>>> On Sat, 16 May, 2020, 8:42 am Jhoana Kacheva Melissa Joseph, <
>>> kachev...@gmail.com> wrote:
>>>
 When I turn off the other one, it brought me to the store.

 Yes, I did the path

 On Fri, May 15, 2020, 11:01 PM Souvik Dutta 
 wrote:

> Have you switched off both the pythons? If so then switch on one off
> them and try. If it still doesn't work then switch on the previous one and
> off the other and try again.
>
> On Sat, 16 May, 2020, 8:29 am Souvik Dutta, 
> wrote:
>
>> Have you added python into path?
>>
>> On Sat, 16 May, 2020, 8:15 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> Thanks for the tip! Now that I turned it off. This is what it says.
>>>
>>> Please see attached
>>>
>>>
>>>
>>> On Fri, May 15, 2020, 9:10 PM Souvik Dutta 
>>> wrote:
>>>
 App execution aliases is not on store. Search it in the start menu.

 On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
 kachev...@gmail.com> wrote:

> Thanks for the tip! But there is nothing to unchecked.
>
> I typed python on powershell, once redirected to the app store I
> type app execution aliases in search bar, hit enter and I see this 
> picture
> attached. Am I missing something please ?
>
>
>
> On Fri, May 15, 2020, 7:59 PM Souvik Dutta <
> souvik.vik...@gmail.com> wrote:
>
>> Windows has a default python 3. that is not installed
>> but registered (which is as wierd as Microsoft). That is why you are
>> redirected everytime to the store. You might want to check app 
>> execution
>> aliases in the search bar an scroll down to find the two pythons and 
>> then
>> uncheck one of them to avoid future confusions.
>>
>> On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I downloaded python 3.8 in my windows, I selected the box for
>>> the path but
>>> when I try to run it in powershell it brought me to app store to
>>> get it
>>> again.
>>>
>>> Please let me know
>>>
>>> Thanks
>>> Melissa
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-15 Thread Souvik Dutta
I dont know if you should shift from powershell to cmd. Python kinda does
not work in powershell.

Souvik flutter dev

On Sat, May 16, 2020, 8:54 AM Jhoana Kacheva Melissa Joseph <
kachev...@gmail.com> wrote:

> 藍藍 but I still get the error in powershell. What should I do Souvik?
>
> On Fri, May 15, 2020, 11:20 PM Souvik Dutta 
> wrote:
>
>> Then you will have to use python3 forever in your life (atleast as long
>> as you don't change your os... 藍藍).
>>
>> On Sat, 16 May, 2020, 8:42 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> When I turn off the other one, it brought me to the store.
>>>
>>> Yes, I did the path
>>>
>>> On Fri, May 15, 2020, 11:01 PM Souvik Dutta 
>>> wrote:
>>>
 Have you switched off both the pythons? If so then switch on one off
 them and try. If it still doesn't work then switch on the previous one and
 off the other and try again.

 On Sat, 16 May, 2020, 8:29 am Souvik Dutta, 
 wrote:

> Have you added python into path?
>
> On Sat, 16 May, 2020, 8:15 am Jhoana Kacheva Melissa Joseph, <
> kachev...@gmail.com> wrote:
>
>> Thanks for the tip! Now that I turned it off. This is what it says.
>>
>> Please see attached
>>
>>
>>
>> On Fri, May 15, 2020, 9:10 PM Souvik Dutta 
>> wrote:
>>
>>> App execution aliases is not on store. Search it in the start menu.
>>>
>>> On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
>>> kachev...@gmail.com> wrote:
>>>
 Thanks for the tip! But there is nothing to unchecked.

 I typed python on powershell, once redirected to the app store I
 type app execution aliases in search bar, hit enter and I see this 
 picture
 attached. Am I missing something please ?



 On Fri, May 15, 2020, 7:59 PM Souvik Dutta 
 wrote:

> Windows has a default python 3. that is not installed
> but registered (which is as wierd as Microsoft). That is why you are
> redirected everytime to the store. You might want to check app 
> execution
> aliases in the search bar an scroll down to find the two pythons and 
> then
> uncheck one of them to avoid future confusions.
>
> On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
> kachev...@gmail.com> wrote:
>
>> Hello,
>>
>> I downloaded python 3.8 in my windows, I selected the box for the
>> path but
>> when I try to run it in powershell it brought me to app store to
>> get it
>> again.
>>
>> Please let me know
>>
>> Thanks
>> Melissa
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-15 Thread Jhoana Kacheva Melissa Joseph
藍藍 but I still get the error in powershell. What should I do Souvik?

On Fri, May 15, 2020, 11:20 PM Souvik Dutta  wrote:

> Then you will have to use python3 forever in your life (atleast as long as
> you don't change your os... 藍藍).
>
> On Sat, 16 May, 2020, 8:42 am Jhoana Kacheva Melissa Joseph, <
> kachev...@gmail.com> wrote:
>
>> When I turn off the other one, it brought me to the store.
>>
>> Yes, I did the path
>>
>> On Fri, May 15, 2020, 11:01 PM Souvik Dutta 
>> wrote:
>>
>>> Have you switched off both the pythons? If so then switch on one off
>>> them and try. If it still doesn't work then switch on the previous one and
>>> off the other and try again.
>>>
>>> On Sat, 16 May, 2020, 8:29 am Souvik Dutta, 
>>> wrote:
>>>
 Have you added python into path?

 On Sat, 16 May, 2020, 8:15 am Jhoana Kacheva Melissa Joseph, <
 kachev...@gmail.com> wrote:

> Thanks for the tip! Now that I turned it off. This is what it says.
>
> Please see attached
>
>
>
> On Fri, May 15, 2020, 9:10 PM Souvik Dutta 
> wrote:
>
>> App execution aliases is not on store. Search it in the start menu.
>>
>> On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> Thanks for the tip! But there is nothing to unchecked.
>>>
>>> I typed python on powershell, once redirected to the app store I
>>> type app execution aliases in search bar, hit enter and I see this 
>>> picture
>>> attached. Am I missing something please ?
>>>
>>>
>>>
>>> On Fri, May 15, 2020, 7:59 PM Souvik Dutta 
>>> wrote:
>>>
 Windows has a default python 3. that is not installed
 but registered (which is as wierd as Microsoft). That is why you are
 redirected everytime to the store. You might want to check app 
 execution
 aliases in the search bar an scroll down to find the two pythons and 
 then
 uncheck one of them to avoid future confusions.

 On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
 kachev...@gmail.com> wrote:

> Hello,
>
> I downloaded python 3.8 in my windows, I selected the box for the
> path but
> when I try to run it in powershell it brought me to app store to
> get it
> again.
>
> Please let me know
>
> Thanks
> Melissa
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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


Re: Help with installation please

2020-05-15 Thread Souvik Dutta
Then you will have to use python3 forever in your life (atleast as long as
you don't change your os... 藍藍).

On Sat, 16 May, 2020, 8:42 am Jhoana Kacheva Melissa Joseph, <
kachev...@gmail.com> wrote:

> When I turn off the other one, it brought me to the store.
>
> Yes, I did the path
>
> On Fri, May 15, 2020, 11:01 PM Souvik Dutta 
> wrote:
>
>> Have you switched off both the pythons? If so then switch on one off them
>> and try. If it still doesn't work then switch on the previous one and off
>> the other and try again.
>>
>> On Sat, 16 May, 2020, 8:29 am Souvik Dutta, 
>> wrote:
>>
>>> Have you added python into path?
>>>
>>> On Sat, 16 May, 2020, 8:15 am Jhoana Kacheva Melissa Joseph, <
>>> kachev...@gmail.com> wrote:
>>>
 Thanks for the tip! Now that I turned it off. This is what it says.

 Please see attached



 On Fri, May 15, 2020, 9:10 PM Souvik Dutta 
 wrote:

> App execution aliases is not on store. Search it in the start menu.
>
> On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
> kachev...@gmail.com> wrote:
>
>> Thanks for the tip! But there is nothing to unchecked.
>>
>> I typed python on powershell, once redirected to the app store I type
>> app execution aliases in search bar, hit enter and I see this picture
>> attached. Am I missing something please ?
>>
>>
>>
>> On Fri, May 15, 2020, 7:59 PM Souvik Dutta 
>> wrote:
>>
>>> Windows has a default python 3. that is not installed but
>>> registered (which is as wierd as Microsoft). That is why you are 
>>> redirected
>>> everytime to the store. You might want to check app execution aliases in
>>> the search bar an scroll down to find the two pythons and then uncheck 
>>> one
>>> of them to avoid future confusions.
>>>
>>> On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
>>> kachev...@gmail.com> wrote:
>>>
 Hello,

 I downloaded python 3.8 in my windows, I selected the box for the
 path but
 when I try to run it in powershell it brought me to app store to
 get it
 again.

 Please let me know

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

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


Re: Help with installation please

2020-05-15 Thread Jhoana Kacheva Melissa Joseph
When I turn off the other one, it brought me to the store.

Yes, I did the path

On Fri, May 15, 2020, 11:01 PM Souvik Dutta  wrote:

> Have you switched off both the pythons? If so then switch on one off them
> and try. If it still doesn't work then switch on the previous one and off
> the other and try again.
>
> On Sat, 16 May, 2020, 8:29 am Souvik Dutta, 
> wrote:
>
>> Have you added python into path?
>>
>> On Sat, 16 May, 2020, 8:15 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> Thanks for the tip! Now that I turned it off. This is what it says.
>>>
>>> Please see attached
>>>
>>>
>>>
>>> On Fri, May 15, 2020, 9:10 PM Souvik Dutta 
>>> wrote:
>>>
 App execution aliases is not on store. Search it in the start menu.

 On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
 kachev...@gmail.com> wrote:

> Thanks for the tip! But there is nothing to unchecked.
>
> I typed python on powershell, once redirected to the app store I type
> app execution aliases in search bar, hit enter and I see this picture
> attached. Am I missing something please ?
>
>
>
> On Fri, May 15, 2020, 7:59 PM Souvik Dutta 
> wrote:
>
>> Windows has a default python 3. that is not installed but
>> registered (which is as wierd as Microsoft). That is why you are 
>> redirected
>> everytime to the store. You might want to check app execution aliases in
>> the search bar an scroll down to find the two pythons and then uncheck 
>> one
>> of them to avoid future confusions.
>>
>> On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I downloaded python 3.8 in my windows, I selected the box for the
>>> path but
>>> when I try to run it in powershell it brought me to app store to get
>>> it
>>> again.
>>>
>>> Please let me know
>>>
>>> Thanks
>>> Melissa
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-15 Thread Souvik Dutta
Have you switched off both the pythons? If so then switch on one off them
and try. If it still doesn't work then switch on the previous one and off
the other and try again.

On Sat, 16 May, 2020, 8:29 am Souvik Dutta,  wrote:

> Have you added python into path?
>
> On Sat, 16 May, 2020, 8:15 am Jhoana Kacheva Melissa Joseph, <
> kachev...@gmail.com> wrote:
>
>> Thanks for the tip! Now that I turned it off. This is what it says.
>>
>> Please see attached
>>
>>
>>
>> On Fri, May 15, 2020, 9:10 PM Souvik Dutta 
>> wrote:
>>
>>> App execution aliases is not on store. Search it in the start menu.
>>>
>>> On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
>>> kachev...@gmail.com> wrote:
>>>
 Thanks for the tip! But there is nothing to unchecked.

 I typed python on powershell, once redirected to the app store I type
 app execution aliases in search bar, hit enter and I see this picture
 attached. Am I missing something please ?



 On Fri, May 15, 2020, 7:59 PM Souvik Dutta 
 wrote:

> Windows has a default python 3. that is not installed but
> registered (which is as wierd as Microsoft). That is why you are 
> redirected
> everytime to the store. You might want to check app execution aliases in
> the search bar an scroll down to find the two pythons and then uncheck one
> of them to avoid future confusions.
>
> On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
> kachev...@gmail.com> wrote:
>
>> Hello,
>>
>> I downloaded python 3.8 in my windows, I selected the box for the
>> path but
>> when I try to run it in powershell it brought me to app store to get
>> it
>> again.
>>
>> Please let me know
>>
>> Thanks
>> Melissa
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-15 Thread Souvik Dutta
Have you added python into path?

On Sat, 16 May, 2020, 8:15 am Jhoana Kacheva Melissa Joseph, <
kachev...@gmail.com> wrote:

> Thanks for the tip! Now that I turned it off. This is what it says.
>
> Please see attached
>
>
>
> On Fri, May 15, 2020, 9:10 PM Souvik Dutta 
> wrote:
>
>> App execution aliases is not on store. Search it in the start menu.
>>
>> On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> Thanks for the tip! But there is nothing to unchecked.
>>>
>>> I typed python on powershell, once redirected to the app store I type
>>> app execution aliases in search bar, hit enter and I see this picture
>>> attached. Am I missing something please ?
>>>
>>>
>>>
>>> On Fri, May 15, 2020, 7:59 PM Souvik Dutta 
>>> wrote:
>>>
 Windows has a default python 3. that is not installed but
 registered (which is as wierd as Microsoft). That is why you are redirected
 everytime to the store. You might want to check app execution aliases in
 the search bar an scroll down to find the two pythons and then uncheck one
 of them to avoid future confusions.

 On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
 kachev...@gmail.com> wrote:

> Hello,
>
> I downloaded python 3.8 in my windows, I selected the box for the path
> but
> when I try to run it in powershell it brought me to app store to get it
> again.
>
> Please let me know
>
> Thanks
> Melissa
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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


Re: Help with installation please

2020-05-15 Thread Souvik Dutta
App execution aliases is not on store. Search it in the start menu.

On Sat, 16 May, 2020, 6:27 am Jhoana Kacheva Melissa Joseph, <
kachev...@gmail.com> wrote:

> Thanks for the tip! But there is nothing to unchecked.
>
> I typed python on powershell, once redirected to the app store I type app
> execution aliases in search bar, hit enter and I see this picture attached.
> Am I missing something please ?
>
>
>
> On Fri, May 15, 2020, 7:59 PM Souvik Dutta 
> wrote:
>
>> Windows has a default python 3. that is not installed but
>> registered (which is as wierd as Microsoft). That is why you are redirected
>> everytime to the store. You might want to check app execution aliases in
>> the search bar an scroll down to find the two pythons and then uncheck one
>> of them to avoid future confusions.
>>
>> On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
>> kachev...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I downloaded python 3.8 in my windows, I selected the box for the path
>>> but
>>> when I try to run it in powershell it brought me to app store to get it
>>> again.
>>>
>>> Please let me know
>>>
>>> Thanks
>>> Melissa
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-15 Thread Souvik Dutta
Windows has a default python 3. that is not installed but
registered (which is as wierd as Microsoft). That is why you are redirected
everytime to the store. You might want to check app execution aliases in
the search bar an scroll down to find the two pythons and then uncheck one
of them to avoid future confusions.

On Sat, 16 May, 2020, 12:01 am Jhoana Kacheva Melissa Joseph, <
kachev...@gmail.com> wrote:

> Hello,
>
> I downloaded python 3.8 in my windows, I selected the box for the path but
> when I try to run it in powershell it brought me to app store to get it
> again.
>
> Please let me know
>
> Thanks
> Melissa
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with installation please

2020-05-15 Thread MRAB

On 2020-05-15 05:18, Jhoana Kacheva Melissa Joseph wrote:

Hello,

I downloaded python 3.8 in my windows, I selected the box for the path but
when I try to run it in powershell it brought me to app store to get it
again.


How are you running Python? What are you putting on the command line?

When I try:

python3

it takes me to the store.

The recommended way these days is to use the Python launcher.

py

That starts the default one for me.
--
https://mail.python.org/mailman/listinfo/python-list


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

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

That's what the Python Launcher is for... instead of always having to
get the path to python itself into the Windows path - and change it each
time the version bumps, since the path includes the version number -
"py" goes in your path in a place it's always found, so "py" from a
command prompt works, with options to select a specific Python if you
have several installed.  Bonus: "py" works from PowerShell as well
("python" tends not to).

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


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

2020-05-12 Thread Terry Reedy

On 5/11/2020 11:34 PM, Michael Torrie wrote:

On 5/11/20 9:25 PM, Michael Torrie wrote:

On 5/11/20 8:33 PM, Buddy Peacock wrote:

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


Unless you specifically selected "install for all users" it's probably
going to be installed to your home directory under the hidden folder
"AppData," specially "AppData\Local\Programs\Python."  Be sure to tell


In particular, C:\Users\Yourname\AppDate


the installer to put python in your path--that way no matter where it
is, from the command prompt you can just run "python" and it will fire
up the interpreter.  Additionally, "Idle" (the integrated development
environment) will probably be in your start menu.


There should also be a plain python icon in the Python3.8 group.  In any 
case,


>>> import sys; sys.executable
will give the path to the current python.exe.



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


That is the default for the python.org installer.


--
Terry Jan Reedy

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


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

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

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

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


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

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

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

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


Re: help me subcorrect

2020-04-11 Thread Souvik Dutta
Did you send a screenshot? If so then understand that this mailing list
does not support photos so you cannot send that. Try giving us a verbal
description. And if you write anything other that the sub then sorry that
is my Gmail's fault.

Souvik flutter dev

On Sat, Apr 11, 2020, 8:32 PM khuchee  wrote:

>
>
> Sent from Mail for Windows 10
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Chris Angelico
On Tue, Mar 31, 2020 at 8:20 AM Peter Otten <__pete...@web.de> wrote:
>
> Chris Angelico wrote:
> > but an awkward way to spell it. If you mean to call the original wrap
> > method, it would normally be spelled super().wrap(para) instead.
>
> Probably a workaround because super() cannot do its magic in the list
> comprehensions namespace. Another workaround is to define
>
> wrap = super().wrap
>
> and then use just wrap() in the listcomp.
>

Ah ha, I didn't think of that. And yes, I would agree, that's probably
the cleanest way. Alternatively, the longhand super(__class__, self)
should work too, as I believe __class__ isn't redefined by the
implicit closure.

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


Re: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Peter Otten
Chris Angelico wrote:

[Steve]

>>>def wrap(self, text):
>>>split_text = text.split('\n')
>>>lines = [line for para in split_text for line in 
textwrap.TextWrapper.wrap(self, para)]

[Dennis]
>> That... Looks rather incorrect.
>>
>> In most all list-comprehensions, the result item is on the left, 
and
>> the rest is the iteration clause... And why the (self, ...)? You 
inherited
>> from textwrap.TextWrapper, yet here you bypass the inherited to invoke 
the
>> wrap method (without instantiating it!).

> I think this is a reasonable thing to do, 

Indeed, Steve's trying to apply the superclass algo on every paragraph of 
the text.

> but an awkward way to spell it. If you mean to call the original wrap
> method, it would normally be spelled super().wrap(para) instead.

Probably a workaround because super() cannot do its magic in the list 
comprehensions namespace. Another workaround is to define

wrap = super().wrap

and then use just wrap() in the listcomp.

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


Re: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Chris Angelico
On Tue, Mar 31, 2020 at 3:53 AM Dennis Lee Bieber  wrote:
>
> On Sun, 29 Mar 2020 04:21:04 +, Steve Smith 
> declaimed the following:
>
> >I am having the same issue. I can either get the text to wrap, which makes 
> >all the text wrap, or I can get the text to ignore independent '/n' 
> >characters, so that all the blank space is removed. I'd like to set up my 
> >code, so that only 1 blank space is remaining (I'll settle for none at this 
> >point), an the text wraps up to 100 chars or so out per line. Does anyone 
> >have any thoughts on the attached code? And what I'm not doing correctly?
> >
> >
> >#import statements
> >import textwrap
> >import requests
> >from bs4 import BeautifulSoup
> >
> >#class extension of textwrapper
> >class DocumentWrapper(textwrap.TextWrapper):
> >
> >def wrap(self, text):
> >split_text = text.split('\n')
> >lines = [line for para in split_text for line in 
> > textwrap.TextWrapper.wrap(self, para)]
>
> That... Looks rather incorrect.
>
> In most all list-comprehensions, the result item is on the left, and
> the rest is the iteration clause... And why the (self, ...)? You inherited
> from textwrap.TextWrapper, yet here you bypass the inherited to invoke the
> wrap method (without instantiating it!).
>

I think this is a reasonable thing to do, but an awkward way to spell
it. If you mean to call the original wrap method, it would normally be
spelled super().wrap(para) instead.

Is that what you were intending, Steve?

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


Textwrapping with paragraphs, was RE: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Peter Otten
Steve Smith wrote:

> I am having the same issue. I can either get the text to wrap, which makes
> all the text wrap, or I can get the text to ignore independent '/n'
> characters, so that all the blank space is removed. I'd like to set up my
> code, so that only 1 blank space is remaining (I'll settle for none at
> this point), an the text wraps up to 100 chars or so out per line. Does
> anyone have any thoughts on the attached code? And what I'm not doing
> correctly?
> 
> 
> #import statements
> import textwrap
> import requests
> from bs4 import BeautifulSoup
> 
> #class extension of textwrapper
> class DocumentWrapper(textwrap.TextWrapper):
> 
> def wrap(self, text):
> split_text = text.split('\n')
> lines = [line for para in split_text for line in
> textwrap.TextWrapper.wrap(self, para)] return lines
> 
> #import statement of text.
> page = requests.get("http://classics.mit.edu/Aristotle/rhetoric.mb.txt;)
> soup = BeautifulSoup(page.text, "html.parser")
> 
> #instantiation of extension of textwrap.wrap.
> d = DocumentWrapper(width=110,initial_indent='',fix_sentence_endings=True
> ) new_string = d.fill(page.text)
> 
> #set up an optional variable, even attempted applying BOTH the extended
> #method and the original method to the issue... nothing has worked.
> #new_string_2 = textwrap.wrap(new_string,90)
> 
> #with loop with JUST the class extension of textwrapper.
> with open("Art_of_Rhetoric.txt", "w") as f:
> f.writelines(new_string)
> 
> #with loop with JUST the standard textwrapper.text method applied to it.
> with open("Art_of_Rhetoric2.txt", "w") as f:
> f.writelines(textwrap.wrap(page.text,90))

I think in your case the problem is that newlines in the source text do not
indicate paragraphs -- thus you should not keep them. Instead try 
interpreting empty lines as paragraph separators:

$ cat tmp.py
import sys
import textwrap
import itertools

import requests
from bs4 import BeautifulSoup


class DocumentWrapper(textwrap.TextWrapper):
def wrap(self, text):
paras = (
"".join(group) for non_empty, group in itertools.groupby(
text.splitlines(True),
key=lambda line: bool(line.strip())
) if non_empty
)
wrap = super().wrap
lines = [line for para in paras for line in wrap(para)]
return lines


page = requests.get("http://classics.mit.edu/Aristotle/rhetoric.mb.txt;).text

d = DocumentWrapper(width=110, initial_indent='', fix_sentence_endings=True)
new_string = d.fill(page)

sys.stdout.write(new_string)
$ python3 tmp.py | head -n10
Provided by The Internet Classics Archive.  See bottom for copyright.  
Available online at
http://classics.mit.edu//Aristotle/rhetoric.html
Rhetoric By Aristotle
Translated by W. Rhys Roberts
--
BOOK I
Part 1
Rhetoric is the counterpart of Dialectic.  Both alike are concerned with such 
things as come, more or less,
within the general ken of all men and belong to no definite science.  
Accordingly all men make use, more or
less, of both; for to a certain extent all men attempt to discuss statements 
and to maintain them, to defend
Traceback (most recent call last):
  File "tmp.py", line 27, in 
sys.stdout.write(new_string)
BrokenPipeError: [Errno 32] Broken pipe
$

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


  1   2   3   4   5   6   7   8   9   10   >