Re: a simple question

2021-07-27 Thread Terry Reedy

On 7/26/2021 6:19 PM, Glenn Wilson via Python-list wrote:

I recently downloaded the latest version of python, 3.9.6. Everything works 
except, the turtle module. I get an error message every time , I use basic 
commands like forward, backward, right and left. My syntax is correct: 
pat.forward(100) is an example. Can you tell me what is wrong.


On Windows, normal install,
C:\Users\Terry>py -3.9 -m turtle
C:\Users\Terry>py -3.9 -m turtledemo
both work.


--
Terry Jan Reedy

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


Generate a Google Translate API token through the Socks5 proxy using gtoken.py

2021-07-27 Thread [email protected]
I want to use 
[gtoken.py](https://github.com/ssut/py-googletrans/blob/master/googletrans/gtoken.py)
 through a socks5 proxy. Based on the comment 
[here](https://github.com/encode/httpx/issues/203#issuecomment-611914974) and 
the example usage in 
[gtoken.py](https://github.com/ssut/py-googletrans/blob/d15c94f176463b2ce6199a42a1c517690366977f/googletrans/gtoken.py#L29),
 I tried with the following method, but failed:
```python
(datasci) werner@X10DAi:~$ ipython
Python 3.9.1 (default, Feb 10 2021, 15:30:33) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.23.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import socks

In [2]: import socket

In [3]: socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 18889)
   ...: socket.socket = socks.socksocket

In [4]: from googletrans.gtoken import TokenAcquirer

In [5]: acquirer=TokenAcquirer()

In [6]: text = 'test'

In [7]: tk= acquirer.do(text)
---
AttributeErrorTraceback (most recent call last)
 in 
> 1 tk= acquirer.do(text)

~/.pyenv/versions/3.9.1/envs/datasci/lib/python3.9/site-packages/googletrans/gtoken.py
 in do(self, text)
192 
193 def do(self, text):
--> 194 self._update()
195 tk = self.acquire(text)
196 return tk

~/.pyenv/versions/3.9.1/envs/datasci/lib/python3.9/site-packages/googletrans/gtoken.py
 in _update(self)
 60 
 61 # this will be the same as python code after stripping out a 
reserved word 'var'
---> 62 code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
 63 # unescape special ascii characters such like a \x3d(=)
 64 code = code.encode().decode('unicode-escape')

AttributeError: 'NoneType' object has no attribute 'group'
```
Any hints for this problem will be highly appreciated.

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


Track 3.9 instead of 3.10?

2021-07-27 Thread Skip Montanaro
I have a development branch in my fork of python/cpython, the
register2 branch of https://github.com/smontanaro/cpython. As I am
dealing with virtual machine internals I've found the changes to the
virtual machine between 3.9 and 3.10 too disruptive. I'd like to track
3.9 instead. How would I go about making the switch while minimizing
the number of (inevitable) conflicts? I was thinking of diffing my
current state against 3.10, then creating a new branch off 3.9 and
applying the diff to that. That makes most of the effort outside of
the view of git though, and won't necessarily minimize conflicts. Is
there some way to do this totally within the git infrastructure?

Thx,

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


Re: Track 3.9 instead of 3.10?

2021-07-27 Thread Chris Angelico
On Wed, Jul 28, 2021 at 1:05 AM Skip Montanaro  wrote:
>
> I have a development branch in my fork of python/cpython, the
> register2 branch of https://github.com/smontanaro/cpython. As I am
> dealing with virtual machine internals I've found the changes to the
> virtual machine between 3.9 and 3.10 too disruptive. I'd like to track
> 3.9 instead. How would I go about making the switch while minimizing
> the number of (inevitable) conflicts? I was thinking of diffing my
> current state against 3.10, then creating a new branch off 3.9 and
> applying the diff to that. That makes most of the effort outside of
> the view of git though, and won't necessarily minimize conflicts. Is
> there some way to do this totally within the git infrastructure?
>

If your changes (on top of 3.10) aren't too invasive, you could rebase
those changes on top of 3.9, or cherry-pick them one by one. That
would be a more granular way to "diff [your] current state against
3.10" (assuming you've been making those changes as individual
commits).

Check out the "rebase --onto" operation:

https://git-scm.com/docs/git-rebase

The first example of --onto (regarding master/next/topic branches) is
what I think you're trying to do.

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


ANN: Wing Python IDE version 8 has been released

2021-07-27 Thread Wingware
Wing 8 is a major new release that introduces support for development on 
Docker and LXC/LXD containers and Docker Compose clusters, a Python 
package management tool, improved project creation, improved static 
analysis and code warnings, support for Python 3.10, a native Apple 
Silicon (M1) build, a new Nord style theme, reduced application startup 
time, and much more.


Details:  https://wingware.com/news/2021-07-26
Downloads:   https://wingware.com/downloads

== About Wing ==

Wing is a light-weight but full-featured Python IDE designed 
specifically for Python, with powerful editing, code inspection, 
testing, and debugging capabilities. Wing's deep code analysis provides 
auto-completion, auto-editing, and refactoring that speed up 
development. Its top notch debugger works with any Python code, locally 
or on a remote host, container, or cluster. Wing also supports 
test-driven development, version control, UI color and layout 
customization, and includes extensive documentation and support.


Wing is available in three product levels:  Wing Pro is the 
full-featured Python IDE for professional developers, Wing Personal is a 
free Python IDE for students and hobbyists (omits some features), and 
Wing 101 is a very simplified free Python IDE for beginners (omits many 
features).


Learn more at https://wingware.com/


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


Re: Generate a Google Translate API token through the Socks5 proxy using gtoken.py

2021-07-27 Thread Cameron Simpson
Just to follow on a bit to Dennis:

C:\Users\Wulfraed\Documents\_Hg-Repositories\Python Progs>python
googletrans_test.py
Traceback (most recent call last):
  File "googletrans_test.py", line 4, in 
tk = acquirer.do(text)
  File "C:\Python38\lib\site-packages\googletrans\gtoken.py", line 194, in 
do
self._update()
  File "C:\Python38\lib\site-packages\googletrans\gtoken.py", line 62, in 
_update
code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'

The implication here is that:

self.RE_TKK.search(r.text).group(1)

generates the error because:

self.RE_TKK.search(r.text)

returned None instead of a regular expression match object. That means 
that "r.text" way not what was expected.

Like Dennis, i note the remark "for internal use only", suggesting this 
was some internal Google code for doing something fiddly. It may not be 
the best thing for what you're trying to do.

WRT to a socks proxy, Dennis showed that the issue occurs even without a 
proxy. I would advocate doing all your debugging without trying to use 
socks, then get to going through a socks proxy _after_ the main stuff is 
working.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generate a Google Translate API token through the Socks5 proxy using gtoken.py

2021-07-27 Thread [email protected]
On Wednesday, July 28, 2021 at 7:25:27 AM UTC+8, [email protected] wrote:
> Just to follow on a bit to Dennis: 

But I can't any reply from Dennis in this issue.
 
> C:\Users\Wulfraed\Documents\_Hg-Repositories\Python Progs>python 
> googletrans_test.py 
> Traceback (most recent call last): 
> File "googletrans_test.py", line 4, in  
> tk = acquirer.do(text) 
> File "C:\Python38\lib\site-packages\googletrans\gtoken.py", line 194, in do 
> self._update() 
> File "C:\Python38\lib\site-packages\googletrans\gtoken.py", line 62, in 
> _update
> code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
> AttributeError: 'NoneType' object has no attribute 'group'
> The implication here is that: 
> 
> self.RE_TKK.search(r.text).group(1) 
> 
> generates the error because: 
> 
> self.RE_TKK.search(r.text) 
> 
> returned None instead of a regular expression match object. That means 
> that "r.text" way not what was expected. 
> 
> Like Dennis, i note the remark "for internal use only", suggesting this 
> was some internal Google code for doing something fiddly. It may not be 
> the best thing for what you're trying to do. 
> 
> WRT to a socks proxy, Dennis showed that the issue occurs even without a 
> proxy. I would advocate doing all your debugging without trying to use 
> socks, then get to going through a socks proxy _after_ the main stuff is 
> working. 
> 
> Cheers, 
> Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generate a Google Translate API token through the Socks5 proxy using gtoken.py

2021-07-27 Thread Cameron Simpson
On 27Jul2021 19:24, Hongyi Zhao  wrote:
>On Wednesday, July 28, 2021 at 7:25:27 AM UTC+8, [email protected] wrote:
>> Just to follow on a bit to Dennis:
>
>But I can't any reply from Dennis in this issue.

Odd, because I replied to his reply to you :-)

If you're using a threaded view of the list, his reply should be right 
before mine. If you're not, it was about 6 hours before my reply.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list