Re: Reading \n unescaped from a file

2015-09-06 Thread Peter Otten
Friedrich Rentsch wrote:

> My response was meant for the list, but went to Peter by mistake. So I
> repeat it with some delay:
> 
> On 09/03/2015 04:24 PM, Peter Otten wrote:
>> Friedrich Rentsch wrote:
>>
>>> On 09/03/2015 11:24 AM, Peter Otten wrote:
 Friedrich Rentsch wrote:
>>> I appreciate your identifying two mistakes. I am curious to know what
>>> they are.
>> Sorry for not being explicit.
>>
>substitutes = [self.table [item] for item in hits if
>item
> in valid_hits] + []  # Make lengths equal for zip to work right
 That looks wrong...
>> You are adding an empty list here. I wondered what you were trying to
>> achieve with that.
> Right you are! It doesn't do anything. I remember my idea was to pad the
> substitutes list by one, because the list of intervening text segments
> is longer by one element and zip uses the least common length,
> discarding all overhang. The remedy was totally ineffective and, what's
> more, not needed, judging by the way the editor performs as expected.

That's because you are getting the same effect later by adding

nohits[-1]

You could avoid that by replacing [] with [""].

>>> substitutes = list("12")
>>> nohits = list("abc")
>>> zipped = zip(nohits, substitutes)
>>> "".join(list(reduce(lambda a, b: a+b, [zipped][0]))) + nohits[-1]
'a1b2c'
>>> zipped = zip(nohits, substitutes + [""])
>>> "".join(list(reduce(lambda a, b: a+b, [zipped][0])))
'a1b2c'

By the way, even those who are into functional programming might find

>>> "".join(map("".join, zipped))
'a1b2c'

more readable.

But there's a more general change that I suggest: instead of processing the 
string twice, first to search for matches, then for the surrounding text you 
could achieve the same in one pass with a cool feature of the re.sub() 
method -- it accepts a function:

>>> def replace(text, replacements):
... table = dict(replacements)
... def substitute(match):
... return table[match.group()]
... regex = "|".join(re.escape(find) for find, replace in replacements)
... return re.compile(regex).sub(substitute, text)
... 
>>> replace("1 foo 2 bar 1 baz", [("1", "one"), ("2", "two")])
'one foo two bar one baz'


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


Can anyone help me run python scripts with http.server?

2015-09-06 Thread tropical . dude . net
Hello everyone,

I want to use python for web development but I
could not configure my Apache server to run python
with the guides I found on the internet.

Can anyone help me configure http.server
to run python scripts?

I ran the command python -m http.server --cgi to start the http server,
and if I put index.html, I will see the page but if I use
index.py, it doesn't show the page, I can only see the
directory listing of the files and when I click on 
index.py, it doesn't run the code, I can see it just
like in the editor.

Can anyone help me out?

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Laura Creighton
In a message of Sun, 06 Sep 2015 04:50:23 -0700, [email protected] wr
ites:
>Hello everyone,
>
>I want to use python for web development but I
>could not configure my Apache server to run python
>with the guides I found on the internet.
>
>Can anyone help me configure http.server
>to run python scripts?
>
>I ran the command python -m http.server --cgi to start the http server,
>and if I put index.html, I will see the page but if I use
>index.py, it doesn't show the page, I can only see the
>directory listing of the files and when I click on 
>index.py, it doesn't run the code, I can see it just
>like in the editor.
>
>Can anyone help me out?
>
>Thanks in advance.

What operating system are you running?  It sounds to me as if you haven't
configured apache to add a Handler for python scripts, or you have, but
forgot to restart apache after you did so.

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Chris Warrick
On 6 September 2015 at 13:50,   wrote:
> Hello everyone,
>
> I want to use python for web development but I
> could not configure my Apache server to run python
> with the guides I found on the internet.
>
> Can anyone help me configure http.server
> to run python scripts?
>
> I ran the command python -m http.server --cgi to start the http server,
> and if I put index.html, I will see the page but if I use
> index.py, it doesn't show the page, I can only see the
> directory listing of the files and when I click on
> index.py, it doesn't run the code, I can see it just
> like in the editor.
>
> Can anyone help me out?
>
> Thanks in advance.
> --
> https://mail.python.org/mailman/listinfo/python-list

Don’t use http.server. Don’t use CGI. This is not how things work in Python.

In Python, you should use a web framework to write your code. Web
frameworks include Flask, Django, Pyramid… Find one that’s popular and
that you like, and learn that. You won’t have any `.py` URLs, instead
you will have modern pretty URLs with no extensions. And a lot of
things will be abstracted — no manual header creation, help with safe
forms and databases.

And then you will need to figure out how to run it. I personally use
nginx and uwsgi for this, you may need to look for something else.

Examples for Django:

https://docs.djangoproject.com/en/1.8/#first-steps
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/

-- 
Chris Warrick 
PGP: 5EAAEA16
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Laura Creighton
In a message of Sun, 06 Sep 2015 14:16:37 +0200, Chris Warrick writes:
>Don’t use http.server. Don’t use CGI. This is not how things work in Python.
>
>In Python, you should use a web framework to write your code. Web
>frameworks include Flask, Django, Pyramid… Find one that’s popular and
>that you like, and learn that. You won’t have any `.py` URLs, instead
>you will have modern pretty URLs with no extensions. And a lot of
>things will be abstracted — no manual header creation, help with safe
>forms and databases.

This is really great advice, and if your idea is 'but I don't want
anything as _big_ as a framework, look at flask http://flask.pocoo.org/
and bottle http://bottlepy.org/docs/dev/index.html  both of which
are tiny microframeworks.

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Peter Otten
[email protected] wrote:

> I want to use python for web development but I
> could not configure my Apache server to run python
> with the guides I found on the internet.
> 
> Can anyone help me configure http.server
> to run python scripts?
> 
> I ran the command python -m http.server --cgi to start the http server,
> and if I put index.html, I will see the page but if I use
> index.py, it doesn't show the page, I can only see the
> directory listing of the files and when I click on
> index.py, it doesn't run the code, I can see it just
> like in the editor.
> 
> Can anyone help me out?

While in the long run you're better off if you follow Chris' advice here's a 
minimal cgi script run with http.server
(I'm using curl instead of a browser).

$ mkdir cgi-bin
$ echo -e '#!/usr/bin/env 
python3\nprint("Content-type:text/plain")\nprint()\nprint("Hello, world")' > 
cgi-bin/index.py
$ chmod u+x cgi-bin/index.py 
$ python3 -m http.server --cgi &
[1] 12345
$ Serving HTTP on 0.0.0.0 port 8000 ...

$ curl http://localhost:8000/cgi-bin/index.py
127.0.0.1 - - [06/Sep/2015 14:30:23] "GET /cgi-bin/index.py HTTP/1.1" 200 -
Hello, world
$ 


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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread tropical . dude . net
On Sunday, September 6, 2015 at 2:16:04 PM UTC+2, Laura Creighton wrote:
> In a message of Sun, 06 Sep 2015 04:50:23 -0700, [email protected] 
> wr
> ites:
> >Hello everyone,
> >
> >I want to use python for web development but I
> >could not configure my Apache server to run python
> >with the guides I found on the internet.
> >
> >Can anyone help me configure http.server
> >to run python scripts?
> >
> >I ran the command python -m http.server --cgi to start the http server,
> >and if I put index.html, I will see the page but if I use
> >index.py, it doesn't show the page, I can only see the
> >directory listing of the files and when I click on 
> >index.py, it doesn't run the code, I can see it just
> >like in the editor.
> >
> >Can anyone help me out?
> >
> >Thanks in advance.
> 
> What operating system are you running?  It sounds to me as if you haven't
> configured apache to add a Handler for python scripts, or you have, but
> forgot to restart apache after you did so.
> 
> Laura

I am using Windows 7, I followed the instructions, modified httpd.conf
many times, restarted apache many times till I gave up
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread tropical . dude . net
On Sunday, September 6, 2015 at 2:16:04 PM UTC+2, Laura Creighton wrote:
> In a message of Sun, 06 Sep 2015 04:50:23 -0700, [email protected] 
> wr
> ites:
> >Hello everyone,
> >
> >I want to use python for web development but I
> >could not configure my Apache server to run python
> >with the guides I found on the internet.
> >
> >Can anyone help me configure http.server
> >to run python scripts?
> >
> >I ran the command python -m http.server --cgi to start the http server,
> >and if I put index.html, I will see the page but if I use
> >index.py, it doesn't show the page, I can only see the
> >directory listing of the files and when I click on 
> >index.py, it doesn't run the code, I can see it just
> >like in the editor.
> >
> >Can anyone help me out?
> >
> >Thanks in advance.
> 
> What operating system are you running?  It sounds to me as if you haven't
> configured apache to add a Handler for python scripts, or you have, but
> forgot to restart apache after you did so.
> 
> Laura

I am using Windows 7, I followed the instructions, modified httpd.conf
many times, restarted apache many times till I gave up
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Peter Otten
Peter Otten wrote:

> [email protected] wrote:
> 
>> I want to use python for web development but I
>> could not configure my Apache server to run python
>> with the guides I found on the internet.
>> 
>> Can anyone help me configure http.server
>> to run python scripts?
>> 
>> I ran the command python -m http.server --cgi to start the http server,
>> and if I put index.html, I will see the page but if I use
>> index.py, it doesn't show the page, I can only see the
>> directory listing of the files and when I click on
>> index.py, it doesn't run the code, I can see it just
>> like in the editor.
>> 
>> Can anyone help me out?
> 
> While in the long run you're better off if you follow Chris' advice here's

and also in the short run (using the already mentioned bottle):

$ echo '#!/usr/bin/env python3
> import bottle
> @bottle.route("/into/the/blue/")
> def demo(name):
> return bottle.template("Hello, {{name}}", name=name)
> bottle.run()' > demo.py
$ python3 demo.py &
[2] 54321
$ Bottle v0.12.7 server starting up (using WSGIRefServer())...
Listening on http://127.0.0.1:8080/
Hit Ctrl-C to quit.


$ curl "http://localhost:8080/into/the/blue/Mountain";
127.0.0.1 - - [06/Sep/2015 14:41:44] "GET /into/the/blue/Mountain HTTP/1.1" 
200 15
Hello, Mountain$ curl "http://localhost:8080/into/the/blue/Green%20Pastries";
127.0.0.1 - - [06/Sep/2015 14:41:47] "GET /into/the/blue/Green%20Pastries 
HTTP/1.1" 200 21
Hello, Green Pastries$ 

> a minimal cgi script run with http.server (I'm using curl instead of a
> browser).
> 
> $ mkdir cgi-bin
> $ echo -e '#!/usr/bin/env
> python3\nprint("Content-type:text/plain")\nprint()\nprint("Hello, world")'
> > cgi-bin/index.py $ chmod u+x cgi-bin/index.py $ python3 -m http.server
> --cgi &
> [1] 12345
> $ Serving HTTP on 0.0.0.0 port 8000 ...
> 
> $ curl http://localhost:8000/cgi-bin/index.py
> 127.0.0.1 - - [06/Sep/2015 14:30:23] "GET /cgi-bin/index.py HTTP/1.1" 200
> - Hello, world
> $


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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread tropical . dude . net
On Sunday, September 6, 2015 at 2:16:04 PM UTC+2, Laura Creighton wrote:
> In a message of Sun, 06 Sep 2015 04:50:23 -0700, wr
> ites:
> >Hello everyone,
> >
> >I want to use python for web development but I
> >could not configure my Apache server to run python
> >with the guides I found on the internet.
> >
> >Can anyone help me configure http.server
> >to run python scripts?
> >
> >I ran the command python -m http.server --cgi to start the http server,
> >and if I put index.html, I will see the page but if I use
> >index.py, it doesn't show the page, I can only see the
> >directory listing of the files and when I click on 
> >index.py, it doesn't run the code, I can see it just
> >like in the editor.
> >
> >Can anyone help me out?
> >
> >Thanks in advance.
> 
> What operating system are you running?  It sounds to me as if you haven't
> configured apache to add a Handler for python scripts, or you have, but
> forgot to restart apache after you did so.
> 
> Laura

I am using Windows 7, I followed the instructions, modified httpd.conf
many times, restarted apache many times till I gave up 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Reading \n unescaped from a file

2015-09-06 Thread Friedrich Rentsch



On 09/06/2015 09:51 AM, Peter Otten wrote:

Friedrich Rentsch wrote:


My response was meant for the list, but went to Peter by mistake. So I
repeat it with some delay:

On 09/03/2015 04:24 PM, Peter Otten wrote:

Friedrich Rentsch wrote:


On 09/03/2015 11:24 AM, Peter Otten wrote:

Friedrich Rentsch wrote:

I appreciate your identifying two mistakes. I am curious to know what
they are.

Sorry for not being explicit.


substitutes = [self.table [item] for item in hits if
item
in valid_hits] + []  # Make lengths equal for zip to work right

That looks wrong...

You are adding an empty list here. I wondered what you were trying to
achieve with that.

Right you are! It doesn't do anything. I remember my idea was to pad the
substitutes list by one, because the list of intervening text segments
is longer by one element and zip uses the least common length,
discarding all overhang. The remedy was totally ineffective and, what's
more, not needed, judging by the way the editor performs as expected.

That's because you are getting the same effect later by adding

nohits[-1]

You could avoid that by replacing [] with [""].


substitutes = list("12")
nohits = list("abc")
zipped = zip(nohits, substitutes)
"".join(list(reduce(lambda a, b: a+b, [zipped][0]))) + nohits[-1]

'a1b2c'

zipped = zip(nohits, substitutes + [""])
"".join(list(reduce(lambda a, b: a+b, [zipped][0])))

'a1b2c'

By the way, even those who are into functional programming might find


"".join(map("".join, zipped))

'a1b2c'

more readable.

But there's a more general change that I suggest: instead of processing the
string twice, first to search for matches, then for the surrounding text you
could achieve the same in one pass with a cool feature of the re.sub()
method -- it accepts a function:


def replace(text, replacements):

... table = dict(replacements)
... def substitute(match):
... return table[match.group()]
... regex = "|".join(re.escape(find) for find, replace in replacements)
... return re.compile(regex).sub(substitute, text)
...

replace("1 foo 2 bar 1 baz", [("1", "one"), ("2", "two")])

'one foo two bar one baz'




I didn't think of using sub. But you're right. It is better, likely 
faster too. Building the regex reversed sorted will make it handle 
overlapping targets correctly, e.g.:


r = (
("1", "one"),
("2", "two"),
("12", "twelve"),
)

Your function as posted:

replace ('1 foo 2 bar 12 baz', r)
'one foo two bar onetwo baz'

regex = "|".join(re.escape(find) for find, replace in reversed (sorted 
(replacements)))


replace ('1 foo 2 bar 12 baz', r)
'one foo two bar twelve baz'

Thanks for the hints

Frederic

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Laura Creighton
In a message of Sun, 06 Sep 2015 05:38:50 -0700, [email protected] wr
ites:

>> What operating system are you running?  It sounds to me as if you haven't
>> configured apache to add a Handler for python scripts, or you have, but
>> forgot to restart apache after you did so.
>> 
>> Laura
>
>I am using Windows 7, I followed the instructions, modified httpd.conf
>many times, restarted apache many times till I gave up

I'm not a Windows user.  You are going to have to get help with this
from somebody else.

Though I forgot to send you this list:
https://wiki.python.org/moin/WebFrameworks/

if you decide that investigating Python web frameworks is what you want to
do.

Laura

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread tropical . dude . net
On Sunday, September 6, 2015 at 1:51:00 PM UTC+2, [email protected] wrote:
> Hello everyone,
> 
> I want to use python for web development but I
> could not configure my Apache server to run python
> with the guides I found on the internet.
> 
> Can anyone help me configure http.server
> to run python scripts?
> 
> I ran the command python -m http.server --cgi to start the http server,
> and if I put index.html, I will see the page but if I use
> index.py, it doesn't show the page, I can only see the
> directory listing of the files and when I click on 
> index.py, it doesn't run the code, I can see it just
> like in the editor.
> 
> Can anyone help me out?
> 
> Thanks in advance.

Thanks for the replies, I know of django, I even saw some
youtube videos about it but it seems very complicated to me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread tropical . dude . net
On Sunday, September 6, 2015 at 2:46:42 PM UTC+2, Laura Creighton wrote:
> In a message of Sun, 06 Sep 2015 05:38:50 -0700, [email protected] 
> wr
> ites:
> 
> >> What operating system are you running?  It sounds to me as if you haven't
> >> configured apache to add a Handler for python scripts, or you have, but
> >> forgot to restart apache after you did so.
> >> 
> >> Laura
> >
> >I am using Windows 7, I followed the instructions, modified httpd.conf
> >many times, restarted apache many times till I gave up
> 
> I'm not a Windows user.  You are going to have to get help with this
> from somebody else.
> 
> Though I forgot to send you this list:
> https://wiki.python.org/moin/WebFrameworks/
> 
> if you decide that investigating Python web frameworks is what you want to
> do.
> 
> Laura

Thank you very much.

I will definitely look into python web frameworks in the future, they seem
complicated to me compared to php for example. I am looking for the simplest
way to test my python scripts till I understand better how it works and when
I can configure my own web server to run the framework because I want develop my
stuff offline.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Chris Angelico
On Sun, Sep 6, 2015 at 11:07 PM,   wrote:
> I will definitely look into python web frameworks in the future, they seem
> complicated to me compared to php for example. I am looking for the simplest
> way to test my python scripts till I understand better how it works and when
> I can configure my own web server to run the framework because I want develop 
> my
> stuff offline.

Look into Flask. You can do something really simple:

https://github.com/Rosuav/MinstrelHall

All the code is in one file for simplicity, though for a larger
project, you can break it up as required. (Compared to PHP, where
you're _forced_ to have exactly one file per entry-point, this is a
nice flexibility.) Then I just have one line in my Apache config file
that looks something like this:

WSGIScriptAlias / /path/to/scripts/MinstrelHall/mh.wsgi

and Apache does all the rest. There's some cruft in that code to get
around a few oddities, but for the most part, writing a page is as
simple as writing a function, decorated to manage routing, that
returns render_template("somefile.html"). It's pretty easy.

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Laura Creighton
In a message of Sun, 06 Sep 2015 06:07:05 -0700, [email protected] wr
ites:
>Thank you very much.
>
>I will definitely look into python web frameworks in the future, they seem
>complicated to me compared to php for example. I am looking for the simplest
>way to test my python scripts till I understand better how it works and when
>I can configure my own web server to run the framework because I want develop 
>my
>stuff offline.

I think that bottle or flask won't seem complicated to you 

As I was walking around town it occurred to me to ask if you have
made your something.py file executable?  I don't even know if
apache on windows cares about such things, though if you are using cgi
and a unix like system you will need to do this.

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Chris Angelico
On Mon, Sep 7, 2015 at 1:03 AM, Laura Creighton  wrote:
> As I was walking around town it occurred to me to ask if you have
> made your something.py file executable?  I don't even know if
> apache on windows cares about such things, though if you are using cgi
> and a unix like system you will need to do this.

Windows doesn't have that concept, so it's not necessary.

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


Wheels For ...

2015-09-06 Thread Sven R. Kunze

Hi folks,

currently, I came across http://pythonwheels.com/ during researching how 
to make a proper Python distribution for PyPI. I thought it would be 
great idea to tell other maintainers to upload their content as wheels 
so I approached a couple of them. Some of them already provided wheels.


Happy being able to have built my own distribution, I discussed the 
issue at hand with some people and I would like to share my findings and 
propose some ideas:


1) documentation is weirdly split up/distributed and references old material
2) once up and running (setup.cfg, setup.py etc. etc.) it works but 
everybody needs to do it on their own

3) more than one way to do (upload, wheel, source/binary etc.) it (sigh)
4) making contact to propose wheels on github or per email is easy 
otherwise almost impossible or very tedious

5) reactions went evenly split from "none", "yes", "when ready" to "nope"

None: well, okay
yes: that's good
when ready: well, okay
nope: what a pity for wheels; example: 
https://github.com/simplejson/simplejson/issues/122


I personally find the situation not satisfying. Someone proposes the 
following solution in form of a question:


Why do developers need to build their distribution themselves?

I had not real answer to him, but pondering a while over it, I found it 
really insightful. Viewing this from a different angle, packaging your 
own distribution is actually a waste of time. It is a tedious, 
error-prone task involving no creativity whatsoever. Developers on the 
other hand are actually people with very little time and a lot of 
creativity at hand which should spend better. The logical conclusion 
would be that PyPI should build wheels for the developers for every 
python/platform combination necessary.



With this post, I would like raise awareness of the people in charge of 
the Python infrastructure.



Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list


Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Hi!

I took a look at tkinter. It is pretty simple but it's very hard to
construct some relatively more complex widgets.

So I looked at pmw.
Because my system only have pmw for python2, I downloaded pmw2 from its
site and installed it manually using pysetup.py install.

Trying the examples ...:
Some run fine.
Some just segfault!
Others crash with the folloing message:
"No such Pmw version 'on3-pmw-doc'. Using default version '2.0.0'"

Is there anybody using pmw who can explain possible reasons for this?

Should I use it for small apps that need:
1 or more canvas scrollable windows?
1 scrollable list with several (few) column editable fields?

Do I need to go to more complex system like wxwidgets or pyside (QT)?
I looked at the last one but, from the 1st steps, it seems too complex.

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


Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Michael Torrie
On 09/06/2015 12:47 PM, Paulo da Silva wrote:
> Do I need to go to more complex system like wxwidgets or pyside (QT)?
> I looked at the last one but, from the 1st steps, it seems too complex.

Before anyone can suggest toolkits to look at, what kind of GUI are you
trying to build?  What kind of "complex" widgets are you trying to
construct?  By their very nature "complex" widgets are going to be,
well, complex.   Do you need data-driven forms?

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


Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Laura Creighton
In a message of Sun, 06 Sep 2015 19:47:25 +0100, Paulo da Silva writes:
>Hi!
>
>I took a look at tkinter. It is pretty simple but it's very hard to
>construct some relatively more complex widgets.
>
>So I looked at pmw.
>Because my system only have pmw for python2, I downloaded pmw2 from its
>site and installed it manually using pysetup.py install.
>
>Trying the examples ...:
>Some run fine.
>Some just segfault!
>Others crash with the folloing message:
>   "No such Pmw version 'on3-pmw-doc'. Using default version '2.0.0'"
>
>Is there anybody using pmw who can explain possible reasons for this?
>
>Should I use it for small apps that need:
>   1 or more canvas scrollable windows?
>   1 scrollable list with several (few) column editable fields?
>
>Do I need to go to more complex system like wxwidgets or pyside (QT)?
>I looked at the last one but, from the 1st steps, it seems too complex.
>
>Thanks.

Did you get it from PyPI?
https://pypi.python.org/pypi/Pmw/2.0.0  ?

Last I heard Andy Robinson of reportlab had made it work with Python3.0,
so you might ask him about bizarre crashes.

You might also want to look at kivy, which works on desktops as well as
on mobile devices.  Get the examples directory and run the demos to see
if what it can do looks like what you want.

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


Re: Wheels For ...

2015-09-06 Thread Terry Reedy

On 9/6/2015 1:33 PM, Sven R. Kunze wrote:

Hi folks,

currently, I came across http://pythonwheels.com/ during researching how
to make a proper Python distribution for PyPI. I thought it would be
great idea to tell other maintainers to upload their content as wheels
so I approached a couple of them. Some of them already provided wheels.

Happy being able to have built my own distribution, I discussed the
issue at hand with some people and I would like to share my findings and
propose some ideas:

1) documentation is weirdly split up/distributed and references old
material
2) once up and running (setup.cfg, setup.py etc. etc.) it works but
everybody needs to do it on their own
3) more than one way to do (upload, wheel, source/binary etc.) it (sigh)
4) making contact to propose wheels on github or per email is easy
otherwise almost impossible or very tedious
5) reactions went evenly split from "none", "yes", "when ready" to "nope"

None: well, okay
yes: that's good
when ready: well, okay
nope: what a pity for wheels; example:
https://github.com/simplejson/simplejson/issues/122

I personally find the situation not satisfying. Someone proposes the
following solution in form of a question:

Why do developers need to build their distribution themselves?

I had not real answer to him, but pondering a while over it, I found it
really insightful. Viewing this from a different angle, packaging your
own distribution is actually a waste of time. It is a tedious,
error-prone task involving no creativity whatsoever. Developers on the
other hand are actually people with very little time and a lot of
creativity at hand which should spend better. The logical conclusion
would be that PyPI should build wheels for the developers for every
python/platform combination necessary.


With this post, I would like raise awareness of the people in charge of
the Python infrastructure.


pypa is in charge of packaging. https://github.com/pypa
I believe the google groups link is their discussion forum.

--
Terry Jan Reedy

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


Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Terry Reedy

On 9/6/2015 2:47 PM, Paulo da Silva wrote:

Hi!

I took a look at tkinter. It is pretty simple but it's very hard to
construct some relatively more complex widgets.

So I looked at pmw.
Because my system only have pmw for python2, I downloaded pmw2 from its
site and installed it manually using pysetup.py install.



Trying the examples ...:


First run Tools/Script/2to3.py to convert 2.x code to 3.x code. See the 
docstring.



Some run fine.
Some just segfault!
Others crash with the folloing message:
"No such Pmw version 'on3-pmw-doc'. Using default version '2.0.0'"

Is there anybody using pmw who can explain possible reasons for this?

Should I use it for small apps that need:
1 or more canvas scrollable windows?
1 scrollable list with several (few) column editable fields?

Do I need to go to more complex system like wxwidgets or pyside (QT)?
I looked at the last one but, from the 1st steps, it seems too complex.

Thanks.




--
Terry Jan Reedy

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


Re: Wheels For ...

2015-09-06 Thread Laura Creighton
In a message of Sun, 06 Sep 2015 15:31:16 -0400, Terry Reedy writes:
>On 9/6/2015 1:33 PM, Sven R. Kunze wrote:
>>
>> With this post, I would like raise awareness of the people in charge of
>> the Python infrastructure.
>
>pypa is in charge of packaging. https://github.com/pypa
>I believe the google groups link is their discussion forum.

They have one -- https://groups.google.com/forum/#!forum/pypa-dev
but you can also get them at the disutils mailing list.
https://mail.python.org/mailman/listinfo/distutils-sig

I think, rather than discussion, it is 'people willing to write code'
that they are short of ...

Laura

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


Re: Wheels For ...

2015-09-06 Thread Mark Lawrence

On 06/09/2015 20:31, Terry Reedy wrote:

On 9/6/2015 1:33 PM, Sven R. Kunze wrote:

With this post, I would like raise awareness of the people in charge of
the Python infrastructure.


pypa is in charge of packaging. https://github.com/pypa
I believe the google groups link is their discussion forum.



Or gmane.comp.python.pypa.devel

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Wheels For ...

2015-09-06 Thread Ned Batchelder
On Sunday, September 6, 2015 at 1:33:58 PM UTC-4, Sven R. Kunze wrote:
> 
> Why do developers need to build their distribution themselves?
> 
> ...
> 
> With this post, I would like raise awareness of the people in charge of 
> the Python infrastructure.

Sven, you ask a question, and then say you are trying to raise awareness.
Are you making a proposal?  It sounds like you might be implying that it
would be better if some central infrastructure group could make all the
distributions?

As a developer of a Python package, I don't see how this would be better.
The developer would still have to get their software into some kind of
uniform configuration, so the central authority could package it.  You've
moved the problem from, "everyone has to make wheels" to "everyone has to
make a tree that's structured properly."  But if we can do the second
thing, the first thing is really easy.

Maybe I've misunderstood?

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Denis McMahon
On Sun, 06 Sep 2015 23:23:14 +1000, Chris Angelico wrote:

> WSGIScriptAlias / /path/to/scripts/MinstrelHall/mh.wsgi

One wonders if the OP has mod_wsgi installed.

https://code.google.com/p/modwsgi/wiki/WhereToGetHelp might be useful too.

-- 
Denis McMahon, [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] Wheels For ...

2015-09-06 Thread Matthias Bussonnier
Hi Sven,

Just adding a few comments inline:

On Sun, Sep 6, 2015 at 7:33 PM, Sven R. Kunze  wrote:

> 3) more than one way to do (upload, wheel, source/binary etc.) it (sigh)

And most are uploading/registering over http (sight)

> nope: what a pity for wheels; example:
> https://github.com/simplejson/simplejson/issues/122

But that's for non pure-python wheels,
wheel can be universal, in which case they are easy to build.

> Why do developers need to build their distribution themselves?

Historical reason. On GitHub, at least it is pretty easy to make Travis-CI
build your wheels, some scientific packages (which are not the easier to build)
have done that, so automation is  possible. And these case need really
particular environements where all aspects of the builds are controlled.

>
> I had not real answer to him, but pondering a while over it, I found it
> really insightful. Viewing this from a different angle, packaging your own
> distribution is actually a waste of time. It is a tedious, error-prone task
> involving no creativity whatsoever. Developers on the other hand are
> actually people with very little time and a lot of creativity at hand which
> should spend better. The logical conclusion would be that PyPI should build
> wheels for the developers for every python/platform combination necessary.

I think that some of that could be done by warehouse at some point:
https://github.com/pypa/warehouse

But you will never be able to cover all. I'm sure people will ask PyPI
to build for windows 98 server version otherwise.

Personally for pure python packages I know use https://pypi.python.org/pypi/flit
which is one of the only packaging tools for which I can remember all the
step to get a package on PyPI without reading the docs.

-- 
M

[Sven, sorry for duplicate :-) ]
-- 
https://mail.python.org/mailman/listinfo/python-list


Django Calendar

2015-09-06 Thread cmeek . dev
Does anyone know of an easy to follow guide/tutorial to follow. I am trying to 
implement a calendar into my app that works as a job rota for employees. I have 
tried using django-scheduler and creating htmlcalendar but can not get either 
method to work
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-06 Thread pepekbabi5
idiomatic Python programming.  Those that try to program Java style in 
Python are going to be frustrated. 
-- 
https://mail.python.org/mailman/listinfo/python-list


python

2015-09-06 Thread babi pepek
I wand update
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Program in or into (was Python handles globals badly)

2015-09-06 Thread Ian Kelly
On Sat, Sep 5, 2015 at 8:54 PM, MRAB  wrote:
> And C# follows what Java does.

Except where the language designers recognized that the Java way was
poorly conceived or implemented and did it better. Generally speaking,
I would much prefer to work in C# over Java, if only the language
weren't so closely tied to .NET.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python

2015-09-06 Thread Steven D'Aprano
On Mon, 7 Sep 2015 09:09 am, babi pepek wrote:

> I wand update

Okay.

Is that a question, or are you just telling us?



-- 
Steven

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


Re: [Python-ideas] Wheels For ...

2015-09-06 Thread Ryan Gonzalez


On September 6, 2015 12:33:29 PM CDT, "Sven R. Kunze"  wrote:
>Hi folks,
>
>currently, I came across http://pythonwheels.com/ during researching
>how 
>to make a proper Python distribution for PyPI. I thought it would be 
>great idea to tell other maintainers to upload their content as wheels 
>so I approached a couple of them. Some of them already provided wheels.
>
>Happy being able to have built my own distribution, I discussed the 
>issue at hand with some people and I would like to share my findings
>and 
>propose some ideas:
>
>1) documentation is weirdly split up/distributed and references old
>material
>2) once up and running (setup.cfg, setup.py etc. etc.) it works but 
>everybody needs to do it on their own
>3) more than one way to do (upload, wheel, source/binary etc.) it
>(sigh)
>4) making contact to propose wheels on github or per email is easy 
>otherwise almost impossible or very tedious
>5) reactions went evenly split from "none", "yes", "when ready" to
>"nope"
>
>None: well, okay
>yes: that's good
>when ready: well, okay
>nope: what a pity for wheels; example: 
>https://github.com/simplejson/simplejson/issues/122
>
>I personally find the situation not satisfying. Someone proposes the 
>following solution in form of a question:
>
>Why do developers need to build their distribution themselves?
>
>I had not real answer to him, but pondering a while over it, I found it
>
>really insightful. Viewing this from a different angle, packaging your 
>own distribution is actually a waste of time. It is a tedious, 
>error-prone task involving no creativity whatsoever. Developers on the 
>other hand are actually people with very little time and a lot of 
>creativity at hand which should spend better. The logical conclusion 
>would be that PyPI should build wheels for the developers for every 
>python/platform combination necessary.
>

You can already do this with CI services. I wrote a post about doing that with 
AppVeyor:

http://kirbyfan64.github.io/posts/using-appveyor-to-distribute-python-wheels.html

but the idea behind it should apply easily to Travis and others. In reality, 
you're probably using a CI service to run your tests anyway, so it might as 
well build your wheels, too!

>
>With this post, I would like raise awareness of the people in charge of
>
>the Python infrastructure.
>
>
>Best,
>Sven
>___
>Python-ideas mailing list
>[email protected]
>https://mail.python.org/mailman/listinfo/python-ideas
>Code of Conduct: http://python.org/psf/codeofconduct/

-- 
Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Às 20:20 de 06-09-2015, Michael Torrie escreveu:
> On 09/06/2015 12:47 PM, Paulo da Silva wrote:
>> Do I need to go to more complex system like wxwidgets or pyside (QT)?
>> I looked at the last one but, from the 1st steps, it seems too complex.
> 
> Before anyone can suggest toolkits to look at, what kind of GUI are you
> trying to build?

It's in the post.
Simple widgets except for one multicolumn scrollable and editable list
and, in another case, a few grouped scrollable canvas.

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


Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Paulo da Silva
Às 20:27 de 06-09-2015, Laura Creighton escreveu:
> In a message of Sun, 06 Sep 2015 19:47:25 +0100, Paulo da Silva writes:
>> Hi!
>>
...

> 
> Did you get it from PyPI?
> https://pypi.python.org/pypi/Pmw/2.0.0  ?
I got it from sourceforge but I checked now and it has the same md5.

> 
> Last I heard Andy Robinson of reportlab had made it work with Python3.0,
> so you might ask him about bizarre crashes.
Yes. pmw 2 works with python3. I saw in setup.py the code to install for
python2 and python3 depending on the python interpreter used.
And it is correctly installed in my python3 system. Some examples work
perfectly.
I have sent an email to Andy.

> 
> You might also want to look at kivy, which works on desktops as well as
> on mobile devices.  Get the examples directory and run the demos to see
> if what it can do looks like what you want.
> 
I have just installed it and successfully was able to run the 1st.
example. It has the big advantage of being portable to android!!

Thank you Laura for your suggestions.

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Chris Angelico
On Mon, Sep 7, 2015 at 6:04 AM, Denis McMahon  wrote:
> On Sun, 06 Sep 2015 23:23:14 +1000, Chris Angelico wrote:
>
>> WSGIScriptAlias / /path/to/scripts/MinstrelHall/mh.wsgi
>
> One wonders if the OP has mod_wsgi installed.
>
> https://code.google.com/p/modwsgi/wiki/WhereToGetHelp might be useful too.

Yes, that is a consideration. But hopefully the OP can explore some
possibilities and get to some more specific questions like "Apache is
complaining that WSGIScriptAlias is an unknown directive - how do I
correct this?", which are easily answered with a web search or a quick
post to some forum (preferably an Apache-related one, as this isn't a
Python question).

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


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Cameron Simpson

On 06Sep2015 23:23, Chris Angelico  wrote:

On Sun, Sep 6, 2015 at 11:07 PM,   wrote:

I will definitely look into python web frameworks in the future, they seem
complicated to me compared to php for example. I am looking for the simplest
way to test my python scripts till I understand better how it works and when
I can configure my own web server to run the framework because I want develop my
stuff offline.


Look into Flask. You can do something really simple:
https://github.com/Rosuav/MinstrelHall

All the code is in one file for simplicity, though for a larger
project, you can break it up as required. (Compared to PHP, where
you're _forced_ to have exactly one file per entry-point, this is a
nice flexibility.) Then I just have one line in my Apache config file
that looks something like this:

WSGIScriptAlias / /path/to/scripts/MinstrelHall/mh.wsgi

and Apache does all the rest. There's some cruft in that code to get
around a few oddities, but for the most part, writing a page is as
simple as writing a function, decorated to manage routing, that
returns render_template("somefile.html"). It's pretty easy.


Another nice thing about Flask is that you can run it standalone without 
Apache. I'm knocking something together right now using Flask, and I'm 
intending to run it without Apache at all. There'll be an haproxy in front of 
it for other reasons, but to get off the ground you don't even need that.


Cheers,
Cameron Simpson 

If you take something apart and put it back together again enough times, you
will eventually have enough parts left over to build a second one.
   - Ayse Sercan 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Can anyone help me run python scripts with http.server?

2015-09-06 Thread Chris Angelico
On Mon, Sep 7, 2015 at 2:05 PM, Cameron Simpson  wrote:
> Another nice thing about Flask is that you can run it standalone without
> Apache. I'm knocking something together right now using Flask, and I'm
> intending to run it without Apache at all. There'll be an haproxy in front
> of it for other reasons, but to get off the ground you don't even need that.

Running a Flask app standalone is, if I'm not mistaken, good for
low-traffic usage only. Makes it absolutely ideal for debugging, but
not so great for production work. But since you don't have to change a
single line of application code to slot it into Apache, and presumably
likewise for working with haproxy or anything else, it's a worthwhile
simplicity.

I've taken a good number of students through a Python web programming
course, and we use Flask all the way. Testing? "python run.py".
Production? "git push heroku master". No effort required, no careful
juggling of "this bit makes it work in production".

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


Re: Trying pmw with python3: Lots of crashes!

2015-09-06 Thread Christian Gollwitzer

Am 07.09.15 um 03:40 schrieb Paulo da Silva:

Às 20:20 de 06-09-2015, Michael Torrie escreveu:

On 09/06/2015 12:47 PM, Paulo da Silva wrote:

Do I need to go to more complex system like wxwidgets or pyside (QT)?
I looked at the last one but, from the 1st steps, it seems too complex.


Before anyone can suggest toolkits to look at, what kind of GUI are you
trying to build?


It's in the post.
Simple widgets except for one multicolumn scrollable and editable list
and, in another case, a few grouped scrollable canvas.

For a multicolumn editable list I suggest using tablelist. There are 
Python bindings around. Scrolling in Tk is generally done by grouping 
together scrollbars and widgets in a frame and connecting the scrollbars 
scrollcommands with xview/yview.


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


Re: python

2015-09-06 Thread Tim Chase
On 2015-09-06 16:09, babi pepek wrote:
> I wand update

Use pip.  It's like a magic wand.

http://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip

-tkc




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