Re: Remote/Pair-Programming in-the-cloud

2019-08-12 Thread DL Neil

On 7/08/19 4:20 AM, Dennis Lee Bieber wrote:

{Playing Devil's Advocate}


If this list had avatars, I would graffiti yours to have horns and a tail!

No.

Many have also requested feedback. Sadly the news is not good. Herewith:-



On Tue, 6 Aug 2019 09:07:41 +1200, DL Neil 
declaimed the following:


Anyway, this PUG mtg is going to be an 'experience'.
(I'll try (almost) anything once!)

The only thing missing is capturing your PoV of the meeting (with
screens) as a video for later streaming on YouTube 


Once the link was made, we addressed the entire mtg, briefing members on 
the experiment and the possibilities if offers. Only thereafter was it 
down to individuals or small groups (although I suspect everyone was 
subjected to every word I uttered - not the best approach - must check...).


In this jurisdiction, every single person present would have had to 
consent to the video. However, as it turned-out, such would have been 
less than helpful. Sigh!



Feedback/Observations:

The PUG meeting/experiment did not go very well. To be fair, I think 
that the live-demo gremlins were alive and well, and more responsible 
than anything/anyone else, but...
(as I've always said to my staff, having learned from (bitter) 
experience, start earlier than anyone else with enough time to test' 
everything, in-situ, before we start. The mtg organiser is/was no tutor 
of mine, is undoubtedly a busy boy, and may not have had prior access to 
the room/computer/network/...!)



The first issue was difficulty persuading Zoom to link. In the end there 
were two Zoom-s running at the other end, but we elected to leave-alone 
not actually knowing which was hosting the connection.


This process is normally quite straight-forward, and I've not 
experienced such before. Sadly, but a harbinger of what was to come...



Attempts to connect to AWS Cloud9 were completely fruitless. Whereas the 
remote PC had no trouble, at the PUG, entering access information 
resulted in nothing beyond 'the spinning wheel'.



Similarly, whilst we both managed to both log-in to PythonAnywhere, we 
made it no further.



In the end, I was (reduced to) screen-sharing, and chatting with folk 
about their projects.

(the purpose of the meeting - so, not 'all bad' then)


Aside:
I was interested to hear how one member is performing local development 
and then 'parcelling-up' his Flask app into a "script". Each time he 
wants to test 'on the web', the script builds a new Docker-instance. 
Most of the Python, pip3, etc, is held within some cache (I'm not a 
Docker-person). It all happens acceptably quickly - please see other 
thread where we discussed VMs, containers, and Pyenvs...



Have not heard-back from the mtg organiser, since. Am hoping he is busy, 
rather than upset...



Meantime, assuming that the host-machine was an older lap-top (based 
upon screen resolution only), I tried further combinations of hardware 
and network (beyond previous preparation-experiments), including 
resurrecting an old Windows Vista lap-top (I use Linux) which first 
needed its Firefox considerably updated (although that may have been AWS 
Cloud9's demand rather than PA's - can't recall). Once that prerequisite 
was in-place, no problems were experienced!


In any (other) combination of hardware, OpSys, networking, etc; I have 
no trouble using PythonAnywhere or AWS Cloud9 between two computers, 
including at the local public library (and through their 
firewall/security/decency/etc filters).



Conclusion:
the local university's foibles were likely to have been the source of 
our comms 'problems'.



What next?
- continue to narrow-down possible issues, with the meeting organiser
- more experiments*
- (possibly) consider other software choices (earlier in this thread)
- equip the host-machine with head-set
- better brief/prepare mtg participants in 'what to expect'**.

* A fellow list-member and I are planning further experiments, hopefully 
this week. If you are also interested, please feel free to contact me 
off-list...


** As mentioned earlier, "pair programming" and/or my attempt to 
remotely support our PUG's Coding Evenings, require abilities AND 
facilities to "verbalise", "share", and "swap". Yes it would (perhaps) 
be best if one package delivered 'all', but as long as multiple tools 
will work happily together, success is possible. The key though is to 
realise the social side of pair-programming, a willingness to share 
thoughts, communicate with each-other, etc. Thereafter to adapt to the 
'remote' wrinkle. We haven't reached the point of being able to explore 
such factors.



PythonAnywhere:
Have greatly appreciated the interest of one of their principals. Sent 
them feedback, with observations, suggestions, and questions. Pending 
response, it is likely that I will 'drop' that option. In the final 
analysis, I don't think PA a tool for "pair programming"; particularly 
not when compared with (say) AWS Cloud9 which offers a "chat" panel, 
d

Re: String slices

2019-08-12 Thread Rhodri James

On 10/08/2019 10:45, Peter J. Holzer wrote:

On 2019-08-10 09:10:12 +1000, Cameron Simpson wrote:

On 09Aug2019 22:28, Paul St George  wrote:

On 09/08/2019 16:29, Rhodri James wrote:

(Actually I would probably use outstream.write() and do my own
formatting, but let's not get side-tracked ;-)


I would love to hear your outstream.write() side-track!


I am not Rhodri James, but you can just write strings to text files:

  outstream.write("X: ")  # note, includes the space separator
  outstream.write(str(thing[0]))
  outstring.write("\n")


You can also format the string before passing it to write (which is
probably what Rhodri meant by "do my own formatting", like this:

 outstream.write("X: %7.2f\n" % thing[0])

or this

 outstream.write("X: {0:7.2f}\n".format(thing[0]))

or (since Python 3.6) this:

 outstream.write(f"X: {thing[0]:7.2f}\n")

There are of course many variants to all three methods.


That is indeed what I meant.  I do enough random dumping of things to 
files for debugging purposes that outstream.write() is second nature to 
me now.  I once even went as far as sys.stdout.write() before sanity 
caught up with me ;-)



--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


Web framework for static pages

2019-08-12 Thread morphex
Hi.

After a long break, I'm starting to work with web development again, in my 
company Nidelven IT.

http://www.nidelven-it.no

I've used Zope and Plone since the early days, as well as other web systems / 
frameworks, Python-based, some PHP, Java etc.

However, I would like to add another tool to my toolbox, another weapon to the 
arsenal..

Some customers would want static pages, and that's something I want to offer.

What frameworks are there for generating static web pages in Python? What are 
the features of each?

Thanks,

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


Re: Web framework for static pages

2019-08-12 Thread Brian Oney via Python-list



On August 12, 2019 9:14:55 AM GMT+02:00, morphex  wrote:
>Hi.
>

>What frameworks are there for generating static web pages in Python?

I have used:
https://github.com/Frozen-Flask/Frozen-Flask

It's pretty simple. Develop with flask and then "freeze" it.

I am looking forward to further answers.

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


Re: Web framework for static pages

2019-08-12 Thread Michael Torrie
On 8/12/19 1:14 AM, morphex wrote:
> What frameworks are there for generating static web pages in Python? What are 
> the features of each?

A quick google search reveals a number of them.  Pelican, Hyde, etc.
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: A new version (0.4.5) of python-gnupg has been released.

2019-08-12 Thread Vinay Sajip via Python-list
A new version of the Python module which wraps GnuPG has been released.
What Changed?=
This is an enhancement and bug-fix release, and all users are encouraged 
toupgrade.
Brief summary:
* Fixed #107: Improved documentation.
* Fixed #112: Raised a ValueError if a gnupghome is specified which is not an  
existing directory.
* Fixed #113: Corrected stale link in the documentation.
* Fixed #116: Updated documentation to clarify when spurious key-expired/  
signature-expired messages might be seen.
* Fixed #119: Added --yes to avoid pinentry when deleting secret keys with  
GnuPG >= 2.1.
* A warning is logged if gpg returns a non-zero return code.
* Added ``extra_args`` to ``import_keys``.
* Added support for CI using AppVeyor.
This release [2] has been signed with my code signing key:
Vinay Sajip (CODE SIGNING KEY) Fingerprint: CA74 
9061 914E AC13 8E66 EADB 9147 B477 339A 9B86
Recent changes to PyPI don't show the GPG signature with the download links.An 
alternative download source where the signatures are available is the 
project'sown downloads page [5].
What Does It Do?The gnupg module allows Python programs to make 
use of thefunctionality provided by the Gnu Privacy Guard (abbreviated GPG 
orGnuPG). Using this module, Python programs can encrypt and decryptdata, 
digitally sign documents and verify digital signatures, manage(generate, list 
and delete) encryption keys, using proven Public KeyInfrastructure (PKI) 
encryption technology based on OpenPGP.
This module is expected to be used with Python versions >= 2.4, as itmakes use 
of the subprocess module which appeared in that version ofPython. This module 
is a newer version derived from earlier work byAndrew Kuchling, Richard Jones 
and Steve Traugott.
A test suite using unittest is included with the source distribution.
Simple usage:
>>> import gnupg>>> gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory')>>> 
>>> gpg.list_keys()
[{...'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2','keyid': 
'197D5DAC68F1AAB2','length': '1024','type': 'pub','uids': ['', 'Gary Gross (A 
test user) ']},{...'fingerprint': 
'37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A','keyid': 
'0C5FEFA7A921FC4A','length': '1024',...'uids': ['', 'Danny Davis (A test user) 
']}]>>> encrypted = gpg.encrypt("Hello, world!", 
['0C5FEFA7A921FC4A'])>>> str(encrypted)
'-BEGIN PGP MESSAGE-\nVersion: GnuPG v1.4.9 
(GNU/Linux)\n\nhQIOA/6NHMDTXUwcEAf.-END PGP MESSAGE-\n'>>> decrypted = 
gpg.decrypt(str(encrypted), passphrase='secret')>>> str(decrypted)
'Hello, world!'>>> signed = gpg.sign("Goodbye, world!", passphrase='secret')>>> 
verified = gpg.verify(str(signed))>>> print "Verified" if verified else "Not 
verified"
'Verified'
As always, your feedback is most welcome (especially bug reports [3],patches 
and suggestions for improvement, or any other points via themailing 
list/discussion group [4]).
Enjoy!
Cheers
Vinay SajipRed Dove Consultants Ltd.
[1] https://bitbucket.org/vinay.sajip/python-gnupg[2] 
https://pypi.org/project/python-gnupg/0.4.5[3] 
https://bitbucket.org/vinay.sajip/python-gnupg/issues[4] 
https://groups.google.com/forum/#!forum/python-gnupg[5] 
https://bitbucket.org/vinay.sajip/python-gnupg/downloads/--
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-12 Thread morphex
Why Google it, when I have an Oracle? 😄

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


Re: Web framework for static pages

2019-08-12 Thread Morten W. Petersen

On 12.08.2019 18:13, Brian Oney wrote:



On August 12, 2019 9:14:55 AM GMT+02:00, morphex  wrote:

Hi.




What frameworks are there for generating static web pages in Python?


I have used:
https://github.com/Frozen-Flask/Frozen-Flask

It's pretty simple. Develop with flask and then "freeze" it.

I am looking forward to further answers.


OK, so now I know Flask can freeze applications. With Zope and Plone, I 
have a lot of what I need in terms of web application development.


What I guess I'm looking for, is something that will help create a 
static website, in a simple and efficient manner.  Without being bloated.


I don't have a lot of hair on my head, but I would be pulling it out 
because of some of the websites I see today, their heavy-handed use of 
different Javascript frameworks etc.


How would I go about creating a simple website with a front page, an 
about page, a product page and a contact page?  Without any server-side 
handling of data, so it could be entirely served by for example Apache.


And with it having well-formed XHTML, proper CSS, little Javascript, 
scaling to different screen and web browsers (wow, it's been so long I 
forgot it was called responsive design) and so on, being a nice little 
package.


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


About the #python irc channel on freenode.

2019-08-12 Thread Hongyi Zhao
Hi,

Sorry for bothering here for this not technically python issue.

I want to chat some issues on the #python irc channel hosted on freenode.  
But try so many times still cann't succeed. 

Could anyone here give me some hint if you can successfully do this thing?

Regards
-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-12 Thread Cameron Simpson

On 13Aug2019 00:01, Morten W. Petersen  wrote:
What I guess I'm looking for, is something that will help create a 
static website, in a simple and efficient manner.  Without being 
bloated.


I don't have a lot of hair on my head, but I would be pulling it out 
because of some of the websites I see today, their heavy-handed use of 
different Javascript frameworks etc.


How would I go about creating a simple website with a front page, an 
about page, a product page and a contact page?  Without any 
server-side handling of data, so it could be entirely served by for 
example Apache.


And with it having well-formed XHTML, proper CSS, little Javascript, 
scaling to different screen and web browsers (wow, it's been so long I 
forgot it was called responsive design) and so on, being a nice little 
package.


The common search term is "static site generator". There are several out 
there. I haven't any experience with which to offer an opinion though.


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


Re: About the #python irc channel on freenode.

2019-08-12 Thread Hongyi Zhao
On Mon, 12 Aug 2019 16:13:41 -0700, Paul Rubin wrote:

> It's always worked ok for me.

But I always be put into the #python-unregistered channel as follows:

--
Now talking on #python-unregistered
* Topic for #python-unregistered is: Welcome to #python-unregistered! 
You've been put here because #python requires you to register your 
nickname with Freenode. For more information about registering on 
Freenode, ask #freenode. For more information about #python,#python-* 
moderation, #python-ops.
* Topic for #python-unregistered set by lvh!~lvh@python/psf/lvh (Fri Jul  
1 16:44:19 2011)
-

I've tried to register the nickname as it told. But still cannot success.

Regards
-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Web framework for static pages

2019-08-12 Thread Jon Ribbens via Python-list
On 2019-08-12, Morten W. Petersen  wrote:
> What I guess I'm looking for, is something that will help create a 
> static website, in a simple and efficient manner.  Without being bloated.
>
> I don't have a lot of hair on my head, but I would be pulling it out 
> because of some of the websites I see today, their heavy-handed use of 
> different Javascript frameworks etc.
>
> How would I go about creating a simple website with a front page, an 
> about page, a product page and a contact page?  Without any server-side 
> handling of data, so it could be entirely served by for example Apache.

If it's really that small then it sounds like what you are looking for
is known as a "text editor".
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: About the #python irc channel on freenode.

2019-08-12 Thread David
On Tue, 13 Aug 2019 at 10:00, Hongyi Zhao  wrote:
>
> But I always be put into the #python-unregistered channel as follows:
>
> --
> Now talking on #python-unregistered
> * Topic for #python-unregistered is: Welcome to #python-unregistered!
> You've been put here because #python requires you to register your
> nickname with Freenode. For more information about registering on
> Freenode, ask #freenode. For more information about #python,#python-*
> moderation, #python-ops.
> * Topic for #python-unregistered set by lvh!~lvh@python/psf/lvh (Fri Jul
> 1 16:44:19 2011)
> -
>
> I've tried to register the nickname as it told. But still cannot success.

The #python channel always works for me.

The best place to ask for help is to do what it says in the message
you were given ...
"For more information about registering on Freenode, ask #freenode. "

Have you asked for help in the #freenode channel?

/join #freenode and ask there, no registration is required to do that.

Be sure to communicate in short, clear sentences.
Then wait for someone to answer you. Do not leave the channel
after asking for help, wait for at least an hour.

Any person might answer you, and sometimes random people
there make mischief. But the people who are "ops" in that channel
are freenode staff. They will help you and they have admin powers.
Sometimes depending on time of day or day of week the staff
might be absent. If so, just wait a few hours and try again.
-- 
https://mail.python.org/mailman/listinfo/python-list


How to load cookies from a json input in python-requests?

2019-08-12 Thread Peng Yu
```
import requests
s = requests.Session()
import json
s.cookies.set_cookie(requests.utils.cookiejar_from_dict(json.load(sys.stdin)))
```

I used the above command to load cookies from a json file. But I got
the following error. Does anybody know how to fix the error? Thanks.

```
Traceback (most recent call last):
  File "/xxx/xxx.py", line 15, in 

s.cookies.set_cookie(requests.utils.cookiejar_from_dict(json.load(sys.stdin)))
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/cookies.py",
line 345, in set_cookie
if hasattr(cookie.value, 'startswith') and
cookie.value.startswith('"') and cookie.value.endswith('"'):
AttributeError: 'RequestsCookieJar' object has no attribute 'value'
```

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


Re: How to load cookies from a json input in python-requests?

2019-08-12 Thread Alexandre Brault

On 2019-08-12 11:38 p.m., Peng Yu wrote:

```
import requests
s = requests.Session()
import json
s.cookies.set_cookie(requests.utils.cookiejar_from_dict(json.load(sys.stdin)))
```

I used the above command to load cookies from a json file. But I got
the following error. Does anybody know how to fix the error? Thanks.

```
Traceback (most recent call last):
   File "/xxx/xxx.py", line 15, in 
 
s.cookies.set_cookie(requests.utils.cookiejar_from_dict(json.load(sys.stdin)))
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/cookies.py",
line 345, in set_cookie
 if hasattr(cookie.value, 'startswith') and
cookie.value.startswith('"') and cookie.value.endswith('"'):
AttributeError: 'RequestsCookieJar' object has no attribute 'value'
```
set_cookie is used to add an individual cookie in an existing cookiejar. 
You might want to have a look at 
requests.utils.add_dict_to_cookiejar(s.cookies, json.load(...)) or 
passing the result of requests.utils.cookiejar_from_dict ti the cookies 
argument of requests.Session

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