Re: Using zipfile to create a zip file with directories and files inside those directories

2020-03-07 Thread musbur
On Fri, 6 Mar 2020 20:06:40 -0700
Michael Torrie  wrote:

> The documentation talks about writing files from
> disk, but I'm interested in creating these files from within Python
> directly in the zip archive.

But you have seen writestr(), haven't you?

ZipFile.writestr(zinfo_or_arcname, data, compress_type=None,
compresslevel=None)

Write a file into the archive. The contents is data, which may be
either a str or a bytes instance; 

> So I naively thought I could use the "open"
> method of zipfile, giving it a relative path describing the relative
> path and file name that I want to then write bytes to.  But seems I am
> mistaken.

No your're not. writestr() and ZipInfo are your friends, unless I
haven't understood what you're trying to do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread Νίκος Βέργος
Τη Σάββατο, 7 Μαρτίου 2020 - 12:34:21 π.μ. UTC+2, ο χρήστης DL Neil έγραψε:

> Please post the full error message and traceback.
> 
> To clarify: is the error coming from Python or from the web server?


I beleive it comes from the web server. Here it is:

Error: 500 Internal Server Error
Sorry, the requested URL 'http://superhost.gr/mailform' caused an error:

Internal Server Error
Exception:
TypeError("argument of type 'NoneType' is not iterable",)
Traceback:
Traceback (most recent call last):
  File "/home/nikos/wsgi/bottle.py", line 996, in _handle
out = route.call(**args)
  File "/home/nikos/wsgi/bottle.py", line 2007, in wrapper
rv = callback(*a, **ka)
  File "/home/nikos/wsgi/www.py", line 189, in mailform
if provider in FROM:
TypeError: argument of type 'NoneType' is not iterable


I somehow beleive that the following apache conf directives somehow create 
problem.

When superhost.gr/test tries to post html form data to the route endpoint 
'/mailform' it sends it to superhost.gr/mailform and NOT at 
superhost.gr/test/mailform as it should have done.

They somehow interfere.

Here is the processes running in the webserver that somehow interfere.


WSGIDaemonProcess test user=nikos group=nikos home=/home/nikos/wsgi
WSGIScriptAlias /test /home/nikos/wsgi/test.py process-group=test 
application-group=%{GLOBAL}

WSGIDaemonProcess www user=nikos group=nikos home=/home/nikos/wsgi
WSGIScriptAliasMatch / /home/nikos/wsgi/www.py process-group=www 
application-group=%{GLOBAL}

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


Re: ÿ in Unicode

2020-03-07 Thread R.Wieser
Moi,

> - Today, there are still people who do not understand a
> "ÿ' can not be *safely* encoded with a single byte.

It can (and has been done for ages), just not in the character encoding 
method you've choosen to use.

> - Python == Latin-1 mess (as somebody wrote on a mailing list).

Putting blanket, unsupported statements forward doesn't score you any 
points.  Feel free to come up with examples* though, as well as (ofcourse) 
how you think it could have been done better

*examples in regard how Python fails to use the character encoding according 
to its definition.   Any complaint towards the encoding itself doesn't 
belong in this newsgroup.

But, seeing that you started this thread with posting stuff that actually 
works**as advertised I won't hold my breath.

**instead of supporting your 'Python makes a mess of it' stance. Which 
ofcourse suggests that that example is actually the worst thing you could 
come up with - but only shows both Python and the UTF-x encodings working as 
expected.

> - This "Flexible string representation" succeded to reintroduced
> the mess of the coding of characters.

Nope.   That /you/ don't understand how the UTF-x character encoding works 
doesn't mean others do not either.

> Once you get this, it's a child play to produce failing Python code.
> Python approach.

Do you know how to take a car engine apart and rebuild it ?No ?   Than 
you also suck at cooking food, am I right ?   (You eat in the car, you 
transport food by it.  The connection is /obviously/ there :-) )

> Other possibility, take a "utf-NNN tool" (lib), C# (Powershell),
> golang and show these tools are correctly working where Python
> fails for the same task.

Kiddo, all I have seen you do is to suggest that UTF encoding is bad(1), and 
by association Python is bad(2), by making some reference to other programs 
that do it better(3) and where Python fails(4)

(1),(2),(3),(4) - None of which are underbuild, let alone proven.   In 
short, hollow and meaningless drivel.  Acceptable for a politician, but not 
for a programmer/scripter.

> A real funny mess. Very amusing.

Oh well, you at least get /some/ enjoyment outof knowing* the Python 
language.

* I'm just assuming you are not actually /using/ it, as its so bad and you 
got a range of better languages at your disposal.

But that does make me wonder why you are posting here to start with.

Although, I think I can guess ...

Regards,
Rudy Wieser


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


Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread Νίκος Βέργος
You will see if you create a route endpoint called 'mailform' within '/' which 
is an alias of 'www.py' and you also have '/mailform' in 'superhost.gr/test' 
when the latter tries to post data to '/mailform' instead of sending them to 
'superhost.gr/test/' it sends them to '/' which is 'superhost.gr'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using zipfile to create a zip file with directories and files inside those directories

2020-03-07 Thread Michael Torrie
On 3/7/20 1:08 AM, mus...@posteo.org wrote:
> On Fri, 6 Mar 2020 20:06:40 -0700
> Michael Torrie  wrote:
> 
>> The documentation talks about writing files from
>> disk, but I'm interested in creating these files from within Python
>> directly in the zip archive.
> 
> But you have seen writestr(), haven't you?

Yes, that's what I was using.  Turns out I didn't look closely enough at
the exception I was getting.  What i thought was zipfile complaining
about a '/' character was really Python complaining about a bad string
formatting string I was using!

Thanks for confirming that zipfile indeed should work the way I hoped it
wood. I'm in business now.

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


wxjmfauth posts

2020-03-07 Thread Ethan Furman

All,

wxjmfauth is a known troll who posts on the usenet comp.lang.python.  Their 
posts are discarded from Python List.

If you choose to interact with them anyway, please:

- leave `wxjmfauth` in the attribution lines so those replies can be discarded
- keep your discourse civil

Thank you.

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


Re: ÿ in Unicode

2020-03-07 Thread R.Wieser
Moi,

> Fortunately, UTF-8 has not been created the Python devs.

And there we go again, making vague statements/accusations - without 
/anything/ to back it up ofcourse

Kiddo, you have posted a couple of messages now, but have said exactly 
nothing.   Are you sure you do not want to go into politics ?

Regards,
Rudy Wieser


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


Re: ÿ in Unicode

2020-03-07 Thread Ben Bacarisse
moi  writes:

> Le samedi 7 mars 2020 16:41:10 UTC+1, R.Wieser a écrit :
>> Moi,
>> 
>> > Fortunately, UTF-8 has not been created the Python devs.
>> 
>> And there we go again, making vague statements/accusations - without 
>> /anything/ to back it up ofcourse
>> 
>> Kiddo, you have posted a couple of messages now, but have said exactly 
>> nothing.   Are you sure you do not want to go into politics ?
>> 
> The day, when this language will stop to interpret a byte
> as being a Latin-1 (ISO-8859-1) character, this language will
> start to work properly.

>>> "ÿ".encode('iso-8859-1')
b'\xff'

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


Re: ÿ in Unicode

2020-03-07 Thread Richard Damon
On 3/7/20 12:52 PM, Ben Bacarisse wrote:
> moi  writes:
> 
>> Le samedi 7 mars 2020 16:41:10 UTC+1, R.Wieser a écrit :
>>> Moi,
>>>
 Fortunately, UTF-8 has not been created the Python devs.
>>>
>>> And there we go again, making vague statements/accusations - without 
>>> /anything/ to back it up ofcourse
>>>
>>> Kiddo, you have posted a couple of messages now, but have said exactly 
>>> nothing.   Are you sure you do not want to go into politics ?
>>>
>> The day, when this language will stop to interpret a byte
>> as being a Latin-1 (ISO-8859-1) character, this language will
>> start to work properly.
> 
 "ÿ".encode('iso-8859-1')
> b'\xff'
> 

or the reverse.

b'\xff'.decode('iso-8859-1')
'ÿ'

iso-8859-1 just isn't the DEFAULT character encoding to use.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ÿ in Unicode

2020-03-07 Thread Grant Edwards
On 2020-03-07, Jon Ribbens via Python-list  wrote:
> On 2020-03-06, Jon Ribbens  wrote:
>> What's the bug, or source of amusement?
>
> Oh, that's fun. There's a Russian Fidonet gateway, that somehow
> still exists, that's re-injecting usenet posts back into the group.

Last time I think it was one in Australia.

--
Grant



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


Re: iterate through an irregular nested list in Python

2020-03-07 Thread Souvik Dutta
A better way would be to just do
nestedl = [[2], [], [], [l, b, n]]#nested list
for a in nestedl:   #taking all the sublist

  for b in a:   #iterating through the sub
 print(b)

Though it is easy the only limitation is that it works only if the elements are 
lists. Which we can be easily overcome by using an if statement to check the 
elements type.


On Fri, 6 Mar, 2020, 6:30 pm ,  wrote:

> Hi All,
> I am new to python.
> I have a irregular nested lists in a list.
> Please help me to iterate through each element.
>
> Thanks much in advance.
>
> Sample Ex
>
> aList = [[2,'jkj'],[],[],['kite',88,'ooo','pop','push','pull'],['hello']]
>
> expected output:
> 2,jkj,,,kite,88,ooo,pop,push,pull,hello
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

On Fri, 6 Mar, 2020, 6:30 pm ,  wrote:

> Hi All,
> I am new to python.
> I have a irregular nested lists in a list.
> Please help me to iterate through each element.
>
> Thanks much in advance.
>
> Sample Ex
>
> aList = [[2,'jkj'],[],[],['kite',88,'ooo','pop','push','pull'],['hello']]
>
> expected output:
> 2,jkj,,,kite,88,ooo,pop,push,pull,hello
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help building python application from source

2020-03-07 Thread Ethan Furman
On 03/03/2020 01:50 PM, Marco Sulla via Python-list wrote:

> People of Python List, I strongly discourage you to support this user.
> He is quite suspicious for the following reasons:

Marco, this is not an appropriate response.  If you have concerns about list 
behavior then email the list owners.  If you have evidence of wrong-doing then 
email the list owners and do what you can to contact the appropriate 
authorities.

Asking the list to not help someone because you disagree with their beliefs 
will not be tolerated.  Consider this your warning.

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


Re: Application setup like windows msi

2020-03-07 Thread Grant Edwards
On 2020-03-05, Michael Torrie  wrote:
> On 3/4/20 4:51 PM, J A wrote:
>> I was wondering g if there was a way to distribute an application that took
>> advantage of user input like a windows .msi does. On linux of course.
>
> Several installer frameworks can make interactive installers for Linux.
> There's the NullSoft installer and InstallerVICE.  And quite a few
> commercial packages have rolled their own installers. Although I find
> installers of any kind of annoying on Linux and don't seem all that
> necessary.

I prefer a .tar file and a readme.txt file that says to run setup.py.

But then again, I run Gentoo. ;)

--
Grant Edwards   grant.b.edwardsYow! I guess it was all a
  at   DREAM ... or an episode of
  gmail.comHAWAII FIVE-O ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2020-03-07 Thread Souvik Dutta
This is not a place to quarrel our only task is to discuss and help other learn 
and learn ourselves. To Mr. Marco what Mr. Lee says is correct. Since he is 
working on a cryptocurrency project and he might use our original code in his 
final project I don't think offering money is bad. After all there have been 
times when a person demands his name to included in the credits page. Our sole 
task is to help. And you cannot form opinions for other people's by saying them 
not to support a person. That is injustice and rude.

On Fri, 6 Mar, 2020, 9:14 pm Mr. Lee Chiffre,  wrote:

> Thank you Marco for at least taking the time to read my message even if
> you do not agree with me on things. And no disrespect to you. But I came
> here for python related questions and help. Not to be called suspicious
> and untrustworthy only because I am concerned about security of users and
> for being a advocate of privacy. Then to call for me to be censored is
> just ludicrous.
>
>
> > People of Python List, I strongly discourage you to support this user.
> > He is quite suspicious for the following reasons:
> >
> > 1. he go so far as he offers money for, IMHO, a trivial task
>
> I said I am a python noob. This is why I asked for help. And I see no
> issue in offering payment for a programming task.
>
> > 2. he does not trust binaries from pip.
>
> What is the point of open source if you cannot compile from source code?
>
> > code. A lack of trust in open source projects that is quite unusual
> > 3. I don't trust any cryptocurrency.
>
> Not unusual. People use open source because they dont trust closed source.
> Binaries that someone else compiled is not open source.
>
> > I believe in privacy,  but not in financial privacy. Yes,
> > cryptocurrencies can be useful for circumvent bans from tyrannic
> > states. But they can, and _are_ used, primarily to:
> >  - wash dirty money, by criminals and mafias
> >  - evade taxes
> >  - buy highly unethical "products", like weapons... and who know what
> > other
> >  - finance tyrannies.
>
> Roads and cars are used by drug dealers. Stop using roads and cars. Cash
> is used by criminals. Stop using cash. Internet is used by child abusers.
> Stop supporting the internet. I am offended that you group me with
> criminals and baddies because I support technological privacy.
>
>
> >
> > I do _not_ think that all people that uses cryptocurrencies are
> > criminals. I had, for example, some co-workers that invested in
> > BitCoins, only for profit.
> >
> > But I do not trust this man, and I hope no one will offer support to
> > him. By my side, I'll report this discussion to moderators.
>
> That is fine if you dont like something. You dont have to help me out if
> you dont want to. But trying to censor me is unethical. Hopefully other
> people will have the logic to make decisions for themselves and give me
> help on python if they choose to do so.
>
> I hope my reply does not get censored. I am being reasonable here. And if
> you are wondering why I am "paranoid", you would be too if you are dealing
> with a server that might host a hot wallet. I dont want my server getting
> hacked just because I was too lazy to compile my own code. And it is not
> uncommon for binaries of open source projects to be injected with malware.
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: iterate through an irregular nested list in Python

2020-03-07 Thread Dan Stromberg
On Fri, Mar 6, 2020 at 6:55 AM Pieter van Oostrum  
wrote:

> sinnd...@gmail.com writes:
>
> > Hi All,
> > I am new to python.
> > I have a irregular nested lists in a list.
> > Please help me to iterate through each element.
> >
> > Thanks much in advance.
> >
> > Sample Ex
> >
> > aList = [[2,'jkj'],[],[],['kite',88,'ooo','pop','push','pull'],['hello']]
> >
> > expected output:
> > 2,jkj,,,kite,88,ooo,pop,push,pull,hello
> >
>
> Use a recursive iterator/generator:
> It becomes a bit peculiar because you want special treatment for empty
> lists inside,
> but otherwise it is quite standard Python:
>
> aList = [[2,'jkj'],[],[],['kite',88,'ooo','pop','push','pull'],['hello']]
>
> def reclist(aList):
> for item in aList:
> if isinstance(item, list):
> if item == []:
> yield ''
> else:
> yield from reclist(item)
> else:
> yield item
>
> for i in reclist(aList):
> print(i, end=',')
>
> This gives you an extra comma at the end, unfortunately.
> But it is the pattern for other types of processing.
>
> Or use it like this:
>
> print (','.join(str(i) for i in reclist(aList)))
>

If your lists are nested to inconsistent depth, and you're on a modern version 
of Python (3.3 and up), recursion with yield from (as above) is the way to go.

If your lists are nested to a consistent depth (as your example seems to 
suggest), you can just:

for sublist in aList:
for element in sublist:
yield element

If you need inconsistent depth and you're on an old version of python, yield 
from is unavailable. In that case, it's best to write it out recursively (even 
though that won't work really), and modify that to be nonrecursive using an 
explicit stack or stacks. There's an example of this at: 
http://stromberg.dnsalias.org/svn/treap/trunk/m4_treap.m4
See iterator_macro.
Don't let the m4 throw you - it's just a way of deriving pure python and cython 
from the same file.
You can generate the pure python form the .m4 file with simply: m4 -Dpy=1 < 
m4_treap.m4 > py_treap.py
...if you install an m4 binary.

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


Re: iterate through an irregular nested list in Python

2020-03-07 Thread Pieter van Oostrum
sinnd...@gmail.com writes:

> Hi All,
> I am new to python.
> I have a irregular nested lists in a list.
> Please help me to iterate through each element.
>
> Thanks much in advance.
>
> Sample Ex
>
> aList = [[2,'jkj'],[],[],['kite',88,'ooo','pop','push','pull'],['hello']]
>
> expected output:
> 2,jkj,,,kite,88,ooo,pop,push,pull,hello
>

Use a recursive iterator/generator: It becomes a bit peculiar because you want 
special treatment for empty lists inside, but otherwise it is quite standard 
Python:

aList = [[2,'jkj'],[],[],['kite',88,'ooo','pop','push','pull'],['hello']]

def reclist(aList):
for item in aList:
if isinstance(item, list):
if item == []:
yield ''
else:
yield from reclist(item)
else:
yield item

for i in reclist(aList):
print(i, end=',')

This gives you an extra comma at the end, unfortunately. But it is the pattern 
for other types of processing.

Or use it like this:

print (','.join(str(i) for i in reclist(aList)))

--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


How to POST html data to be handled by a route endpoint

2020-03-07 Thread =?UTF-8?B?zp3Or866zr/PgiDOks6tz4HOs
First i must say i use Bottle, but the same may also be the case in Flask too. 
I ask here and not in sub Bottle because there are only a few people there and 
i receive no responses.

Actualy since i started here let me say what i have found.

Iam just trying to post html form data to the following endpoint.

@app.route( '/mailform', method=['POST'] )
IF i try to post the html form data using the the endpoint url way, i get 
"Method NOT Allowed" error:




WHILE if i try the following way, i receive no error.

 ...html...  ''' % app.get_url(
'/mailform )

Can someone explain why?!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread DL Neil via Python-list
On 7/03/20 2:33 AM, îØî-îºî¿ïé îÆî ïüî³î¿ïé wrote:
> First i must say i use Bottle, but the same may also be the case in Flask
too. I ask here and not in sub Bottle because there are only a few people there 
and i receive no responses.
>
> Actualy since i started here let me say what i have found.
>
> Iam just trying to post html form data to the following endpoint.
>
> @app.route( '/mailform', method=['POST'] )
> IF i try to post the html form data using the the endpoint url way, i get
"Method NOT Allowed" error:
>
> 
>
>
> WHILE if i try the following way, i receive no error.
>
>  ...html...  ''' % app.get_url(
'/mailform )
>
> Can someone explain why?!


Please post the full error message and traceback.

To clarify: is the error coming from Python or from the web server?

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


Re: Application setup like windows msi

2020-03-07 Thread Christian Gollwitzer
Am 05.03.20 um 02:48 schrieb Michael Torrie:
> On 3/4/20 4:51 PM, J A wrote:
>> I was wondering g if there was a way to distribute an application that took
>> advantage of user input like a windows .msi does. On linux of course.
>
> Several installer frameworks can make interactive installers for Linux.
> There's the NullSoft installer and InstallerVICE.  And quite a few
> commercial packages have rolled their own installers. Although I find
> installers of any kind of annoying on Linux and don't seem all that
> necessary.
>
+1!

On Linux, the most reasonable binary distribution is a .tar.bz2 package which 
extracts a folder with a startup script. This works on every Linux distribution 
and is one of the most common ways for Firefox etc. Of course, if you can 
afford to offer several packages, the other recommended way is packages for the 
system package manager - but this means it is system-dependent - or the newer 
things like flatpak and snap. However the tarball is the thing that always 
works, even for me as a user without root access.

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


iterate through an irregular nested list in Python

2020-03-07 Thread sinndhhu
Hi All,
I am new to python.
I have a irregular nested lists in a list. Please help me to iterate through 
each element.

Thanks much in advance.

Sample Ex

aList = [[2,'jkj'],[],[],['kite',88,'ooo','pop','push','pull'],['hello']]

expected output:
2,jkj,,,kite,88,ooo,pop,push,pull,hello
-- 
https://mail.python.org/mailman/listinfo/python-list


Python question

2020-03-07 Thread Mr . Lee Chiffre
Thank you Marco for at least taking the time to read my message even if you do 
not agree with me on things. And no disrespect to you. But I came here for 
python related questions and help. Not to be called suspicious and 
untrustworthy only because I am concerned about security of users and for being 
a advocate of privacy. Then to call for me to be censored is just ludicrous.


> People of Python List, I strongly discourage you to support this user.
> He is quite suspicious for the following reasons:
>
> 1. he go so far as he offers money for, IMHO, a trivial task

I said I am a python noob. This is why I asked for help. And I see no issue in 
offering payment for a programming task.

> 2. he does not trust binaries from pip.

What is the point of open source if you cannot compile from source code?

> code. A lack of trust in open source projects that is quite unusual
> 3. I don't trust any cryptocurrency.

Not unusual. People use open source because they dont trust closed source. 
Binaries that someone else compiled is not open source.

> I believe in privacy,  but not in financial privacy. Yes,
> cryptocurrencies can be useful for circumvent bans from tyrannic
> states. But they can, and _are_ used, primarily to:
>  - wash dirty money, by criminals and mafias
>  - evade taxes
>  - buy highly unethical "products", like weapons... and who know what
> other
>  - finance tyrannies.

Roads and cars are used by drug dealers. Stop using roads and cars. Cash is 
used by criminals. Stop using cash. Internet is used by child abusers. Stop 
supporting the internet. I am offended that you group me with criminals and 
baddies because I support technological privacy.


>
> I do _not_ think that all people that uses cryptocurrencies are
> criminals. I had, for example, some co-workers that invested in
> BitCoins, only for profit.
>
> But I do not trust this man, and I hope no one will offer support to
> him. By my side, I'll report this discussion to moderators.

That is fine if you dont like something. You dont have to help me out if you 
dont want to. But trying to censor me is unethical. Hopefully other people will 
have the logic to make decisions for themselves and give me help on python if 
they choose to do so.

I hope my reply does not get censored. I am being reasonable here. And if you 
are wondering why I am "paranoid", you would be too if you are dealing with a 
server that might host a hot wallet. I dont want my server getting hacked just 
because I was too lazy to compile my own code. And it is not uncommon for 
binaries of open source projects to be injected with malware.
-- 
https://mail.python.org/mailman/listinfo/python-list


Using zipfile to create a zip file with directories and files inside

2020-03-07 Thread Michael Torrie
I am trying to do something very simple but having no success in finding out 
how to do it. I just want to use the Python zipfile module to create a zip file 
with a specific directory structure and create and write to files inside those 
subdirectories (not files already on disk).  The documentation talks about 
writing files from disk, but I'm interested in creating these files from within 
Python directly in the zip archive. I've read over the docs several times but 
nothing speaks to this, and none of the examples I've searched for show this 
either.

I thought that in zip files, directories are really just part of the name of 
the file, and if unless you tell unzip not to, it creates them as files are 
extracted. So I naively thought I could use the "open" method of zipfile, 
giving it a relative path describing the relative path and file name that I 
want to then write bytes to.  But seems I am mistaken.  Is this a limitation of 
the zip format that cannot allow that sort of thing?  Must I resort to 
temporary files?

Plenty of examples on how to create an archive from existing files and 
directories on disk of course, which isn't what I want to do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Is there something similar to guidechimp in python?

2020-03-07 Thread Souvik Dutta
This is guidechimp -https://github.com/Labs64/GuideChimp Is there anything 
similar to this in python?
-- 
https://mail.python.org/mailman/listinfo/python-list


pip UX Studies - help improve the usability of pip

2020-03-07 Thread Bernard Tyers - Sane UX Design
Hi there,

My name is Bernard Tyers. I'm a UX designer and have recently started working 
on the PSF project to improve the usability of pip, funded by MOSS/CZI.

I want to let you know about the pip UX Studies we've started today, and 
encourage you to sign-up and take part.

The pip Team is looking for Python users who use pip to take part in our UX 
Studies. Your input will have a direct impact on improving pip.

We want to speak with as diverse a group as possible. We'd particularly like to 
speak with people with accessibility needs.

You _don't_ have to be a Python expert to take part - I can't stress this 
enough!

You can find out all the details you'll need and find the sign-up link on this 
blogpost:

http://www.ei8fdb.org/thoughts/2020/03/pip-ux-study-recruitment/

If you do have questions I've not answered there, let me know.

We'd also appreciate some signal boosting to reach as wide an audience as 
possible. Please share the blog post with people in different Python using 
communities.

If you're a Twitter/Mastodon user we'd appreciate a signal boost of these also:

https://twitter.com/bernardtyers/status/123603961730017
https://social.ei8fdb.org/@bernard/103778645553767728


Thank you for your attention!

Best wishes,

Bernard
--

Bernard Tyers, User research & Interaction Design

T: @bernardtyers
M: @bern...@social.ei8fdb.org
PGP Key: keybase.io/ei8fdb


I work on User-Centred Design, Open Source Software and Privacy.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using zipfile to create a zip file with directories and files

2020-03-07 Thread musbur
On Fri, 6 Mar 2020 20:06:40 -0700
Michael Torrie  wrote:

> The documentation talks about writing files from
> disk, but I'm interested in creating these files from within Python
> directly in the zip archive.

But you have seen writestr(), haven't you?

ZipFile.writestr(zinfo_or_arcname, data, compress_type=None, compresslevel=None)

Write a file into the archive. The contents is data, which may be
either a str or a bytes instance;

> So I naively thought I could use the "open"
> method of zipfile, giving it a relative path describing the relative
> path and file name that I want to then write bytes to.  But seems I am
> mistaken.

No your're not. writestr() and ZipInfo are your friends, unless I haven't 
understood what you're trying to do.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread Νίκος Βέργος
î¤î· î£î¬î²î²î±ïäî¿, 7 î£î±ïüïäî-î¿ïà 2020 - 12:34:21 ï .î¼. UTC+2, î¿
ïçïüîRïâïäî·ïé DL Neil î î³ïüî±ïêîµ:

> Please post the full error message and traceback.
>
> To clarify: is the error coming from Python or from the web server?


I beleive it comes from the web server. Here it is:

Error: 500 Internal Server Error
Sorry, the requested URL 'http://superhost.gr/mailform' caused an error:

Internal Server Error
Exception:
TypeError("argument of type 'NoneType' is not iterable",) Traceback:
Traceback (most recent call last):
  File "/home/nikos/wsgi/bottle.py", line 996, in _handle
out = route.call(**args)
  File "/home/nikos/wsgi/bottle.py", line 2007, in wrapper
rv = callback(*a, **ka)
  File "/home/nikos/wsgi/www.py", line 189, in mailform
if provider in FROM:
TypeError: argument of type 'NoneType' is not iterable


I somehow beleive that the following apache conf directives somehow create 
problem.

When superhost.gr/test tries to post html form data to the route endpoint
'/mailform' it sends it to superhost.gr/mailform and NOT at
superhost.gr/test/mailform as it should have done.

They somehow interfere.

Here is the processes running in the webserver that somehow interfere.


WSGIDaemonProcess test user=nikos group=nikos home=/home/nikos/wsgi
WSGIScriptAlias /test /home/nikos/wsgi/test.py process-group=test
application-group=%{GLOBAL}

WSGIDaemonProcess www user=nikos group=nikos home=/home/nikos/wsgi
WSGIScriptAliasMatch / /home/nikos/wsgi/www.py process-group=www
application-group=%{GLOBAL}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread Νίκος Βέργος
Τη Σάββατο, 7 Μαρτίου 2020 - 9:00:41 μ.μ. UTC+2, ο χρήστης DL Neil έγραψε:
> On 7/03/20 2:33 AM, îØî-îºî¿ïé îÆî ïüî³î¿ïé wrote:
> > First i must say i use Bottle, but the same may also be the case in Flask
> too. I ask here and not in sub Bottle because there are only a few people 
> there and i receive no responses.
> >
> > Actualy since i started here let me say what i have found.
> >
> > Iam just trying to post html form data to the following endpoint.
> >
> > @app.route( '/mailform', method=['POST'] )
> > IF i try to post the html form data using the the endpoint url way, i get
> "Method NOT Allowed" error:
> >
> > 
> >
> >
> > WHILE if i try the following way, i receive no error.
> >
> >  ...html...  ''' % app.get_url(
> '/mailform )
> >
> > Can someone explain why?!
> 
> 
> Please post the full error message and traceback.
> 
> To clarify: is the error coming from Python or from the web server?
> 
> --
> Regards =dn

Sorry, the requested URL 'http://superhost.gr/mailform' caused an error:

Internal Server Error
Exception:
TypeError("argument of type 'NoneType' is not iterable",)
Traceback:
Traceback (most recent call last):
  File "/home/nikos/wsgi/bottle.py", line 996, in _handle
out = route.call(**args)
  File "/home/nikos/wsgi/bottle.py", line 2007, in wrapper
rv = callback(*a, **ka)
  File "/home/nikos/wsgi/www.py", line 189, in mailform
if provider in FROM:
TypeError: argument of type 'NoneType' is not iterable
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using zipfile to create a zip file with directories and files

2020-03-07 Thread Michael Torrie
On 3/7/20 1:08 AM, mus...@posteo.org wrote:
> On Fri, 6 Mar 2020 20:06:40 -0700
> Michael Torrie  wrote:
>
>> The documentation talks about writing files from
>> disk, but I'm interested in creating these files from within Python
>> directly in the zip archive.
>
> But you have seen writestr(), haven't you?

Yes, that's what I was using.  Turns out I didn't look closely enough at the 
exception I was getting.  What i thought was zipfile complaining about a '/' 
character was really Python complaining about a bad string formatting string I 
was using!

Thanks for confirming that zipfile indeed should work the way I hoped it wood. 
I'm in business now.

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


Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread Νίκος Βέργος
You will see if you create a route endpoint called 'mailform' within '/' which 
is an alias of 'www.py' and you also have '/mailform' in 'superhost.gr/test' 
when the latter tries to post data to '/mailform' instead of sending them to
'superhost.gr/test/' it sends them to '/' which is 'superhost.gr'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to POST html data to be handled by a route endpoint

2020-03-07 Thread Richard Damon
On 3/7/20 5:15 AM, Νίκος Βέργος wrote:
> When superhost.gr/test tries to post html form data to the route endpoint 
> '/mailform' it sends it to superhost.gr/mailform and NOT at 
> superhost.gr/test/mailform as it should have done.
>
The HTML path /mailform means server relative path, so the path is
relative to the SERVER, not the current page, so it would be
superhost.gr/mailform

The other format goes through a function which might re-interpret the
path and either make it page relative or add in the path of the current
page to get to /test/mailform


-- 
Richard Damon

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


Re: The Real-Time Use of Python in Data Science World!

2020-03-07 Thread Perri Jones
Is this training that someone can sign up for, and if so, how do you sign up.


From: priyasudha041...@gmail.com 
Sent: Saturday, March 7, 2020 12:39 AM
To: python-announce-l...@python.org 
Subject: Re: The Real-Time Use of Python in Data Science World!

Besant Technologies providing Python Training in Chennai with expert guidance 
and fully hands-on classes. Python is a high-level programming language 
sometimes it also denoted as the scripting language as it provides rapid & fast 
development and easy of use. Our Python Training in Chennai package also 
includes job placement assistance, which is really a bonus point for students. 
We also help students in getting a good job by conducting interviews of ours 
with good IT companies and MNCs too.

https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.besanttechnologies.com%2Ftraining-courses%2Fpython-training-institute-in-chennai&data=02%7C01%7C%7Ca4d13696dfe649b76ba308d7c25dd7c2%7C84df9e7fe9f640afb435%7C1%7C0%7C637191580609217361&sdata=lRZZiFR6AWxUBu7r90lXNZNlITNSji80S%2Bp%2FVWRWbi8%3D&reserved=0
--
Python-announce-list mailing list -- python-announce-l...@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman3%2Flists%2Fpython-announce-list.python.org%2F&data=02%7C01%7C%7Ca4d13696dfe649b76ba308d7c25dd7c2%7C84df9e7fe9f640afb435%7C1%7C0%7C637191580609217361&sdata=%2FGx3A6KvX6%2FNRu2mkOwPty9n3Y8Z1tCX0Lmv1Ov1LcI%3D&reserved=0

Support the Python Software Foundation:

https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.python.org%2Fpsf%2Fdonations%2F&data=02%7C01%7C%7Ca4d13696dfe649b76ba308d7c25dd7c2%7C84df9e7fe9f640afb435%7C1%7C0%7C637191580609217361&sdata=iEYALDe6NXEt%2BzW9g%2BW4zqLQEJq9kxMPXTFl8nyeg3Q%3D&reserved=0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The Real-Time Use of Python in Data Science World!

2020-03-07 Thread Gene Heskett
On Saturday 07 March 2020 16:23:58 Perri Jones wrote:

> Is this training that someone can sign up for, and if so, how do you
> sign up.
This could be legit, but it sure smells like spam to me, so please meet 
sa-learn spam>
> 
> From: priyasudha041...@gmail.com 
> Sent: Saturday, March 7, 2020 12:39 AM
> To: python-announce-l...@python.org 
> Subject: Re: The Real-Time Use of Python in Data Science World!
>
> Besant Technologies providing Python Training in Chennai with expert
> guidance and fully hands-on classes. Python is a high-level
> programming language sometimes it also denoted as the scripting
> language as it provides rapid & fast development and easy of use. Our
> Python Training in Chennai package also includes job placement
> assistance, which is really a bonus point for students. We also help
> students in getting a good job by conducting interviews of ours with
> good IT companies and MNCs too.
>
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.
>besanttechnologies.com%2Ftraining-courses%2Fpython-training-institute-i
>n-chennai&data=02%7C01%7C%7Ca4d13696dfe649b76ba308d7c25dd7c2%7C84df
>9e7fe9f640afb435%7C1%7C0%7C637191580609217361&sdata=lRZ
>ZiFR6AWxUBu7r90lXNZNlITNSji80S%2Bp%2FVWRWbi8%3D&reserved=0 --
> Python-announce-list mailing list -- python-announce-l...@python.org
> To unsubscribe send an email to python-announce-list-le...@python.org
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail
>.python.org%2Fmailman3%2Flists%2Fpython-announce-list.python.org%2F&
>;data=02%7C01%7C%7Ca4d13696dfe649b76ba308d7c25dd7c2%7C84df9e7fe9f640afb
>435%7C1%7C0%7C637191580609217361&sdata=%2FGx3A6KvX6%2FN
>Ru2mkOwPty9n3Y8Z1tCX0Lmv1Ov1LcI%3D&reserved=0
>
> Support the Python Software Foundation:
>
> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.p
>ython.org%2Fpsf%2Fdonations%2F&data=02%7C01%7C%7Ca4d13696dfe649b76b
>a308d7c25dd7c2%7C84df9e7fe9f640afb435%7C1%7C0%7C63719158060
>9217361&sdata=iEYALDe6NXEt%2BzW9g%2BW4zqLQEJq9kxMPXTFl8nyeg3Q%3D&am
>p;reserved=0


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list