Re: Ask for help on using re

2021-08-06 Thread jak

Il 06/08/2021 12:57, Jach Feng ha scritto:

jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道:

Il 05/08/2021 11:40, Jach Feng ha scritto:

I want to distinguish between numbers with/without a dot attached:


text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
re.compile(r'ch \d{1,}[.]').findall(text)

['ch 1.', 'ch 23.']

re.compile(r'ch \d{1,}[^.]').findall(text)

['ch 23', 'ch 4 ', 'ch 56 ']

I can guess why the 'ch 23' appears in the second list. But how to get rid of 
it?

--Jach


import re
t = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
r = re.compile(r'(ch +\d+\.)|(ch +\d+)', re.M)

res = r.findall(t)

dot = [x[1] for x in res if x[1] != '']
udot = [x[0] for x in res if x[0] != '']

print(f"dot: {dot}")
print(f"undot: {udot}")

out:

dot: ['ch 4', 'ch 56']
undot: ['ch 1.', 'ch 23.']
r = re.compile(r'(ch +\d+\.)|(ch +\d+)', re.M)

That's an interest solution! Where the '|' operator in re.compile() was 
documented?

--Jach



I honestly can't tell you, I've been using it for over 30 years. In any
case you can find some traces of it in the "regular expressions quick
reference" on the site https://regex101.com (bottom right side).

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


Re: Ask for help on using re

2021-08-06 Thread Jon Ribbens via Python-list
On 2021-08-06, jak  wrote:
> Il 06/08/2021 16:17, jak ha scritto:
>> Il 06/08/2021 12:57, Jach Feng ha scritto:
>>> That's an interest solution! Where the '|' operator in re.compile() 
>>> was documented?
>> 
>> I honestly can't tell you, I've been using it for over 30 years. In any
>> case you can find some traces of it in the "regular expressions quick
>> reference" on the site https://regex101.com (bottom right side).
>
> ...if I'm not mistaken, the '|' it is part of normal regular
> expressions, so it is not a specific extension of the python libraries.
> Perhaps this is why you don't find any documentation on it.

The Python documentation fully describes the regular expression syntax
that the 're' module supports, including features that are widely
supported by different regular expression systems and also Python
extensions. '|' is documented here:
https://docs.python.org/3/library/re.html#index-13
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ask for help on using re

2021-08-06 Thread Jach Feng
jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道:
> Il 05/08/2021 11:40, Jach Feng ha scritto: 
> > I want to distinguish between numbers with/without a dot attached: 
> > 
>  text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' 
>  re.compile(r'ch \d{1,}[.]').findall(text) 
> > ['ch 1.', 'ch 23.'] 
>  re.compile(r'ch \d{1,}[^.]').findall(text) 
> > ['ch 23', 'ch 4 ', 'ch 56 '] 
> > 
> > I can guess why the 'ch 23' appears in the second list. But how to get rid 
> > of it? 
> > 
> > --Jach 
> >
> import re
> t = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
> r = re.compile(r'(ch +\d+\.)|(ch +\d+)', re.M) 
> 
> res = r.findall(t) 
> 
> dot = [x[1] for x in res if x[1] != ''] 
> udot = [x[0] for x in res if x[0] != ''] 
> 
> print(f"dot: {dot}") 
> print(f"undot: {udot}") 
> 
> out: 
> 
> dot: ['ch 4', 'ch 56'] 
> undot: ['ch 1.', 'ch 23.']
> r = re.compile(r'(ch +\d+\.)|(ch +\d+)', re.M) 
That's an interest solution! Where the '|' operator in re.compile() was 
documented?

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


Re: Ask for help on using re

2021-08-06 Thread jak

Il 06/08/2021 16:17, jak ha scritto:

Il 06/08/2021 12:57, Jach Feng ha scritto:

jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道:

Il 05/08/2021 11:40, Jach Feng ha scritto:

I want to distinguish between numbers with/without a dot attached:


text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
re.compile(r'ch \d{1,}[.]').findall(text)

['ch 1.', 'ch 23.']

re.compile(r'ch \d{1,}[^.]').findall(text)

['ch 23', 'ch 4 ', 'ch 56 ']

I can guess why the 'ch 23' appears in the second list. But how to 
get rid of it?


--Jach


import re
t = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
r = re.compile(r'(ch +\d+\.)|(ch +\d+)', re.M)

res = r.findall(t)

dot = [x[1] for x in res if x[1] != '']
udot = [x[0] for x in res if x[0] != '']

print(f"dot: {dot}")
print(f"undot: {udot}")

out:

dot: ['ch 4', 'ch 56']
undot: ['ch 1.', 'ch 23.']
r = re.compile(r'(ch +\d+\.)|(ch +\d+)', re.M)
That's an interest solution! Where the '|' operator in re.compile() 
was documented?


--Jach



I honestly can't tell you, I've been using it for over 30 years. In any
case you can find some traces of it in the "regular expressions quick
reference" on the site https://regex101.com (bottom right side).


...if I'm not mistaken, the '|' it is part of normal regular
expressions, so it is not a specific extension of the python libraries.
Perhaps this is why you don't find any documentation on it.

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


Re: Ask for help on using re

2021-08-06 Thread Jach Feng
ast 在 2021年8月5日 星期四下午11:29:15 [UTC+8] 的信中寫道:
> Le 05/08/2021 à 17:11, ast a écrit :
> > Le 05/08/2021 à 11:40, Jach Feng a écrit : 
> >> I want to distinguish between numbers with/without a dot attached: 
> >> 
> > text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' 
> > re.compile(r'ch \d{1,}[.]').findall(text) 
> >> ['ch 1.', 'ch 23.'] 
> > re.compile(r'ch \d{1,}[^.]').findall(text) 
> >> ['ch 23', 'ch 4 ', 'ch 56 '] 
> >> 
> >> I can guess why the 'ch 23' appears in the second list. But how to get 
> >> rid of it? 
> >> 
> >> --Jach 
> >> 
> > 
> > >>> import re 
> > 
> > >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' 
> > 
> > >>> re.findall(r'ch \d+\.', text) 
> > ['ch 1.', 'ch 23.'] 
> > 
> > >>> re.findall(r'ch \d+(?!\.)', text) # (?!\.) for negated look ahead 
> > ['ch 2', 'ch 4', 'ch 56']
> import regex 
> 
> # regex is more powerful that re
> >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
> >>> regex.findall(r'ch \d++(?!\.)', text) 
> 
> ['ch 4', 'ch 56'] 
> 
> ## ++ means "possessive", no backtrack is allowed
Can someone explain how the difference appear? I just can't figure it out:-(

>>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
>>> re.compile(r'ch \d+[^.]').findall(text)
['ch 23', 'ch 4 ', 'ch 56 ']
>>> re.compile(r'ch \d+[^.0-9]').findall(text)
['ch 4 ', 'ch 56 ']

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


Re: Ask for help on using re

2021-08-06 Thread jak

Il 05/08/2021 11:40, Jach Feng ha scritto:

I want to distinguish between numbers with/without a dot attached:


text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
re.compile(r'ch \d{1,}[.]').findall(text)

['ch 1.', 'ch 23.']

re.compile(r'ch \d{1,}[^.]').findall(text)

['ch 23', 'ch 4 ', 'ch 56 ']

I can guess why the 'ch 23' appears in the second list. But how to get rid of 
it?

--Jach



import re

t = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
r = re.compile(r'(ch +\d+\.)|(ch +\d+)', re.M)

res = r.findall(t)

dot = [x[1] for x in res if x[1] != '']
udot = [x[0] for x in res if x[0] != '']

print(f"dot:   {dot}")
print(f"undot: {udot}")

out:

dot:   ['ch 4', 'ch 56']
undot: ['ch 1.', 'ch 23.']
--
https://mail.python.org/mailman/listinfo/python-list


Re: Ask for help on using re

2021-08-06 Thread ast

Le 06/08/2021 à 02:57, Jach Feng a écrit :

ast 在 2021年8月5日 星期四下午11:29:15 [UTC+8] 的信中寫道:

Le 05/08/2021 à 17:11, ast a écrit :

Le 05/08/2021 à 11:40, Jach Feng a écrit :



import regex

# regex is more powerful that re

text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
regex.findall(r'ch \d++(?!\.)', text)


['ch 4', 'ch 56']

## ++ means "possessive", no backtrack is allowed



Can someone explain how the difference appear? I just can't figure it out:-(



+, *, ? are greedy, means they try to catch as many characters
as possible. But if the whole match doesn't work, they release
some characters once at a time and try the whole match again.
That's backtrack.
With ++, backtrack is not allowed. This works with module regex
and it is not implemented in module re

with string = "ch 23." and pattern = r"ch \d+\."

At first trial \d+  catch 23
but whole match will fail because next character is . and . is not 
allowed (\.)


A backtrack happens:

\d+  catch only 2
and the whole match is successful because the next char 3 is not .
But this is not what we want.

with ++, no backtrack, so no match
"ch 23." is rejected
this is what we wanted


Using re only, the best way is probably

re.findall(r"ch \d+(?![.0-9])", text)
['ch 4', 'ch 56']
--
https://mail.python.org/mailman/listinfo/python-list


[issue22240] argparse support for "python -m module" in help

2021-08-05 Thread Jakub Wilk


Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Ask for help on using re

2021-08-05 Thread ast

Le 05/08/2021 à 17:11, ast a écrit :

Le 05/08/2021 à 11:40, Jach Feng a écrit :

I want to distinguish between numbers with/without a dot attached:


text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
re.compile(r'ch \d{1,}[.]').findall(text)

['ch 1.', 'ch 23.']

re.compile(r'ch \d{1,}[^.]').findall(text)

['ch 23', 'ch 4 ', 'ch 56 ']

I can guess why the 'ch 23' appears in the second list. But how to get 
rid of it?


--Jach



 >>> import re

 >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'

 >>> re.findall(r'ch \d+\.', text)
['ch 1.', 'ch 23.']

 >>> re.findall(r'ch \d+(?!\.)', text)   # (?!\.) for negated look ahead
['ch 2', 'ch 4', 'ch 56']


import regex

# regex is more powerful that re

>>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'

>>> regex.findall(r'ch \d++(?!\.)', text)

['ch 4', 'ch 56']

## ++ means "possessive", no backtrack is allowed




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


Re: Ask for help on using re

2021-08-05 Thread ast

Le 05/08/2021 à 17:11, ast a écrit :

Le 05/08/2021 à 11:40, Jach Feng a écrit :

I want to distinguish between numbers with/without a dot attached:


text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
re.compile(r'ch \d{1,}[.]').findall(text)

['ch 1.', 'ch 23.']

re.compile(r'ch \d{1,}[^.]').findall(text)

['ch 23', 'ch 4 ', 'ch 56 ']

I can guess why the 'ch 23' appears in the second list. But how to get 
rid of it?


--Jach



 >>> import re

 >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'

 >>> re.findall(r'ch \d+\.', text)
['ch 1.', 'ch 23.']

 >>> re.findall(r'ch \d+(?!\.)', text)   # (?!\.) for negated look ahead
['ch 2', 'ch 4', 'ch 56']


ops ch2 is found. Wrong
--
https://mail.python.org/mailman/listinfo/python-list


Re: Ask for help on using re

2021-08-05 Thread Peter Pearson
On Thu, 5 Aug 2021 02:40:30 -0700 (PDT), Jach Feng  wrote:
  I want to distinguish between numbers with/without a dot attached:
 
 >>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
 >>> re.compile(r'ch \d{1,}[.]').findall(text)
  ['ch 1.', 'ch 23.']
 >>> re.compile(r'ch \d{1,}[^.]').findall(text)
  ['ch 23', 'ch 4 ', 'ch 56 ']
 
  I can guess why the 'ch 23' appears in the second list. But how to get
  rid of it?

>>> re.findall(r'ch \d+[^.0-9]', "ch 1. is ch 23. is ch 4 is ch 56 is ")
['ch 4 ', 'ch 56 ']

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ask for help on using re

2021-08-05 Thread ast

Le 05/08/2021 à 11:40, Jach Feng a écrit :

I want to distinguish between numbers with/without a dot attached:


text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
re.compile(r'ch \d{1,}[.]').findall(text)

['ch 1.', 'ch 23.']

re.compile(r'ch \d{1,}[^.]').findall(text)

['ch 23', 'ch 4 ', 'ch 56 ']

I can guess why the 'ch 23' appears in the second list. But how to get rid of 
it?

--Jach



>>> import re

>>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'

>>> re.findall(r'ch \d+\.', text)
['ch 1.', 'ch 23.']

>>> re.findall(r'ch \d+(?!\.)', text)   # (?!\.) for negated look ahead
['ch 2', 'ch 4', 'ch 56']
--
https://mail.python.org/mailman/listinfo/python-list


Re: Ask for help on using re

2021-08-05 Thread Neil
Jach Feng  wrote:
> I want to distinguish between numbers with/without a dot attached:
> 
 text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
 re.compile(r'ch \d{1,}[.]').findall(text)
> ['ch 1.', 'ch 23.']
 re.compile(r'ch \d{1,}[^.]').findall(text)
> ['ch 23', 'ch 4 ', 'ch 56 ']
> 
> I can guess why the 'ch 23' appears in the second list. But how to get rid of 
> it?
> 
> --Jach

Does

>>> re.findall(r'ch\s+\d+(?![.\d])',text)

do what you want?  This matches "ch", then any nonzero number of
whitespaces, then any nonzero number of digits, provided this is not
followed by a dot or another digit.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ask for help on using re

2021-08-05 Thread Jach Feng
Neil 在 2021年8月5日 星期四下午6:36:58 [UTC+8] 的信中寫道:
> Jach Feng  wrote: 
> > I want to distinguish between numbers with/without a dot attached: 
> > 
>  text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' 
>  re.compile(r'ch \d{1,}[.]').findall(text) 
> > ['ch 1.', 'ch 23.'] 
>  re.compile(r'ch \d{1,}[^.]').findall(text) 
> > ['ch 23', 'ch 4 ', 'ch 56 '] 
> > 
> > I can guess why the 'ch 23' appears in the second list. But how to get rid 
> > of it? 
> > 
> > --Jach
> Does 
> 
> >>> re.findall(r'ch\s+\d+(?![.\d])',text) 
> 
> do what you want? This matches "ch", then any nonzero number of 
> whitespaces, then any nonzero number of digits, provided this is not 
> followed by a dot or another digit.

Yes, the result is what I want. Thank you, Neil!

The solution is more complex than I expect. Have to digest it:-)

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


Ask for help on using re

2021-08-05 Thread Jach Feng
I want to distinguish between numbers with/without a dot attached:

>>> text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n'
>>> re.compile(r'ch \d{1,}[.]').findall(text)
['ch 1.', 'ch 23.']
>>> re.compile(r'ch \d{1,}[^.]').findall(text)
['ch 23', 'ch 4 ', 'ch 56 ']

I can guess why the 'ch 23' appears in the second list. But how to get rid of 
it?

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


[issue22240] argparse support for "python -m module" in help

2021-08-01 Thread Nick Coghlan


Nick Coghlan  added the comment:

(Note: this is an old enough ticket that it started out with patch files on the 
tracker rather than PRs on GitHub. That's just a historical artifact, so feel 
free to open a PR as described in the devguide if you would prefer to work that 
way)

There are two common ways of solving import bootstrapping problems that affect 
the build process:

1. Make the problematic import lazy, so it only affects the specific operation 
that needs the binary dependency; or
2. Wrap a try/except around the import, and do something reasonable in the 
failing case

However, I think in this case it should be possible to avoid the zipfile 
dependency entirely, and instead make the determination based on the contents 
of __main__ and __main__.__spec__ using the suggestions I noted in an earlier 
comment (see 
https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec 
for the info the module spec makes available).

This should also solve a problem I believe the current patch has, where I think 
directory execution will give the wrong result (returning "python -m __main__" 
as the answer instead of the path to the directory containing the __main__.py 
file).

The three cases to cover come from 
https://docs.python.org/3/using/cmdline.html#interface-options:

* if `__main__.__spec__` is None, the result should continue to be 
`_os.path.basename(_sys.argv[0])` (as it is in the patch)
* if `__main__.__spec__.name` is exactly the string "__main__", 
`__main__.__spec__.parent` is the empty string, and 
`__main__.__spec__.has_location` is true, and sys.argv[0] is equal to 
`__main__.__spec__.origin` with the trailing `__main__.py` removed, then we 
have a directory or zipfile path execution case, and the result should be a 
Python path execution command using f'{py} {arg0}
* otherwise, we have a `-m` invocation, using f'{py} -m 
{mod.__spec__.name.removesuffix(".__main__")}'


The patch gets the three potential results right, but it gets the check for the 
second case wrong by looking specifically for zipfiles instead of looking at 
the contents of __main__.__spec__ and seeing if it refers to a __main__.py file 
located inside the sys.argv[0] path (which may be a directory, zipfile, or any 
other valid sys.path entry).

For writing robust automated tests, I'd suggest either looking at 
test.support.script_helper for programmatic creation of executable zipfiles and 
directories ( 
https://github.com/python/cpython/blob/208a7e957b812ad3b3733791845447677a704f3e/Lib/test/support/script_helper.py#L209
 ) or else factoring the logic out such that there is a helper function that 
receives "__main__.__spec__" and "sys.argv[0]" as parameters, allowing the test 
suite to easily control them.

The latter approach would require some up front manual testing to ensure the 
behaviour of the different scenarios was being emulated correctly, but would 
execute a lot faster than actually running subprocesses would.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Fast help with Python program

2021-07-29 Thread Arak Rachael
Hi guys,

I need fast help with this, can you please look at it?

I don't get how to visualize on the 3 axis in the for cycle with the list of 
colors and count of colors that I get from my array.

And I also don't get how to cluster the colors based on how many colors there 
are in the second array from get_unique_colors(img).

https://www.dropbox.com/s/ifvecwb5c0iy2pa/test_scripts.py?dl=0

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


[issue22240] argparse support for "python -m module" in help

2021-07-23 Thread Nils Kattenbeck


Nils Kattenbeck  added the comment:

I expanded the patch from tebeka to also work with invocations like `python3 -m 
serial.tools.miniterm` where `miniterm.py` is a file and not a directory with a 
`__main__.py`. This was able to handle everything I threw at it.

However due to the import of zipfile which itself imports binascii the build of 
CPython itself fails at the `sharedmods` stage...


```text
 CC='gcc -pthread' LDSHARED='gcc -pthread -shared' OPT='-DNDEBUG -g -fwrapv 
-O3 -Wall'  _TCLTK_INCLUDES='' _TCLTK_LIBS=''   ./python -E ./setup.py  
build
Traceback (most recent call last):
  File "/home/septatrix/Documents/programming/cpython/./setup.py", line 3, in 

import argparse
^^^
  File "/home/septatrix/Documents/programming/cpython/Lib/argparse.py", line 
93, in 
from zipfile import is_zipfile as _is_zipfile
^
  File "/home/septatrix/Documents/programming/cpython/Lib/zipfile.py", line 6, 
in 
import binascii
^^^
ModuleNotFoundError: No module named 'binascii'
make: *** [Makefile:639: sharedmods] Error 1
```

I guess this is because binascii is a c module and not yet build at that point 
in time. Does anyone who knows more about the build system have an idea how to 
resolve this?

---

Resolving this bug would also allow the removal of several workarounds for this 
in the stdlib:

* 
https://github.com/python/cpython/blob/83d1430ee5b8008631e7f2a75447e740eed065c1/Lib/unittest/__main__.py#L4
* 
https://github.com/python/cpython/blob/83d1430ee5b8008631e7f2a75447e740eed065c1/Lib/json/tool.py#L19
* 
https://github.com/python/cpython/blob/83d1430ee5b8008631e7f2a75447e740eed065c1/Lib/venv/__init__.py#L426

--
Added file: https://bugs.python.org/file50174/patch.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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


help me please. "install reppy"

2021-07-22 Thread たこしたこし
I get an error so please help.
I don't know what to do.

Windows 10
Python 3.9.6

from takashi in Japan
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.

C:\Users\user>pip3 install reppy
Looking in indexes: https://pypi.python.org/simple/
Collecting reppy
  Using cached reppy-0.4.14.tar.gz (93 kB)
Requirement already satisfied: cachetools in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
reppy) (4.2.2)
Requirement already satisfied: python-dateutil!=2.0,>=1.5 in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
reppy) (2.8.1)
Requirement already satisfied: requests in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
reppy) (2.25.1)
Requirement already satisfied: six in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
reppy) (1.16.0)
Requirement already satisfied: idna<3,>=2.5 in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
requests->reppy) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
requests->reppy) (2021.5.30)
Requirement already satisfied: chardet<5,>=3.0.2 in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
requests->reppy) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in 
c:\users\user\appdata\local\programs\python\python39\lib\site-packages (from 
requests->reppy) (1.26.6)
Building wheels for collected packages: reppy
  Building wheel for reppy (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\appdata\local\programs\python\python39\python.exe' 
-u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = 
'"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-sjlk_02k\\reppy_2f114414e650471d8c3902d5b364a96c\\setup.py'"'"';
 
__file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-sjlk_02k\\reppy_2f114414e650471d8c3902d5b364a96c\\setup.py'"'"';f
 = getattr(tokenize, '"'"'open'"'"', open)(__file__) if 
os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; 
setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
bdist_wheel -d 'C:\Users\user\AppData\Local\Temp\pip-wheel-pcr61ilh'
   cwd: 
C:\Users\user\AppData\Local\Temp\pip-install-sjlk_02k\reppy_2f114414e650471d8c3902d5b364a96c\
  Complete output (69 lines):
  Building from C++
  
c:\users\user\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py:697:
 UserWarning: Usage of dash-separated 'description-file' will not be supported 
in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\reppy
  copying reppy\exceptions.py -> build\lib.win-amd64-3.9\reppy
  copying reppy\ttl.py -> build\lib.win-amd64-3.9\reppy
  copying reppy\util.py -> build\lib.win-amd64-3.9\reppy
  copying reppy\__init__.py -> build\lib.win-amd64-3.9\reppy
  creating build\lib.win-amd64-3.9\reppy\cache
  copying reppy\cache\policy.py -> build\lib.win-amd64-3.9\reppy\cache
  copying reppy\cache\__init__.py -> build\lib.win-amd64-3.9\reppy\cache
  running build_ext
  building 'reppy.robots' extension
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\reppy
  creating build\temp.win-amd64-3.9\Release\reppy\rep-cpp
  creating build\temp.win-amd64-3.9\Release\reppy\rep-cpp\deps
  creating build\temp.win-amd64-3.9\Release\reppy\rep-cpp\deps\url-cpp
  creating build\temp.win-amd64-3.9\Release\reppy\rep-cpp\deps\url-cpp\src
  creating build\temp.win-amd64-3.9\Release\reppy\rep-cpp\src
  C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c 
/nologo /Ox /W3 /GL /DNDEBUG /MD -Ireppy/rep-cpp/include 
-Ireppy/rep-cpp/deps/url-cpp/include 
-Ic:\users\user\appdata\local\programs\python\python39\include 
-Ic:\users\user\appdata\local\programs\python\python39\include -IC:\Program 
Files (x86)\Microsoft Visual 
Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program 
Files (x86)\Microsoft Visual 
Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files 
(x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows 
Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows 
Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows 
Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows 
Kits\10\include\10

[issue22240] argparse support for "python -m module" in help

2021-07-18 Thread Nils Kattenbeck


Nils Kattenbeck  added the comment:

I am not sure if the patch correctly handles calling a nested module (e.g. 
`python3 -m serial.tools.miniterm`). Would it also be possible to detect if 
python or python3 was used for the invocation?

--
nosy: +Nils Kattenbeck

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Zachary Ware


Change by Zachary Ware :


--
versions: +Python 3.6 -Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Zachary Ware


Zachary Ware  added the comment:

Even with 3.6 I get a different result:

```
Python 3.6.13 (tags/v3.6.13:aa73e1722e, Mar 23 2021, 15:45:49) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help(open('/dev/zero').writelines)
Help on built-in function writelines:

writelines(lines, /) method of _io.TextIOWrapper instance

```

This appears to be because TextIOWrapper.writelines just didn't have a 
docstring in 3.6.  I can't explain why `help` just gave you the repr of the 
method, though.

--
resolution: not a bug -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue44623>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Jonathan Fine


Jonathan Fine  added the comment:

I used my default Python, which is Python 3.6. However, with 3.7 and 3.8 I get 
the same as Paul.

So I'm closing this as 'not a bug' (as there's not an already-fixed option for 
closing).

--
resolution: works for me -> not a bug
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Zachary Ware


Zachary Ware  added the comment:

I also can't reproduce this with a fresh build of 3b5b99da4b on Linux.

--
nosy: +zach.ware
resolution:  -> works for me
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Paul Moore


Paul Moore  added the comment:

It does for me:

>>> help(open("nul").writelines)
Help on built-in function writelines:

writelines(lines, /) method of _io.TextIOWrapper instance
Write a list of lines to stream.

Line separators are not added, so it is usual for each of the
lines provided to have a line separator at the end.

This is Windows, Python 3.9. What version did you get the problem with? If it's 
older, I'd say the problem has likely since been fixed.

--
nosy: +paul.moore

___
Python tracker 
<https://bugs.python.org/issue44623>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Jonathan Fine


New submission from Jonathan Fine :

On Linux
>>> help(open('/dev/zero').writelines)
gives


However
https://docs.python.org/3/library/io.html#io.IOBase.writelines
gives

Write a list of lines to the stream. Line separators are not added, so it is 
usual for each of the lines provided to have a line separator at the end.

See also request that writelines support a line separator.
https://mail.python.org/archives/list/python-id...@python.org/thread/A5FT7SVZBYAJJTIWQFTFUGNSKMVQNPVF/#A5FT7SVZBYAJJTIWQFTFUGNSKMVQNPVF

--
assignee: docs@python
components: Documentation
messages: 397414
nosy: docs@python, jfine2358
priority: normal
severity: normal
status: open
title: help(open('/dev/zero').writelines) gives no help
type: enhancement
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue44623>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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


Help with gaussian filter from scipy

2021-07-07 Thread Arak Rachael
Hi guys,

thanks for the help in the past,

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
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue44574] IDLE: Implement or delete python-context-help.

2021-07-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I should check whether all other keybindings are implemented.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44574] IDLE: Implement or delete python-context-help.

2021-07-06 Thread Terry J. Reedy


New submission from Terry J. Reedy :

The config.IdleConf.GetCoreKeys keyBindings dict contains
   '<>': ['']
The was included in the initial version by Steven Gava, 9930061c, on 2001 Dec 
2.  So it appears in the Keys page of the config dialog, as noticed by Mondher 
on SO 
((https://stackoverflow.com/questions/68263769/idle-shell-context-documentation-broken)

The string does not appear elsewhere in idlelib, nor is the feature mentioned 
in the IDLE doc.  So it is unimplemented and undocumented.  Based on experience 
with other IDEs (Mathematica) Mondher suggests that one should be able to 
select a word and have it looked up in the index of the document opened by 
python-doc F1.  'Very useful' he says.

On Windows, F1 opens an offline Windows help window with the Python docs.  
Currently, modifier(s)-F1 is interpreted as F1 and the help window is opened.  
I presume a shift-F1 binding will override that. I also presume that an 
argument can be added to the Windows open-help command.

I don't know about online docs on other systems and don't think we can access 
indexes on opened python webpages.  Where shift-F1 does not work, a message 
should be displayed.

If we decided to not implement index search anywhere, the line in config.py 
should be removed.

--
assignee: terry.reedy
components: IDLE
messages: 397058
nosy: terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Implement or delete python-context-help.
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue44574>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44519] help(math.fabs)

2021-06-27 Thread David Lambert

David Lambert  added the comment:

Hi Ray,

I'm glad this was a conscious choice.  I found a person confused by the 
output of print(abs(3), math.fabs(3))

Perhaps the manual would mention return values->that's not an annotation.

Thanks for considering,

Dave

On 6/27/21 12:42 PM, Raymond Hettinger wrote:
> Raymond Hettinger  added the comment:
>
> Thanks for the suggestion but we've not adopted type annotations in the 
> documentation.
>
> --
> nosy: +rhettinger
> resolution:  -> rejected
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44519] help(math.fabs)

2021-06-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the suggestion but we've not adopted type annotations in the 
documentation.

--
nosy: +rhettinger
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44519] help(math.fabs)

2021-06-27 Thread David Lambert


New submission from David Lambert :

math.fabs returns float.
The documentation should say so, and help(math.fabs) should include the 
expected return type  -> float

fabs(x, /) -> float
Return the absolute value of the float x.

I did not check, but expect these annotations recommendations are pervasive 
throughout the python libraries.

--
assignee: docs@python
components: Documentation
messages: 396582
nosy: David Lambert, docs@python
priority: normal
severity: normal
status: open
title: help(math.fabs)
type: enhancement
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue44519>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43024] improve signature (in help, etc) for functions taking sentinel defaults

2021-06-17 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43024] improve signature (in help, etc) for functions taking sentinel defaults

2021-06-17 Thread Irit Katriel

Irit Katriel  added the comment:


New changeset eb0a6801bef4f68eebf6fdb2b7a32c32a5b6c983 by Miss Islington (bot) 
in branch '3.10':
bpo-43024: improve signature (in help, etc) for functions taking sent… 
(GH-24331) (GH-26773)
https://github.com/python/cpython/commit/eb0a6801bef4f68eebf6fdb2b7a32c32a5b6c983


--

___
Python tracker 
<https://bugs.python.org/issue43024>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43024] improve signature (in help, etc) for functions taking sentinel defaults

2021-06-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25359
pull_request: https://github.com/python/cpython/pull/26773

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43024] improve signature (in help, etc) for functions taking sentinel defaults

2021-06-17 Thread miss-islington

miss-islington  added the comment:


New changeset f73377d57c5272390de633c292c44689310a by Irit Katriel in 
branch 'main':
bpo-43024: improve signature (in help, etc) for functions taking sent… 
(GH-24331)
https://github.com/python/cpython/commit/f73377d57c5272390de633c292c44689310a


--
nosy: +miss-islington

___
Python tracker 
<https://bugs.python.org/issue43024>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43024] improve signature (in help, etc) for functions taking sentinel defaults

2021-06-17 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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


Help with Python circular error

2021-06-15 Thread Arak Rachael
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)


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


Help me in setting the path in python program.

2021-06-07 Thread Maheshwari Gorle
I am using Google co lab. 
Guide me how to set the path. 
# Error: SwissEph file 'se13681s.se1' not found in PATH '/usr/share/ephe/' is 
coming, how to overcome this problem.

pip install pyswisseph
import swisseph as swe
swe.set_ephe_path ('/usr/share/ephe') 
# set path to ephemeris files
jd = swe.julday(2008,3,21)
swe.calc_ut(jd, swe.AST_OFFSET+13681[0][0] 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue44227] help(bisect.bisect_left)

2021-06-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset b5cedd098043dc58ecf9c2f33774cd7646506a92 by Miss Islington (bot) 
in branch '3.10':
bpo-44227: Update bisect docstrings (GH-26548) (GH-26563)
https://github.com/python/cpython/commit/b5cedd098043dc58ecf9c2f33774cd7646506a92


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-06-06 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25152
pull_request: https://github.com/python/cpython/pull/26563

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37768] IDLE: Show help(object) output in a text viewer

2021-06-06 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +25150
pull_request: https://github.com/python/cpython/pull/26561

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-06-06 Thread PeterChu


Change by PeterChu :


--
nosy: +PeterChu
nosy_count: 2.0 -> 3.0
pull_requests: +25146
pull_request: https://github.com/python/cpython/pull/26548

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-04 Thread Jesse Silverman


Jesse Silverman  added the comment:

As Andre noted, it is good in IDLE.
I also realize how convenient it is to read the real docs from there.
I learned a lot about the state of console programming on Windows, in and out 
of Python, but I have no problem using IDLE when on Windows.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-04 Thread Andre Roberge


Andre Roberge  added the comment:

Terry: I just checked with Idle on Windows with Python 3.9.5 and the display 
works perfectly, with no incorrect characters.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Jesse or Andre, please test interactive help in IDLE as pydoc then knows that 
it is *not* talking to Windows console.  It then does not use more.com but 
prints the entire text at once.  It should send it 'as is' and should ignore 
the console language and encoding settings.  Use a Start menu icon or

> pyw -m idlelib

'py' works too.  It blocks, but displays the occasional tk/tkinter/IDLE error 
message as sys.__stderr__, etc, are the console stream instead of None.

Long output such as the 240 lines for COMPARISON is, by default, 'squeezed' to 
a little box.  Double click to expand or right click to move it to a separate 
window.

If there is still a problem with garbage in the text, we should try to fix it.

PS: one can select more than one Component, but Documentation usually refers to 
the content, not the means of displaying it.

--
nosy: +terry.reedy

___
Python tracker 
<https://bugs.python.org/issue44275>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Eryk Sun

Eryk Sun  added the comment:

> Now many people want to use Python with UTF-8 mode in PowerShell 
> in Windows Terminal. And they don't want to care about legacy 
> encoding at all.

Windows Terminal isn't relevant to the encoding issue. Applications interact 
with the console session to which they're attached, e.g. python.exe <-> 
condrv.sys <-> conhost.exe (openconsole.exe). It doesn't matter whether or not 
the console session is headless (conpty) and connected to another process via 
pipes (i.e. a console session created via CreatePseudoConsole and set for a 
child process via PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE). Some settings and 
behaviors do change in conpty mode (e.g. the session has virtual-terminal mode 
enabled by default), but the way encoding and decoding are implemented for 
ReadFile/ReadConsoleA and WriteFile/WriteConsoleA doesn't change.

There are still a lot of programs that read and write from the console as a 
regular file via ReadFile and WriteFile, so the fact that ReadFile is broken 
when the input code page is set to UTF-8 is relevant to most people. However, 
people who run `chcp 65001` in Western locales usually only care about being 
able to write non-ASCII UTF-8 via WriteFile. Reading non-ASCII UTF-8 from 
console input via ReadFile doesn't come up as a common problem, but it 
definitely is a problem. For example:

>>> s = os.read(0, 12)
Привет мир
>>> s
b'\x00\x00\x00\x00\x00\x00 \x00\x00\x00\r\n'

Thus I don't like 'solving' this mojibake issue by simply recommending that 
users set the console input codepage to UTF-8. I previously proposed two 
solutions. (1) a radical change to get full Unicode support: modify pydoc to 
temporarily change the console input codepage to UTF-8 and write the temp file 
as UTF-8. (2) a conservative change just to avoid mojibake: modify pydoc to 
query the console input codepage and write the file using that encoding, as 
always with the backslashreplace error handler.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Inada Naoki


Inada Naoki  added the comment:

>> PS > $OutputEncoding =  [System.Text.Encoding]::GetEncoding("UTF-8")

> FYI, $OutputEncoding in PowerShell has nothing to do with the python.exe and 
> more.com processes, nor the console session to which they're attached.

>> PS > [System.Console]::OutputEncoding = $OutputEncoding

> The console output code page is irrelevant since more.com writes 
> wide-character text via WriteConsoleW() and decodes the file using the 
> console input code page, GetConsoleCP(). The console output codepage from 
> GetConsoleOutputCP() isn't used for anything here.

Yes, both are unrelated to this specific issue. But both are highly recommended 
for using Python with UTF-8 mode.

Now many people want to use Python with UTF-8 mode in PowerShell in Windows 
Terminal. And they don't want to care about legacy encoding at all.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Jesse Silverman


Jesse Silverman  added the comment:

"more.com" uses the console input codepage to decode the file, so a workaround 
is to run `chcp.com 65001` and run Python in UTF-8 mode, e.g. `py -X utf8=1`. 
Since reading non-ASCII UTF-8 is broken, you'll have to switch back to the old 
input codepage if you need to enter non-ASCII characters in an app that reads 
from the console via ReadFile or ReadConsoleA.

Confirmed that this workaround done in Windows Terminal causes all mojibake to 
immediately evaporate, leaving me with the most readable and enjoyable 
more/console experience I have ever had since first hitting a spacebar on 
MS-DOS.
(Windows Terminal and the open-sourcing of the CONSOLE code is in a three-way 
tie with open-sourcing of .Net Core and the C++ STL for changing how I feel 
about Windows.  I keep finding new reasons to love it, except for reading 
non-ASCII UTF-8 being broken which I just learned about today.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Eryk Sun


Eryk Sun  added the comment:

> I was one of the people who mistakenly thought that Python 3 operating 
> in the new Windows Terminal was going to magically leave us sitting 
> happily in completely UTF-8 compatible territory on Windows, not 
> realizing the complex long-term dependencies and regressions that 
> still remain problematic.

Windows Terminal provides a tab-based UI that supports font fallback and 
complex scripts, which is a significant improvement over the builtin terminal 
that conhost.exe provides. Each tab is a headless (conpty) console session 
that's hosted by an instance of OpenConsole.exe. The latter is based on the 
same source tree as the system conhost.exe, but typically it's a more recent 
build. The console host is what implements most of the API for client 
applications. That the host is in headless mode and connected to an alternate 
terminal doesn't matter from the perspective of client applications.

The console has been Unicode (UCS-2) back to its initial release in 1993. 
Taking advantage of this requires reading and writing wide-character strings 
via ReadConsoleW and WriteConsoleW, as Python's does in 3.6+ (except not for 
os.read and os.write). Many console applications instead use encoded byte 
strings with ReadFile / ReadConsoleA and WriteFile / WriteConsoleA. Updating 
the console host to support UTF-8 for this has been a drawn-out process. It 
finally has full support for writing UTF-8 in Windows 10, including splitting a 
sequence across multiple writes. But reading non-ASCII UTF-8 is still broken.

"more.com" uses the console input codepage to decode the file, so a workaround 
is to run `chcp.com 65001` and run Python in UTF-8 mode, e.g. `py -X utf8=1`. 
Since reading non-ASCII UTF-8 is broken, you'll have to switch back to the old 
input codepage if you need to enter non-ASCII characters in an app that reads 
from the console via ReadFile or ReadConsoleA.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Jesse Silverman

Jesse Silverman  added the comment:

Thank you so much Inada and Eryk and Steve!

I was one of the people who mistakenly thought that Python 3 operating in the 
new Windows Terminal was going to magically leave us sitting happily in 
completely UTF-8 compatible territory on Windows, not realizing the complex 
long-term dependencies and regressions that still remain problematic.

I had spent a lot of time paying attention to the Python 2 vs. 3 debates with 
people shouting "I don't care about Unicode!" and mistook dedication to 
preventing regressions and breakages for a lesser appreciation of the value of 
UTF-8 support.  I have been schooled.  We all want the same thing, but getting 
there on Windows from where we are at the moment remains non-trivial.

Heartfelt appreciation to all on the front lines of dealing with this complex 
and sticky situation. ❤️❤️❤️

Also, much love to those who had put in the work to have much more help than I 
realized existed even when one finds oneself isolated on a single disconnected 
machine with only the standard docs as a guide吝 -- I didn't realize the pages I 
found mojibake on even existed until this weekend.

--

___
Python tracker 
<https://bugs.python.org/issue44275>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Steve Dower


Steve Dower  added the comment:

> If changing the console input codepage to UTF-8 fixes the mojibake problem, 
> then probably you're running Python in UTF-8 mode.

I forget where I saw them, but there are some places where we incorrectly use 
stdin encoding for writing to stdout (I suppose assuming that they'll always 
match). This may be being impacted by one of those.

--
assignee: docs@python -> 
versions: +Python 3.10, Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Eryk Sun

Eryk Sun  added the comment:

> PS > [System.Console]::InputEncoding = $OutputEncoding

If changing the console input codepage to UTF-8 fixes the mojibake problem, 
then probably you're running Python in UTF-8 mode. pydoc.tempfilepager() 
encodes the temporary file with the preferred encoding, which normally would 
not be UTF-8. There are possible variations in how your system and the console 
are configured, so I can't say for sure.

tempfilepager() could temporarily set the console's input codepage to UTF-8 via 
SetConsoleCP(65001). However, if python.exe is terminated or crashes before it 
can reset the codepage, the console will be left in a bad state. By bad state, 
I mean that leaving the input code page set to UTF-8 is broken. Legacy console 
applications rely on the input codepage for reading input via ReadFile() and 
ReadConsoleA(), but the console host (conhost.exe or openconsole.exe) doesn't 
support reading input as UTF-8. It simply replaces each non-ASCII character 
(i.e. characters that require 2-4 bytes as UTF-8) with a null byte, e.g. 
"abĀcd" is read as "ab\x00cd". 

If you think the risk of crashing is negligible, and the downside of breaking 
legacy applications in the console session is trivial, then paging with full 
Unicode support is easily possible. Implement _winapi.GetConsoleCP() and 
_winapi.SetConsoleCP(). Write UTF-8 text to the temporary file. Change the 
console input codepage to UTF-8 before spawning "more.com". Revert to the 
original input codepage in the finally block.

A more conservative fix would be to change tempfilepager() to encode the file 
using the console's current input codepage, GetConsoleCP(). At least there's no 
mojibake.

> PS > $OutputEncoding =  [System.Text.Encoding]::GetEncoding("UTF-8")

FYI, $OutputEncoding in PowerShell has nothing to do with the python.exe and 
more.com processes, nor the console session to which they're attached.

> PS > [System.Console]::OutputEncoding = $OutputEncoding

The console output code page is irrelevant since more.com writes wide-character 
text via WriteConsoleW() and decodes the file using the console input code 
page, GetConsoleCP(). The console output codepage from GetConsoleOutputCP() 
isn't used for anything here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Inada Naoki


Inada Naoki  added the comment:

I confirmed this fixes the mojibake:

```
PS > $OutputEncoding =  [System.Text.Encoding]::GetEncoding("UTF-8")
PS > [System.Console]::OutputEncoding = $OutputEncoding
PS > [System.Console]::InputEncoding = $OutputEncoding
```

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Inada Naoki


Inada Naoki  added the comment:

> In Windows, pydoc uses the old "more.com" pager with a temporary file that's 
> encoded with the default encoding, which is the process active codepage (i.e. 
> "ansi" or "mbcs"), unless UTF-8 mode is enabled. The "more.com" utility, 
> however, decodes the file using the console's current input codepage from 
> GetConsoleCP(), and then it writes the decoded text via wide-character 
> WriteConsoleW(). 

Then, we need to check `[System.Console]::InputEncoding` too. It is a 
`GetConsoleCP()`.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Eryk Sun


Eryk Sun  added the comment:

> PS> [System.Console]::OutputEncoding

The console's current output encoding is irrelevant to this problem.

In Windows, pydoc uses the old "more.com" pager with a temporary file that's 
encoded with the default encoding, which is the process active codepage (i.e. 
"ansi" or "mbcs"), unless UTF-8 mode is enabled. The "more.com" utility, 
however, decodes the file using the console's current input codepage from 
GetConsoleCP(), and then it writes the decoded text via wide-character 
WriteConsoleW(). 

The only supported way to query the latter in the standard library is via 
os.device_encoding(0), and that's only if stdin isn't redirected to a file or 
pipe. Alternatively, ctypes can be used via 
ctypes.WinDLL('kernel32').GetConsoleCP(). For the latter, we would need to add 
_winapi.GetConsoleCP(), since using ctypes is discouraged.

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Inada Naoki


Inada Naoki  added the comment:

Do you use PowerShell?
Please run this command and paste the output.

```
PS> $OutputEncoding
PS> [System.Console]::OutputEncoding
```

--
nosy: +methane

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Ned Deily


Change by Ned Deily :


--
components: +Windows -Documentation
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-05-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Conceptually, yes, but the function does return an index,

The function does not return an index.  It returns an integer that represents 
an insertion point.  The documentation is clear about this:

Locate the insertion point for x in a to maintain sorted order.
...
return value is suitable for use as the first
parameter to list.insert()

Likewise, the documented and precise invariants are stated in terms of slice 
points:

   The returned insertion point i partitions the array ``a ``
   into two halves so that ``all(val < x for val in a[lo : i])``
   for the left side and ``all(val >= x for val in a[i : hi])``
   for the right side.


> and values are stored at these indices.

That isn't true:

>>> bisect([], 5)
0

There is no value at 0.

The bisect functions are all about insertion points and ranges.  They aren't 
expressed in terms of an index and value.  The underlying algorithm never 
checks for equality.  Instead, it only uses __lt__(), so it is never aware of 
having "found" a value at all.

For people with use cases expressed in terms of index and value, there is a 
separate section of the docs showing show how to bridge between what they want 
and what the module actually does:

https://docs.python.org/3.10/library/bisect.html#searching-sorted-lists

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Jesse Silverman

Jesse Silverman  added the comment:

I looked around some more and it definitely is not just one isolated instance.  
I noted a similar issue on the lines from CLASSES topic pasted here.  I think 
it is all usages of the ellipsis in the context of the help text?  Maybe also 
fancy quote marks that didn't survive the jump from ASCII to Unicode?  And some 
fancy dashes.
The theme of my day was excitement at how much more docs and help ship than I 
had realized with the most basic Python install and thus are at my fingertips 
anywhere, everywhere, internet access or not.  This mars that exuberance only 
slightly.
help> CLASSES
The standard type hierarchy
***

Below is a list of the types that are built into Python.  Extension
modules (written in C, Java, or other languages, depending on the
implementation) can define additional types.  Future versions of
Python may add types to the type hierarchy (e.g., rational numbers,
efficiently stored arrays of integers, etc.), although such additions
will often be provided via the standard library instead.

Some of the type descriptions below contain a paragraph listing
ΓÇÿspecial attributes.ΓÇÖ  These are attributes that provide access to the
...
methodΓÇÖs documentation (same as "__func__.__doc__"); "__name__"
...
dictionary containing the classΓÇÖs namespace; "__bases__" is a tuple
   containing the base classes, in the order of their occurrence in
   the base class list; "__doc__" is the classΓÇÖs documentation string,

ΓÇ£ClassesΓÇ¥.  See section Implementing Descriptors for another way

--

___
Python tracker 
<https://bugs.python.org/issue44275>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Andre Roberge

Andre Roberge  added the comment:

I observe something similar, though with different symbols. My Windows 
installation uses French (fr-ca) as default language.
===
help> COMPARISON
Comparisons
***

...

Formally, if *a*, *b*, *c*, à, *y*, *z* are expressions and *op1*,
*op2*, à, *opN* are comparison operators, then "a op1 b op2 c ... y
opN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except
that each expression is evaluated at most once.

Note that "a op1 b op2 c" doesnÆt imply any kind of comparison between
*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though
perhaps not pretty).

So, in my case, the unusual characters are: à, Æ.  In this case, the French 
word 'à' would make some sense in this context (as it means 'to' in English).

--
nosy: +aroberge

___
Python tracker 
<https://bugs.python.org/issue44275>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Jesse Silverman

New submission from Jesse Silverman :

I didn't know whether to file this under DOCUMENTATION or WINDOWS.
I recently discovered the joys of the interactive help in the REPL, rather than 
just help(whatever).
I was exploring the topics and noticed multiple encoding or rendering errors.
I realized I stupidly wasn't using the Windows Terminal program but the default 
console.  I addressed that and they persisted in Windows Terminal.
I upgraded from 3.9.1 to 3.9.5...same deal.

I tried running:
Set-Item -Path Env:PYTHONUTF8 -Value 1

before starting the REPL, still no dice.

I confirmed this worked in the same session:
>>> ustr2='ʑʒʓʔʕʗʘʙʚʛʜʝʞ'
>>> ustr2
'ʑʒʓʔʕʗʘʙʚʛʜʝʞ'
It does.

The help stuff that doesn't render correctly is under topic COMPARISON:
lines 20, 21 and 25 of this output contain head-scratch-inducing mystery 
characters:
help> COMPARISON
Comparisons
***

Unlike C, all comparison operations in Python have the same priority,
which is lower than that of any arithmetic, shifting or bitwise
operation.  Also unlike C, expressions like "a < b < c" have the
interpretation that is conventional in mathematics:

   comparison::= or_expr (comp_operator or_expr)*
   comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="
 | "is" ["not"] | ["not"] "in"

Comparisons yield boolean values: "True" or "False".

Comparisons can be chained arbitrarily, e.g., "x < y <= z" is
equivalent to "x < y and y <= z", except that "y" is evaluated only
once (but in both cases "z" is not evaluated at all when "x < y" is
found to be false).

Formally, if *a*, *b*, *c*, …, *y*, *z* are expressions and *op1*,
*op2*, …, *opN* are comparison operators, then "a op1 b op2 c ... y
opN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except
that each expression is evaluated at most once.

Note that "a op1 b op2 c" doesnΓÇÖt imply any kind of comparison between
*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though
perhaps not pretty).

That is: …, …, ’

em-dash or ellipsis might be involved somehow...maybe fancy apostrophe?
My current guess is that it isn't about rendering anymore, because something 
went awry further upstream?

Thanks!

--
assignee: docs@python
components: Documentation
messages: 394817
nosy: docs@python, jessevsilverman
priority: normal
severity: normal
status: open
title: Is there a mojibake problem rendering interactive help in the REPL on 
Windows?
type: behavior
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue44275>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44215] help() module listing displays import warnings from deprecated package modules

2021-05-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26952] argparse help formatter raises IndexError

2021-05-28 Thread Irit Katriel


Change by Irit Katriel :


--
title: argparse help formatter crashes -> argparse help formatter raises 
IndexError
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7

___
Python tracker 
<https://bugs.python.org/issue26952>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26503] argparse with required field , not having new line separator in -help dispaly

2021-05-27 Thread Irit Katriel


Irit Katriel  added the comment:

issue11874 has been fixed and its PR has a unit test that seems similar to the 
case reported here (test_help_with_metavar). If you are still seeing this issue 
on 3.9 or higher, please create a new issue and include a code snippet that 
reproduces the problem.

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Mallika Bachan


Mallika Bachan  added the comment:

Conceptually, yes, but the function does return an index, and values are
stored at these indices. The index it returns holds the leftmost occurrence
of the target (should the target exist)
>>> bisect.bisect_left([1,2,2,3],2)
1
If we insert at this index, it will push the current value right, so
conceptually, sure, it can help to think of the insertion point as being
just before the leftmost target value.

But while bisect_right does in fact return value i that "points just beyond
the rightmost x already there" ("just beyond" gets interpreted as "the next
one", because only whole indices are used), making the statement "i points
just before the leftmost x already there" for the return value of
bisect_left definitely appears incorrect.

On Mon, May 24, 2021 at 6:30 PM Raymond Hettinger 
wrote:

>
> Raymond Hettinger  added the comment:
>
> I there is a misunderstanding here.  The bisect functions never point *to*
> a value.  Instead, they are documented to return "insertion points".  Those
> always occur just before or after a specific value:
>
> values:  10   20   30   30   30   40   50
> insertion points:   |   |||||||
> 0   1234567
> bisect_left(30) -^
> bisect_right(30) ---^
>
> As you can see, bisect_left() does in fact point JUST BEFORE the 30.
>
> Note this is also how slicing works.  Here's an example:
>
> >>> from bisect import bisect_left, bisect_right
> >>> s = [10, 20, 30, 30, 30, 40, 50]
> >>> i = bisect_left(s, 30)
> >>> j = bisect_right(s, 30)
> >>> s[i : j]
> [30, 30, 30]
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue44227>
> ___
>

--

___
Python tracker 
<https://bugs.python.org/issue44227>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Mallika Bachan


Change by Mallika Bachan :


--
keywords: +patch
pull_requests: +24933
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26340

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I there is a misunderstanding here.  The bisect functions never point *to* a 
value.  Instead, they are documented to return "insertion points".  Those 
always occur just before or after a specific value:

values:  10   20   30   30   30   40   50
insertion points:   |   |||||||
0   1234567
bisect_left(30) -^
bisect_right(30) ---^

As you can see, bisect_left() does in fact point JUST BEFORE the 30.

Note this is also how slicing works.  Here's an example:

>>> from bisect import bisect_left, bisect_right
>>> s = [10, 20, 30, 30, 30, 40, 50]
>>> i = bisect_left(s, 30)
>>> j = bisect_right(s, 30)
>>> s[i : j]
[30, 30, 30]

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Mallika Bachan


New submission from Mallika Bachan :

Documentation issue.

help(bisect.bisect_left)
says: "... if x already appears in the list, i points just before the leftmost 
x already there."
but in fact, it actually points *to* the leftmost x already there

--
messages: 394280
nosy: mallika.bachan
priority: normal
severity: normal
status: open
title: help(bisect.bisect_left)
type: behavior
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue44227>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44215] help() module listing displays import warnings from deprecated package modules

2021-05-23 Thread Stefano Rivera


New submission from Stefano Rivera :

Originally reported against pypy3 in Ubuntu
https://bugs.launchpad.net/ubuntu/+source/pypy3/+bug/1920675

$ ./python 
Python 3.10.0a5+ (heads/master:ffa55d21b4, May 23 2021, 08:14:50) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/usr/lib/python3/dist-packages/')
>>> help()
...
help> modules

Please wait a moment while I gather a list of all available modules...

/usr/lib/python3/dist-packages/IPython/kernel/__init__.py:12: ShimWarning: The 
`IPython.kernel` package has been deprecated since IPython 4.0.You should 
import from ipykernel or jupyter_client instead.
  warn("The `IPython.kernel` package has been deprecated since IPython 4.0."
Expected Tk Togl installation in 
/usr/lib/python3/dist-packages/OpenGL/Tk/togl-linux-64
Failure loading Togl package: can't find package Togl, on debian systems this 
is provided by `libtogl2`
...
Crypto  brain_crypt hgext   random
...

Warnings should probably be suppressed during module importing in help. Any 
warnings emitted here are probably deprecation warnings or system configuration 
issues, not useful to a user trying to browse modules.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 394196
nosy: docs@python, stefanor
priority: normal
severity: normal
status: open
title: help() module listing displays import warnings from deprecated package 
modules
type: behavior
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 
<https://bugs.python.org/issue44215>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: need help with a translation issue

2021-04-17 Thread dn via Python-list
Longer response:

NB I've not used the system and only quickly reviewed
https://py-googletrans.readthedocs.io/_/downloads/en/documentation/pdf/

NBB I am treating you (and/or other interested-readers) as something of
a 'beginner'. No insult is intended should I appear to be 'talking down'.



On 18/04/2021 10.56, Quentin Bock wrote:
> I'm trying to take the user input and let them change the target language
> or dest
> code:
> 
> from deep_translator import GoogleTranslator
> import googletrans
> import sys
> 
> language_list = googletrans.LANGUAGES
> print(language_list)


Why print this? Should this output be labelled, or otherwise explained
to the user?

Looking at what is output (yourself), is it a list or a dictionary? When
using it, is the code referring to a list or list of dictionary keys
(country-codes), should it be looking at the country-names, or even both?
(I'm not sure of your intent)


> feedback = input("Would you like to translate a sentence of your own?
> (yes/no)")
> 
> if feedback == 'no':
> sys.exit()

When reviewing code: if the same lines are (basically) repeated, is this
(often) a recommendation to employ a function?

Given that the user has kicked-off the program[me], is it necessary to
ask if (s)he wants to translate some text? Will anyone reply "no" at
this point?

Thus, (instead of asking) could we reasonably set "feedback" to "yes"?

That said, what if the user replies "YES" (or some less logical
combination of the same letters)?


> while feedback == 'yes':

Some might suggest that "feedback" should be a boolean value, thus:

while feedback:


> user_choice = input ("Enter a language (the abbreviation or correctly
> spelled name of the language): ").lower()

So, the acceptable response is either the code or the name of the language?


> user_sentence = input("Enter a sentence you want translated: ")
> 
> user_translation = GoogleTranslator(source='en',
> target=user_choice).translate(user_sentence)

Yet (according to the docs), the "target" value should be a
language-code, eg 'fr' rather than 'french'.
(remember: I've not used the library, so you're the expert...)


> print(user_translation)

Some would suggest that if "user_translation" is defined on one line and
only ever used on the following, the two lines should be conflated.

(some of us don't agree, especially if it makes testing more awkward)


> feedback = input ("Would you like to translate a sentence of your own?
> (yes/no)")
> 
> if feedback == 'no':
> sys.exit()

A UX (User Experience) consideration:
If the user has a series of translations to be made, will (s)he want to
keep repeating the same language/code? Could you code the input
statement to have a default value on the second and ensuing times
through the loop? In this mode, if the user hits Enter without entering
any text-data, the code could 'remember' the language and save
manual-effort.


A thought about design:
This code consists of a loop which has two purposes
1 translate some text
2 continue looping or stop

A useful guide (and testing aid) is "SRP" (the Single Responsibility
Principle) which has a more-technical definition, but let's stick to its
name. Each routine should have only a single task to perform (and should
do it well). Let's consider the first 'purpose':

def translate():
user_choice = input ("Enter...): ").lower()
user_sentence = input("Enter a sentence you want translated: ")
user_translation = GoogleTranslator(source='en',
target=user_choice).translate(user_sentence)

Applying SRP again, we might debate that last line, because it is not
(easily) possible to distinguish between an error at class
instantiation-time (eg "target" is not an acceptable language-code), and
an error at translation-time.

Let's go the next step and separate-out the input functionality. How
about a function like:

def translate( target_language_code, english_text ):
translator = GoogleTranslator( source='en',
   target=target_language_code
 )
return translator.translate( english_text )

Why?

There is virtue in what appears to be extra, even unnecessary, coding
effort!

This is very easily tested - and can be (even more easily) automatically
tested:

def test_translator( ... ):
assert translate( "fr", "hello" ) == "bonjour"
assert translate( "de", "thank you" ) == "danke schön"
... test for error using non-existent language-code
... test for error using non-English text


I'll leave you to work-out how to encapsulate the inputs into a function
- especially if you plan to implement the default-value idea/service to
users. (!)


The second purpose, after extracting the above, leaves us with a
"control loop" (in real-time systems it is termed an "event loop"), and
pretty-much the code as-is (after any amendments per comments-above).

while feedback:
print( translate() )
feedback = input ("Would you like to translate a 

Re: need help with a translation issue

2021-04-17 Thread Chris Angelico
On Sun, Apr 18, 2021 at 9:58 AM dn via Python-list
 wrote:
> Alternately, what's there to stop some nefarious/stupid user (like me!)
> entering "gobbledegook" and complaining that the program fails?

"What is the French for fiddle-de-dee?" -- the Red Queen, to Alice

(Incidentally, Google attempts to translate it as "violon-de-dee", and
declares that the input was indeed in English, disagreeing quite
firmly with Alice on both points.)

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


Re: need help with a translation issue

2021-04-17 Thread MRAB

On 2021-04-17 23:56, Quentin Bock wrote:

I'm trying to take the user input and let them change the target language
or dest
code:

from deep_translator import GoogleTranslator
import googletrans
import sys

language_list = googletrans.LANGUAGES
print(language_list)

feedback = input("Would you like to translate a sentence of your own?
(yes/no)")

if feedback == 'no':
 sys.exit()

while feedback == 'yes':

 user_choice = input ("Enter a language (the abbreviation or correctly
spelled name of the language): ").lower()

 user_sentence = input("Enter a sentence you want translated: ")

 user_translation = GoogleTranslator(source='en',
target=user_choice).translate(user_sentence)

 print(user_translation)

 feedback = input ("Would you like to translate a sentence of your own?
(yes/no)")

 if feedback == 'no':
 sys.exit()
when ran, this will bring an error saying that your inputted language is
not supported
why is this?


All I can say is that it works for me!
--
https://mail.python.org/mailman/listinfo/python-list


Re: need help with a translation issue

2021-04-17 Thread dn via Python-list
On 18/04/2021 10.56, Quentin Bock wrote:
> I'm trying to take the user input and let them change the target language
> or dest
> code:
> 
...

> language_list = googletrans.LANGUAGES
> print(language_list)
...

> user_choice = input ("Enter a language (the abbreviation or correctly
> spelled name of the language): ").lower()
...

> user_translation = GoogleTranslator(source='en',
> target=user_choice).translate(user_sentence)

Where is the "user_choice" related back to "language_list"?

Alternately, what's there to stop some nefarious/stupid user (like me!)
entering "gobbledegook" and complaining that the program fails?
-- 
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


need help with a translation issue

2021-04-17 Thread Quentin Bock
I'm trying to take the user input and let them change the target language
or dest
code:

from deep_translator import GoogleTranslator
import googletrans
import sys

language_list = googletrans.LANGUAGES
print(language_list)

feedback = input("Would you like to translate a sentence of your own?
(yes/no)")

if feedback == 'no':
sys.exit()

while feedback == 'yes':

user_choice = input ("Enter a language (the abbreviation or correctly
spelled name of the language): ").lower()

user_sentence = input("Enter a sentence you want translated: ")

user_translation = GoogleTranslator(source='en',
target=user_choice).translate(user_sentence)

print(user_translation)

feedback = input ("Would you like to translate a sentence of your own?
(yes/no)")

if feedback == 'no':
sys.exit()
when ran, this will bring an error saying that your inputted language is
not supported
why is this?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue39125] Type signature of @property not shown in help()

2021-04-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Currently there is no way to tell if the *attribute* 
> is read-only, read-write or write-only.

Read-only is segregated in the help() output.

>>> class A:
@property
def computed_field(self):
'An example property'

    
>>> help(A)
Help on class A in module __main__:

class A(builtins.object)
 |  Readonly properties defined here:
 |  
 |  computed_field
 |  An example property
 |  
 |  --
 |  Data descriptors defined here:
 |  
 |  __dict__
 |  dictionary for instance variables (if defined)
 |  
 |  __weakref__

--

___
Python tracker 
<https://bugs.python.org/issue39125>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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


HELP Please, Python Program Help

2021-04-10 Thread Joseph Roffey
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...


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

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

print("Select operation.")
print("1.Strain")

while True:
# Take input from the user
choice = input("Enter choice(1): ")

# Check if choice is one of the five options
if choice in ('1'):
num1 = float(input("Change in Length: "))
num2 = float(input("Original Length: "))

if choice == '1':
 print(num1, "/", num2, "=", divide(num1, num2)) 
break
else:
print("Invalid Input")


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


[issue39125] Type signature of @property not shown in help()

2021-04-09 Thread brenthuisman


brenthuisman  added the comment:

Is there any activity on this issue? The way Pybind11 generates accessors for 
attributes makes (as properties with getter and setter) makes it currently 
impossible to view the type info, which Pybind does provide.

Thanks for any update.

--
nosy: +brenthuisman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17306] Improve the way abstract base classes are shown in help()

2021-04-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Closing this due to lack of interest.

--
resolution:  -> postponed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43024] improve signature (in help, etc) for functions taking sentinel defaults

2021-04-01 Thread Irit Katriel


Irit Katriel  added the comment:

Marking as a 3.10 regression because the sentinel was added in 3.10.

--
keywords: +3.10regression

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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


Help Please

2021-03-26 Thread Anis4Games
Hello python support team , i need help about packages and python modules

That Video Will Explain My Problem

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


[issue23633] Improve py launcher help, index, and doc

2021-03-12 Thread Eryk Sun


Eryk Sun  added the comment:

The current help text attempts to explain point 2, in terms of an active 
virtual environment, shebangs, the PY_PYTHON[2|3] environment variables, and 
the py.ini [defaults]. It's a lot to say succinctly in a few lines of text. A 
shortened URL that links to the docs would be helpful.

The -0[p] listing uses an asterisk to highlight the version that `py` runs 
without a version specified in the command line or if a script has no shebang.

For point 3, referencing CSIDL_LOCAL_APPDATA in the documentation is not useful 
for people who aren't familiar with the Windows shell API. The help text from 
py.exe uses "%LOCALAPPDATA%\py.ini", which is more useful at the command line. 
It also explains how to locate py.ini in the launcher directory by using `where 
py`. However, a lot of people use PowerShell nowadays, in which case it has to 
be `where.exe py` or `gcm py | select source`.

--
assignee:  -> docs@python
components: +Documentation, Windows
nosy: +docs@python, paul.moore, tim.golden, zach.ware
type: behavior -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5

___
Python tracker 
<https://bugs.python.org/issue23633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43465] ./configure --help describes what --with-ensurepip does poorly

2021-03-10 Thread David Tucker


Change by David Tucker :


--
nosy: +tucked

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43465] ./configure --help describes what --with-ensurepip does poorly

2021-03-10 Thread Enji Cooper


New submission from Enji Cooper :

Many users are used to --without-* flags in autoconf disabling features (and 
optionally not installing them). --without-ensurepip (at face value to me) 
suggests it shouldn't be built/installed.

This comment in https://bugs.python.org/issue20417 by dstufft implies 
otherwise. From https://bugs.python.org/msg209537 :

> I don't see any reason not to install ensurepip in this situation. That flag 
> controls whether or not ``python -m ensurepip`` will be executed during the 
> install, but ensurepip itself will still be installed. It is not an optional 
> module

This isn't what "./configure --help" implies though:

```
$ git log --oneline -n 1
87f649a409 (HEAD -> master, upstream/master, origin/master, 
origin/logging-config-dictconfig-support-more-sysloghandler-options, 
origin/HEAD, logging-config-dictconfig-support-more-sysloghandler-options) 
bpo-43311: Create GIL autoTSSkey ealier (GH-24819)
$ ./configure --help

...

  --with-ensurepip[=install|upgrade|no]
  "install" or "upgrade" using bundled pip (default is
  upgrade)
$
```

The wording should be clarified to note what the flag actually does instead of 
causing [valid] confusion to end-users which might make them think that the 
ensurepip module shouldn't be installed if --without-ensurepip is specified.

--
components: Build
messages: 388456
nosy: ngie
priority: normal
severity: normal
status: open
title: ./configure --help describes what --with-ensurepip does poorly
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue43465>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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