Re: This formating is really tricky

2014-08-26 Thread Larry Hudson

On 08/25/2014 08:14 PM, Seymore4Head wrote:
[snip]

There is lots of help built in.  Trying to read all the options makes
me realize the stuff I am working on is just the tip of the iceberg.
When checking the help function, it is clear I will never get to about
90% of the features.

Thanks



That's why we keep telling you to FIRST go through a basic tutorial.  It will start at the 
beginning and work up.  You will really find you will learn the language that way much MUCH 
faster than trying to pick things up piecemeal by asking totally isolated questions.


And... (from another post)

> pb2=random.choice([1-53])
>
> I included my shortcut for pb2.  It doesn't work?  Is there a short to
> prevent from listing each number?

Of course it doesn't work!  That list has only one element, the integer -52.

Now go through a tutorial to find out what to do about it.

 -=- Larry -=-

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


Re: Reading from sys.stdin reads the whole file in

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 4:37 PM, Steven D'Aprano  wrote:
> On Wed, 27 Aug 2014 08:29:20 +0300, Marko Rauhamaa wrote:
>
>> Try flushing after each print.
>
> Doesn't help.

It does, but insufficiently. If slurp.py is run under Py3, it works
fine; or take Naoki's suggestion (although without the parens):

import sys
import time

for line in iter(sys.stdin.readline, ''):
print "Time of input:", time.ctime(), line
sys.stdin.flush()
sys.stdout.flush()

Then it works.

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


Re: Reading from sys.stdin reads the whole file in

2014-08-26 Thread Steven D'Aprano
On Wed, 27 Aug 2014 08:29:20 +0300, Marko Rauhamaa wrote:

> Steven D'Aprano :
> 
>> When I pipe one to the other, I expect each line to be printed as they
>> arrive, but instead they all queue up and happen at once:
> 
> Try flushing after each print.

Doesn't help.

Here is an update that may make the problem more clear:

steve@runes:~$ cat out.py
import time
import sys

print "Time of output:", time.ctime()
sys.stdout.flush()
time.sleep(10)
print "Time of output:", time.ctime()
sys.stdout.flush()
time.sleep(10)
print "Time of output:", time.ctime()

steve@runes:~$ cat slurp.py 
import sys
import time

for line in sys.stdin:
print "Time of input:", time.ctime(), line
sys.stdin.flush()
sys.stdout.flush()



And the results:

steve@runes:~$ python out.py | python slurp.py 
Time of input: Wed Aug 27 16:35:48 2014 Time of output: Wed Aug 27 16:35:28 2014

Time of input: Wed Aug 27 16:35:48 2014 Time of output: Wed Aug 27 16:35:38 2014

Time of input: Wed Aug 27 16:35:48 2014 Time of output: Wed Aug 27 16:35:48 2014


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


Re: Python vs C++

2014-08-26 Thread Ian Kelly
On Wed, Aug 27, 2014 at 12:23 AM, Ian Kelly  wrote:
> On Tue, Aug 26, 2014 at 11:43 PM, alex23  wrote:
>> On 26/08/2014 6:12 PM, Amirouche Boubekki wrote:
>>>
>>> 2014-08-26 6:02 GMT+02:00 Ian Kelly >> >:
>>>
>>> It would be just as easy or easier in Python, or one could save a
>>> lot more effort by just using RPG Maker like every other indie RPG
>>> developer seems to do.
>>>
>>> I don't think there is FLOSS equivalent.
>>
>>
>> There is indeed:
>>
>> http://openrpgmaker.sourceforge.net/
>
> Ugh. There seems to be no public repository, and the only source to be
> found is from release-versioned tarballs, so there's apparently no
> collaboration other than some forums for reporting bugs and requesting
> features. All the work is done by one developer in his spare time, and
> he is currently on hiatus since April. Meanwhile the most recent
> release is February, so it's not like somebody could just pick it up
> and start hacking and expect to merge.
>
> That's only open-source under the most literal of definitions.

And the license is GPL, which I think is an unfortunate choice for a
game maker, since it probably means that any games developed using it
must themselves be distributed libre and open-source.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-26 Thread Ian Kelly
On Tue, Aug 26, 2014 at 11:43 PM, alex23  wrote:
> On 26/08/2014 6:12 PM, Amirouche Boubekki wrote:
>>
>> 2014-08-26 6:02 GMT+02:00 Ian Kelly > >:
>>
>> It would be just as easy or easier in Python, or one could save a
>> lot more effort by just using RPG Maker like every other indie RPG
>> developer seems to do.
>>
>> I don't think there is FLOSS equivalent.
>
>
> There is indeed:
>
> http://openrpgmaker.sourceforge.net/

Ugh. There seems to be no public repository, and the only source to be
found is from release-versioned tarballs, so there's apparently no
collaboration other than some forums for reporting bugs and requesting
features. All the work is done by one developer in his spare time, and
he is currently on hiatus since April. Meanwhile the most recent
release is February, so it's not like somebody could just pick it up
and start hacking and expect to merge.

That's only open-source under the most literal of definitions.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Reading from sys.stdin reads the whole file in

2014-08-26 Thread Naoki INADA
I recommend Python 3.

On Python 2, iterating lines without buffering is slow, tricky and ugly.




for line in iter(sys.stdin.readline(), ''):

    print line
—
Sent from Mailbox

On Wed, Aug 27, 2014 at 3:03 PM, Chris Angelico  wrote:

> On Wed, Aug 27, 2014 at 3:19 PM, Steven D'Aprano  wrote:
>> When I pipe one to the other, I expect each line to be printed as they
>> arrive, but instead they all queue up and happen at once:
> You're seeing two different problems here. One is the flushing of
> stdout in out.py, as Marko mentioned, but it's easily proven that
> that's not the whole issue. Compare "python out.py" and "python
> out.py|cat" - the latter will demonstrate whether or not it's getting
> flushed properly (the former, where stdout is a tty, will always flush
> correctly).
> But even with that sorted, iterating over stdin has issues in Python
> 2. Here's a tweaked version of your files (note that I cut the sleeps
> to 2 seconds, but the effect is the same):
> rosuav@sikorsky:~$ cat out.py
> import time
> print("Hello...",flush=True)
> time.sleep(2)
> print("World!",flush=True)
> time.sleep(2)
> print("Goodbye!",flush=True)
> rosuav@sikorsky:~$ cat slurp.py
> from __future__ import print_function
> import sys
> import time
> for line in sys.stdin:
> print(time.ctime(), line)
> rosuav@sikorsky:~$ python3 out.py|python slurp.py
> Wed Aug 27 16:00:16 2014 Hello...
> Wed Aug 27 16:00:16 2014 World!
> Wed Aug 27 16:00:16 2014 Goodbye!
> rosuav@sikorsky:~$ python3 out.py|python3 slurp.py
> Wed Aug 27 16:00:19 2014 Hello...
> Wed Aug 27 16:00:21 2014 World!
> Wed Aug 27 16:00:23 2014 Goodbye!
> rosuav@sikorsky:~$
> With a Py2 consumer, there's still buffering happening. With a Py3
> consumer, it works correctly. How to control the Py2 buffering,
> though, I don't know.
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Reading from sys.stdin reads the whole file in

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 3:19 PM, Steven D'Aprano  wrote:
> When I pipe one to the other, I expect each line to be printed as they
> arrive, but instead they all queue up and happen at once:

You're seeing two different problems here. One is the flushing of
stdout in out.py, as Marko mentioned, but it's easily proven that
that's not the whole issue. Compare "python out.py" and "python
out.py|cat" - the latter will demonstrate whether or not it's getting
flushed properly (the former, where stdout is a tty, will always flush
correctly).

But even with that sorted, iterating over stdin has issues in Python
2. Here's a tweaked version of your files (note that I cut the sleeps
to 2 seconds, but the effect is the same):

rosuav@sikorsky:~$ cat out.py
import time

print("Hello...",flush=True)
time.sleep(2)
print("World!",flush=True)
time.sleep(2)
print("Goodbye!",flush=True)
rosuav@sikorsky:~$ cat slurp.py
from __future__ import print_function
import sys
import time

for line in sys.stdin:
print(time.ctime(), line)
rosuav@sikorsky:~$ python3 out.py|python slurp.py
Wed Aug 27 16:00:16 2014 Hello...

Wed Aug 27 16:00:16 2014 World!

Wed Aug 27 16:00:16 2014 Goodbye!

rosuav@sikorsky:~$ python3 out.py|python3 slurp.py
Wed Aug 27 16:00:19 2014 Hello...

Wed Aug 27 16:00:21 2014 World!

Wed Aug 27 16:00:23 2014 Goodbye!

rosuav@sikorsky:~$


With a Py2 consumer, there's still buffering happening. With a Py3
consumer, it works correctly. How to control the Py2 buffering,
though, I don't know.

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


Re: Python vs C++

2014-08-26 Thread alex23

On 26/08/2014 6:12 PM, Amirouche Boubekki wrote:

2014-08-26 6:02 GMT+02:00 Ian Kelly mailto:ian.g.ke...@gmail.com>>:
It would be just as easy or easier in Python, or one could save a
lot more effort by just using RPG Maker like every other indie RPG
developer seems to do.

I don't think there is FLOSS equivalent.


There is indeed:

http://openrpgmaker.sourceforge.net/
--
https://mail.python.org/mailman/listinfo/python-list


Re: Reading from sys.stdin reads the whole file in

2014-08-26 Thread Marko Rauhamaa
Marko Rauhamaa :

> Try flushing after each print.

   http://stackoverflow.com/questions/230751/how-to-flush-ou
   tput-of-python-print>

   Since Python 3.3, there is no need to use sys.stdout.flush():

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)


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


Re: Reading from sys.stdin reads the whole file in

2014-08-26 Thread Marko Rauhamaa
Steven D'Aprano :

> When I pipe one to the other, I expect each line to be printed as they
> arrive, but instead they all queue up and happen at once:

Try flushing after each print.

When sys.stdout is a pipe, flushing happens only when the internal
buffer fills up.


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


Reading from sys.stdin reads the whole file in

2014-08-26 Thread Steven D'Aprano
I'm trying to read from stdin. Here I simulate a process that slowly 
outputs data to stdout:

steve@runes:~$ cat out.py
import time

print "Hello..."
time.sleep(10)
print "World!"
time.sleep(10)
print "Goodbye!"


and another process that reads from stdin:

steve@runes:~$ cat slurp.py 
import sys
import time

for line in sys.stdin:
print time.ctime(), line



When I pipe one to the other, I expect each line to be printed as they 
arrive, but instead they all queue up and happen at once:


steve@runes:~$ python out.py | python slurp.py 
Wed Aug 27 15:13:44 2014 Hello...

Wed Aug 27 15:13:44 2014 World!

Wed Aug 27 15:13:44 2014 Goodbye!



(Note how the time stamps are all together, instead of ten seconds apart.)


Why is this happening?

How can I read from sys.stdin "on the fly", so to speak, without waiting 
for the first process to end?

Is there established terminology for talking about this sort of thing?



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


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 1:13 PM, Rustom Mody  wrote:
> On Wednesday, August 27, 2014 8:06:24 AM UTC+5:30, Chris Angelico wrote:
>> On Wed, Aug 27, 2014 at 10:58 AM, Twirlip2  wrote:
>> > So, please give me a few weeks to improve my code, before posting it. (I
>> > recently came across somewhere on the Web where you can post code, but I
>> > forget where.)
>
>> If you're looking for hosting, I recommend one of the source control
>> hosting sites - github.com (for git), bitbucket.org (for hg), etc.
>
> Bitbucket has both git and hg with git the default (nowadays). And it
> has free private repos (shareable by upto 5); with github you have to
> pay through your nose.

"etc". :)

Also, why bother with private repos, if you're using this as a means
of posting code? Just post public repos. I have a lot of them:

https://github.com/Rosuav

Quite a few aren't of great interest to most people, but there's
nothing secret there.

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


Re: help! about pypcap.dispatch

2014-08-26 Thread Simmen
在 2014年8月26日星期二UTC+8下午10时45分15秒,Chris Angelico写道:
 
> Where did pcap.pyx come from? What version is it? Is it something that
> 
> was written for an ancient version of Python? It might be raising a
> 
> string exception.
> 
> 
> 
> ChrisA

thank you for your reply! 

sorry for the terrible question, I install both libpcap 1.4.0 and pypcap 1.1.1, 
and it seems the pypcap does not support python2.7. I'll try scapy instead.

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Terry Reedy

On 8/26/2014 9:11 PM, Twirlip2 wrote:

On Wednesday, 27 August 2014 01:51:20 UTC+1, Terry Reedy  wrote:

On 8/26/2014 7:29 PM, Twirlip2 wrote:

On Wednesday, 27 August 2014 00:20:56 UTC+1, Mark Lawrence  wrote:

Another lesson is that google grops is crap [...]

You read my mind! (See parenthetical note at end of my most recent post.)

You can access python-list (and a few thousand other tech lists as an
nntp newsgroup via news.gmane.com. If you check headers, you will see
that this is what I (and many others) do.


That sounds good, and I'd like to try it (tomorrow!), but:

"Server not found
Firefox can't find the server at news.gmane.com.


sorry. .org
This is gmane.comp.python.general

--
Terry Jan Reedy

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


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Rustom Mody
On Wednesday, August 27, 2014 8:06:24 AM UTC+5:30, Chris Angelico wrote:
> On Wed, Aug 27, 2014 at 10:58 AM, Twirlip2  wrote:
> > So, please give me a few weeks to improve my code, before posting it. (I
> > recently came across somewhere on the Web where you can post code, but I
> > forget where.)

> If you're looking for hosting, I recommend one of the source control
> hosting sites - github.com (for git), bitbucket.org (for hg), etc.

Bitbucket has both git and hg with git the default (nowadays). And it
has free private repos (shareable by upto 5); with github you have to
pay through your nose.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help! about pypcap.dispatch

2014-08-26 Thread Simmen
在 2014年8月26日星期二UTC+8下午10时45分15秒,Chris Angelico写道:


> Where did pcap.pyx come from? What version is it? Is it something that
> 
> was written for an ancient version of Python? It might be raising a
> 
> string exception.
> 
> 
> 
> ChrisA

thank you for your reply!

sorry for the terrible question, I install both libpcap 1.4.0 and pypcap 1.1.1, 
and it seems the pypcap does not support python2.7. Is there any pcap packet 
support python 2.7, or I must capture packet with socket?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 10:58 AM, Twirlip2  wrote:
> So, please give me a few weeks to improve my code, before posting it. (I
> recently came across somewhere on the Web where you can post code, but I
> forget where.)

If you're looking for hosting, I recommend one of the source control
hosting sites - github.com (for git), bitbucket.org (for hg), etc.
They generally have more facilities than just "a place to post code";
with GitHub, which I use extensively, you get issue tracker and such
as part of the package. If you're not already using some kind of local
source control, I recommend either git or hg, and most importantly, I
recommend actually using source control, because you'll be glad of it
:)

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Wednesday, 27 August 2014 01:51:20 UTC+1, Terry Reedy  wrote:
> On 8/26/2014 7:29 PM, Twirlip2 wrote:
> > On Wednesday, 27 August 2014 00:20:56 UTC+1, Mark Lawrence  wrote:
> >> Another lesson is that google grops is crap [...]
> > You read my mind! (See parenthetical note at end of my most recent post.)
> You can access python-list (and a few thousand other tech lists as an 
> nntp newsgroup via news.gmane.com. If you check headers, you will see 
> that this is what I (and many others) do.

That sounds good, and I'd like to try it (tomorrow!), but:

"Server not found
Firefox can't find the server at news.gmane.com.
Check the address for typing errors [...]"

Sorry if I've just done something silly again.

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


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Twirlip2
On Wednesday, 27 August 2014 01:58:16 UTC+1, Twirlip2  wrote:

> It's a mess, but
> it does at least keep local dependencies in a configuration file. (I
> had no trouble getting it to run on two different PCs, under both XP
> and Win98SE - and, if I recall correctly, also Vista, but I never use
> that laptop.)

Correction: in my tiredness (it really is past my bedtime, and it's been
a long day), I was confusing the present Python-based system with my old
Windows batch file.  I only have the Python code going on my two XP
machines (and I think on the Vista laptop as well). I don't anticipate
any difficulty in converting the Python 3 code to Python 2, so that it
can run in under Win98SE (where I don't want to reinstall anything, in
case Windows doesn't play nice, and wrecks my dual-boot setup), but I
haven't actually got around to doing it yet. (Also it would probably be
better to wait until I've improved the Python 3 version; I can manage
without radio listening on the infrequent occasions when I still boot
into Win98SE.)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Twirlip2
On Wednesday, 27 August 2014 01:21:32 UTC+1, Chris Angelico  wrote:
> On Wed, Aug 27, 2014 at 10:08 AM, Twirlip2 wrote:
> > On Wednesday, 27 August 2014 01:04:18 UTC+1, Steven D'Aprano  wrote:
> >> Twirlip2 wrote:
> >> >
> >> > Since I require Python in order to listen to my beloved radio
> >> > programmes reliably (don't get me started on the subject of the
> >> > thrice-accursed BBC website!), I therefore have IDLE running all the
> >> > time, very probably sometimes for weeks on end.
> 
> >> Well, don't keep us in suspenders, tell us what you use!
> 
> > Sorry, I don't understand. [...]
> 
> [...] But
> the rest of the question is serious. What is it you do with Idle that
> lets you listen to the radio reliably? I'm guessing this is streamed
> over the internet and you're getting around some stupid limitation,
> but I second Steven's request that you share your tricks!

I'm happy to oblige, but: (1) it's past my bedtime, so I'll have to be
brief; (2) the background, concerning the BBC's "Listen Again" facility,
is quite complicated; and (3) my present Python code is simply awful (it
was my first serious Python program, apart from a few short mathematical
routines for computing values of some complex analytic functions), which
is why, during the last week or so, I've been dipping into Chun's book
on Python, reading through Bertrand Meyer's 'Object-Oriented Software
Construction' (2nd ed. 1997), and trying to reorganised my awful code
into classes and smaller modules, so that I can begin to rewrite it in
a more robust way (i.e. (a) it will work more robustly, and (b) it also
won't fall apart as soon as I try to change it).

So, please give me a few weeks to improve my code, before posting it. (I
recently came across somewhere on the Web where you can post code, but I
forget where.)

As for the background:

All I used to need to use was a simple Windows batch file (of course, a
simple Python script would have been better, but there was no real need
for it) which called XMPlay with some WMA audio stream URLs, which were
easily calculable from the day of the week and the time of day at which
the desired programme was transmitted.

But a few months ago, the BBC, in their wisdom, changed all that, in such
a way that it is now logically impossible to calculate the WMA audio stream
URLs from any information available to anyone except a BBC technical insider.

A more sophisticated approach therefore became necessary.

At the Beebotron, where I post under the pseudonym 'Matamore!' (named after
a deluded grandiose lunatic, if you must know!), there was a very long and
convoluted discussion about the problem.  Here is the thread (but you won't
thank me for pointing you to something so rambling!):


"No international streams after 9:30am 01-May-2014"

I followed some of the suggestions made in that thread, by people more
knowledgeable than myself, and set about using Python to automate the
manual procedures they described.  I just hacked the code together [in
one of the two pejorative senses of the verb "to hack"!] - in a single
module, with dozens of global variables, precious little error-checking,
and an idiotic dependence on the BBC not changing any detail of their
website (in spite of the fact that they muck about with it regularly!).

Still, the code works, well enough that I can rely on it for my daily
fix of radio.  It would probably even work for anyone else who tried
it (on Windows, Linux, or just about any other OS). It's a mess, but
it does at least keep local dependencies in a configuration file. (I
had no trouble getting it to run on two different PCs, under both XP
and Win98SE - and, if I recall correctly, also Vista, but I never use
that laptop.)

It just pulls a lot of HTML and XML from the website, and extracts the
addresses of various other pages, and eventually *.WMA streams, and
hands the stream URLs over to XMPlay .

It 'knows' what pages to visit, because I have manually built up a plain
text file containing a list of (at the moment) 274 BBC radio programmes,
represented by 579 different mnemonic key strings - of which the user
only needs to type in a sufficiently long initial segment to disambiguate.

Anyone else could use the same list, or build up their own, or use mine as
a basis for their own. (I just maintain it using a text editor.  I haven't
[yet] attempted to do any database programming.)

I have plenty of ideas for improving the program, but first I have to
re-organise the present spaghetti code in a more logical fashion.

That's what I've been doing for the last week or so.

(Did I say I'd be brief?  Z...)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Terry Reedy

On 8/26/2014 7:29 PM, Twirlip2 wrote:

On Wednesday, 27 August 2014 00:20:56 UTC+1, Mark Lawrence  wrote:


Another lesson is that google grops is crap [...]


You read my mind! (See parenthetical note at end of my most recent post.)


You can access python-list (and a few thousand other tech lists as an 
nntp newsgroup via news.gmane.com. If you check headers, you will see 
that this is what I (and many others) do.


--
Terry Jan Reedy

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


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 10:08 AM, Twirlip2  wrote:
> On Wednesday, 27 August 2014 01:04:18 UTC+1, Steven D'Aprano  wrote:
>
>> Twirlip2 wrote:
>>
>> > Since I require Python in order to listen to my beloved radio programmes
>> > reliably (don't get me started on the subject of the thrice-accursed BBC
>> > website!), I therefore have IDLE running all the time, very probably
>> > sometimes for weeks on end.
>>
>> Well, don't keep us in suspenders, tell us what you use!
>
> Sorry, I don't understand.
>
> (Unless it's a Monty Python quote?  I never wanted to be a computer 
> programmer, anyway.  I wanted to be a ...)

I'm assuming the "in suspenders" part is either Monty Python or Fawlty
Towers (normally people would say "don't keep us in suspense"). But
the rest of the question is serious. What is it you do with Idle that
lets you listen to the radio reliably? I'm guessing this is streamed
over the internet and you're getting around some stupid limitation,
but I second Steven's request that you share your tricks!

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 10:01 AM, Steven D'Aprano
 wrote:
> Gregory Ewing wrote:
>
>> Although shadowing builtin module names is never a good
>> idea, either!
>
> /s/builtin/standard library/
>
> Quick! Name all the standard library modules, stat!
>
> In Python 3.3, there are something like 410 modules in the standard library.
> There's a reasonable chance that you've shadowed at least one but never
> noticed. Yet.

Not sure about that figure; any that are namespaced away in packages
don't count (or rather, they count as just one, for the package
itself). But yes, there are a lot.

> I think it is a serious design flaw that the standard library and user code
> co-exist in a single namespace.

There are two concerns here. One is that if you create a "random.py",
you can't yourself import the normal random module; and the other is
the possibility that some unrelated application like Idle can be
affected. I think the latter is far more serious than the former,
which is basically equivalent to using "id" as a variable name and
then finding you've shadowed a builtin (it affects only your current
module, so it's pretty safe). But if I can create stuff that breaks
Idle, that's a problem. And I think the solution to that is simply:
never put your files onto the module search path, always just use the
current directory. It might also be worth having some tools like Idle
remove "" from sys.path, in case someone invokes it from a project
directory, but that's an arguable point. (That's probably more useful
for something like 2to3, where it's expected that you'll run it from a
project directory. And maybe that already happens.)

The only other way to separate them would be to do something like C's
include paths - you have the user include path (which starts with the
current directory) and the system include path (which doesn't), and
then you can #include "local_file.h" and #include  to
get the one you want. In Python, that could be done as "import random
from system", which would then look up sys.systempath instead of
sys.path - but do we really need that functionality?

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


Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Twirlip2
On Wednesday, 27 August 2014 01:04:18 UTC+1, Steven D'Aprano  wrote:

> Twirlip2 wrote:
> 
> > Since I require Python in order to listen to my beloved radio programmes
> > reliably (don't get me started on the subject of the thrice-accursed BBC
> > website!), I therefore have IDLE running all the time, very probably
> > sometimes for weeks on end.
> 
> Well, don't keep us in suspenders, tell us what you use!

Sorry, I don't understand.

(Unless it's a Monty Python quote?  I never wanted to be a computer programmer, 
anyway.  I wanted to be a ...)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Wednesday, 27 August 2014 01:01:22 UTC+1, Steven D'Aprano  wrote:

> Gregory Ewing wrote:
> 
> > Although shadowing builtin module names is never a good
> > idea, either!
> 
> /s/builtin/standard library/
> 
> Quick! Name all the standard library modules, stat!
> 
> In Python 3.3, there are something like 410 modules in the standard library.
> There's a reasonable chance that you've shadowed at least one but never> 
> noticed. Yet.
> 
> I think it is a serious design flaw that the standard library and user code
> co-exist in a single namespace.

Shades of Windows *.DLLs!
-- 
https://mail.python.org/mailman/listinfo/python-list


Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

2014-08-26 Thread Steven D'Aprano
Twirlip2 wrote:

> Since I require Python in order to listen to my beloved radio programmes
> reliably (don't get me started on the subject of the thrice-accursed BBC
> website!), I therefore have IDLE running all the time, very probably
> sometimes for weeks on end.

Well, don't keep us in suspenders, tell us what you use!



-- 
Steven

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Steven D'Aprano
Gregory Ewing wrote:

> Although shadowing builtin module names is never a good
> idea, either!

/s/builtin/standard library/

Quick! Name all the standard library modules, stat!

In Python 3.3, there are something like 410 modules in the standard library.
There's a reasonable chance that you've shadowed at least one but never
noticed. Yet.

I think it is a serious design flaw that the standard library and user code
co-exist in a single namespace.


-- 
Steven

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 9:25 AM, Twirlip2  wrote:
> I do really mean "continuously". I'm hopelessly addicted to listening to 
> repeats of classic comedy programmes on Radio 4 Extra; I often listen at 
> bedtime, and first thing in the morning; and I keep my computer running 24/7 
> (shutting it down only when I'm away from home overnight). Since I require 
> Python in order to listen to my beloved radio programmes reliably (don't get 
> me started on the subject of the thrice-accursed BBC website!), I therefore 
> have IDLE running all the time, very probably sometimes for weeks on end.
>
> There have been a few times when IDLE has become unresponsive, or awkward, in 
> some way(s) - which I'm afraid I can't clearly remember, because it only 
> happens every few days, and never bothers me that much - and then I do shut 
> it down and restart it.
>
> My computer is also a 32-bit one, which I built in (believe it or not) 2003; 
> it has only 768MB of RAM (and used to have even less).  Until this year I was 
> also (believe it or not) using Windows 98SE. (No problems with IDLE on that, 
> either, that I can remember.)
>

Yeah, that's how I used to use Idle too. I'd fire it up basically as
part of the bootup sequence (My Computer, Drive C, Desktop, Firefox,
Chrome, RosMud, and Idle 3.x), and never shut it down. These days, I
tend to fire it up when I want it and shut it down when I'm done.
However, that could be because this particular XP installation is
getting long in the tooth, and I've been seeing issues switching to
Firefox after it's been running for a while. Some day I'll probably
throw Debian onto this box, but at the moment, it's my only real
Windows computer left, and since I've pledged to support Windows with
certain of my projects, it's best I actively use Windows sometimes.

On my Linux boxes (mostly some version of Debian, but with hardware
like you describe, I'd be looking at AntiX), I don't generally use
Idle at all - I just hit Ctrl-Alt-T and type "python" or "python3",
and use command-line Python instead.

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Wednesday, 27 August 2014 00:20:56 UTC+1, Mark Lawrence  wrote:
 
> Another lesson is that google grops is crap [...]

You read my mind! (See parenthetical note at end of my most recent post.)

I'm a recovered Usenet addict, of long standing.

My excuse is that it was a near-emergency - I'd been working hard for hours, 
indeed all day, without any visible success, and was in a near-panic, so I 
reached out and grabbed what help I could.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Wednesday, 27 August 2014 00:07:03 UTC+1, Chris Angelico  wrote:

> On Wed, Aug 27, 2014 at 4:01 AM, Twirlip2  wrote:
> 
> > I've been using IDLE with Python 3.4.0 on Windows XP (SP3), since March 
> > this year, and since May I've been running IDLE almost continuously, using 
> > it scores of times every day,
> 
> 
> Just to clarify: When you say "continuously", do you mean that you
> 
> keep it running for long periods of time? Because I've had various
> 
> issues on XP with leaving Idle running forever - it begins to take
> 
> arbitrarily long to switch back to it after leaving it, umm, idle for
> 
> a while. This is on a 32-bit system with 2GB of RAM. These days, I
> 
> tend to shut Idle down when I'm done with it.

I do really mean "continuously". I'm hopelessly addicted to listening to 
repeats of classic comedy programmes on Radio 4 Extra; I often listen at 
bedtime, and first thing in the morning; and I keep my computer running 24/7 
(shutting it down only when I'm away from home overnight). Since I require 
Python in order to listen to my beloved radio programmes reliably (don't get me 
started on the subject of the thrice-accursed BBC website!), I therefore have 
IDLE running all the time, very probably sometimes for weeks on end.

There have been a few times when IDLE has become unresponsive, or awkward, in 
some way(s) - which I'm afraid I can't clearly remember, because it only 
happens every few days, and never bothers me that much - and then I do shut it 
down and restart it.

When I'm experimenting, or changing some BBC-related data, which my stupid code 
- now being fixed, I hope! - can't re-read without being re-imported, I often 
have to perform a Ctrl-F6 to restart the shell; but that's different, and is 
unrelated to performance problems, of which (until today, when it was my fault) 
there have been few.

My computer is also a 32-bit one, which I built in (believe it or not) 2003; it 
has only 768MB of RAM (and used to have even less).  Until this year I was also 
(believe it or not) using Windows 98SE. (No problems with IDLE on that, either, 
that I can remember.)

[By the way, I see that Google still haven't fixed the problem of posters' 
e-mail addresses becoming undisguised when they're quoted, which used to bother 
me years ago.  I do have Forte Agent installed on my netbook, but I only use it 
for e-mail, and I no longer have a Usenet account.  I'm starting to wish that I 
had one, because I really don't want my e-mail address being harvested by 
spammers (again)!  Spam, spam, spam, spam, ...]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Mark Lawrence

On 26/08/2014 20:44, Twirlip2 wrote:

On Tuesday, 26 August 2014 20:20:22 UTC+1, Twirlip2  wrote:

Mercifully, it looks like Python is not broken, but I have done something Silly!

[...]

What I don't yet understand is why Python is trying to execute anything at all.



But I'm sure there's a simple explanation, and there'll certainly be at least a 
workaround, even if I have to temporarily move all my recently-edited source 
code files to another location!


The truth is that Python WAS broken, but it was (unsurprisingly) me wot broke 
it!

I had, in effect, already hit it with a "big stick", by naming one of my 
newly-created modules 'code.py' - thus evidently creating a name conflict with the 
standard module I:\Python34\Lib\code.py.

There is probably some lesson I should learn from this.

Meanwhile, let me try renaming my module, and see what happens ...



Another lesson is that google grops is crap, so would you please access 
this list via https://mail.python.org/mailman/listinfo/python-list or 
read and action this https://wiki.python.org/moin/GoogleGroupsPython to 
prevent us seeing the double line spacing and single line paragraphs 
above, thanks.


--
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: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 4:01 AM, Twirlip2  wrote:
> I've been using IDLE with Python 3.4.0 on Windows XP (SP3), since March this 
> year, and since May I've been running IDLE almost continuously, using it 
> scores of times every day,
>

Just to clarify: When you say "continuously", do you mean that you
keep it running for long periods of time? Because I've had various
issues on XP with leaving Idle running forever - it begins to take
arbitrarily long to switch back to it after leaving it, umm, idle for
a while. This is on a 32-bit system with 2GB of RAM. These days, I
tend to shut Idle down when I'm done with it.

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Tuesday, 26 August 2014 23:03:20 UTC+1, Gregory Ewing  wrote:

> Twirlip2 wrote:
> 
> > There is probably some lesson I should learn from this.
> 
> 
> 
> The lesson is probably that you shouldn't put the code
> 
> you're developing somewhere that's on the default import path.

Most of what I was doing today was splitting up one too-large module into more 
reasonable-sized and comprehensible pieces - there's still a long way to go! - 
and arranging for these now-separate modules to import only what they needed 
from each other.

I had already learned, from section 12.8.5 of Chun's 'Core Python Programming', 
2nd ed., how to avoid an interminable cycle of mutual import attempts.

Thus, for example, in one module, I have:

# \Work\Comp\Python\Lib\user.py

"""More functions for interacting with the user in a console session."""

# The importation of these names:
#
# BeebToken from beeb.py
# CodeToken from prog.py
#
# has to be postponed for a short while, in order to avoid an interminable
# cycle of attempted importations.

[... some definitions ...]

from beeb import BeebToken
from prog import CodeToken

[etc.]

and then, for example, in one of those two modules (the one that was originally 
FAR too large, and is still an ugly mess), I have:

# \Work\Comp\Python\Lib\beeb.py

"""Listen to streaming audio."""

# Standard Python 3 library stuff:

from configparser   import ConfigParser
from datetime   import datetime
from functools  import partial
from html.parserimport HTMLParser
from math   import ceil
from os import getenv, system
from sysimport argv
from urllib.request import urlopen

# My Python 3 library stuff, from <\Work\Comp\Python\Lib\>:

from console3 import get_val
from misc3import null
from kernel   import Kernel, WebPage
from user import UserToken, TokenStack

[...]

[By the way, I've read recently - in section 12.5.3 of Chun's book - that all 
this "from ... import..." stuff that I've been doing is bad style.  That's one 
of the less urgent things I'll get around to fixing eventually.  At least today 
I've had a painful lesson in the importance of keeping namespaces clean and 
tidy!  So I will fix it.  But there are worse things wrong with my code, 
needing more urgent attention - although the bit I was editing today does work, 
and the error with the r'\' string was, surprisingly, the only [new] bug in it, 
apart from an understandable failure to import a few necessary names.]

This works fine - now that the horrible name clash has been resolved! - but it 
still leaves me open to a recurrence of the same problem, if I get careless.

How do I go about putting my own unstable modules in a safer location, while 
still being able to import what I want from them?

There's something in Chun's book, which I hadn't read (section 12.7.4), about 
"relative imports": is that what I should be looking at?

> Although shadowing builtin module names is never a good
> 
> idea, either!

It doesn't seem immediately obvious how to get a definitive list of which names 
to avoid using (and therefore, inadvertently 'shadowing', as I did today).

For example,  
doesn't list the filename 'code.py', which is the one I clashed with today.

Of course, if all else fails, I will be sure to manually search the Python 
installation directory for possible clashes, but there must be a more logically 
secure way, one more integral to the language itself.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Gregory Ewing

Twirlip2 wrote:

There is probably some lesson I should learn from this.


The lesson is probably that you shouldn't put the code
you're developing somewhere that's on the default import
path.

Although shadowing builtin module names is never a good
idea, either!

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


Re: PyPI password rules

2014-08-26 Thread Gregory Ewing

Chris Angelico wrote:

And you wouldn't be generating passwords like
"videocard begat browser fetches", which just came up as I was playing
around now.


Arg! Video card makers are putting spyware in them now?!

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


Re: This formating is really tricky

2014-08-26 Thread Gregory Ewing

Mark Lawrence wrote:


from __past__ import print_statement (untested)


I don't think the PEP for the __past__ module has been
accepted yet, so you'd have to precede that with

  from __future__ import __past__

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Mark Lawrence

On 26/08/2014 20:58, Twirlip2 wrote:

On Tuesday, 26 August 2014 20:44:35 UTC+1, Twirlip2  wrote:


Meanwhile, let me try renaming my module, and see what happens ...


Whoopee, IDLE is back!

I need to sit down for a while, and just relax.  Oh look, there's a nice comfy 
chair!  Surely nothing unexpected can happen now.



Just when you thought it was safe, nobody expects the Batley Townswomen 
Guild's reenactment of the Battle of Pearl Harbour 
https://www.youtube.com/watch?v=kcSMaNlcDPs


--
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: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Tuesday, 26 August 2014 20:44:35 UTC+1, Twirlip2  wrote:

> Meanwhile, let me try renaming my module, and see what happens ...

Whoopee, IDLE is back!

I need to sit down for a while, and just relax.  Oh look, there's a nice comfy 
chair!  Surely nothing unexpected can happen now.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Zachary Ware
On Tue, Aug 26, 2014 at 2:26 PM, Twirlip2  wrote:
> On Tuesday, 26 August 2014 19:46:55 UTC+1, Terry Reedy  wrote:
>> On 8/26/2014 2:01 PM, Twirlip2 wrote:
>>
>> > [...]
>
> Here are the aforementioned error messages (sorry, I didn't realise I could 
> simply "select all" and "copy" text from a command window) - I hope the 
> formatting doesn't get messed up. (I haven't used Google Groups in years.)
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> Traceback (most recent call last):
>   File "I:\Python34\lib\runpy.py", line 170, in _run_module_as_main
> "__main__", mod_spec)
>   File "I:\Python34\lib\runpy.py", line 85, in _run_code
> exec(code, run_globals)
>   File "I:\Python34\lib\idlelib\__main__.py", line 8, in 
> import idlelib.PyShell
>   File "I:\Python34\lib\idlelib\PyShell.py", line 18, in 
> from code import InteractiveInterpreter
>   File "E:\Work\Comp\Python\Lib\code.py", line 28
> path = getenv('PYTHONPATH') + r'\'
>  ^
> SyntaxError: EOL while scanning string literal

It looks like the problem is that you've named your module 'code.py',
which is the name of a standard library module used by IDLE.  So, when
IDLE tries to 'from code import InteractiveInterpreter', instead of
getting I:\Python34\lib\code.py, it's getting
E:\Work\Comp\Python\Lib\code.py, which isn't going to work :).

Incidentally, your SyntaxError is due to trying to use r'\' to get a
backslash literal.  Even with r'' strings, backslash will escape a
quote character (but the backslash remains in the string).  In this
case, it's simplest to just use '\\'.

Hope this helps,
-- 
Zach
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Tuesday, 26 August 2014 20:20:22 UTC+1, Twirlip2  wrote:
> Mercifully, it looks like Python is not broken, but I have done something 
> Silly!
> 
> [...]
> 
> What I don't yet understand is why Python is trying to execute anything at 
> all.
> 
> 
> 
> But I'm sure there's a simple explanation, and there'll certainly be at least 
> a workaround, even if I have to temporarily move all my recently-edited 
> source code files to another location!

The truth is that Python WAS broken, but it was (unsurprisingly) me wot broke 
it!

I had, in effect, already hit it with a "big stick", by naming one of my 
newly-created modules 'code.py' - thus evidently creating a name conflict with 
the standard module I:\Python34\Lib\code.py.

There is probably some lesson I should learn from this.

Meanwhile, let me try renaming my module, and see what happens ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This formating is really tricky

2014-08-26 Thread Seymore4Head
On Mon, 25 Aug 2014 18:22:35 -0400, Terry Reedy 
wrote:

>On 8/25/2014 4:14 PM, Seymore4Head wrote:
>> import random
>> sets=3
>> for x in range(0, sets):
>>  pb2=random.choice([1-53])
>
>You want random.randint(1, 53)
>...
>>  alist = sorted([pb1, pb2, pb3, pb4, pb5])
>>  print ("Your numbers: {} Powerball: {}".format(alist, pb6))
>>
>> I am trying this example.  The program works, but the numbers don't
>> line up if the number of digits are different sizes.
>> http://openbookproject.net/pybiblio/practice/wilson/powerball.php
>
>To get them to line up, you have to format each one to the same width.
>
>> Suggestion please?
>> BTW the exercise instructions say to use the choice function.
>
>import random
>sets=3
>
>def ran53():
> return random.randint(1, 53)
>
>f1 = '{:2d}'
>bform = "Your numbers: [{0}, {0}, {0}, {0}, {0}]".format(f1)
>pform = " Powerball: {0}".format(f1)
>
>for x in range(0, sets):
> balls = sorted(ran53() for i in range(5))
> print(bform.format(*balls), pform.format(ran53()))
>
I modified your code to only use lotto numbers that don't repeat.  I
am sure there is a more elegant way to this too.

import random
sets=10
print ("How many sets of numbers? ",sets)

f1 = '{:2d}'
bform = "Your numbers: [{0}, {0}, {0}, {0}, {0}]".format(f1)
pform = " Powerball: {0}".format(f1)

for x in range(0, sets):
 balls = sorted(random.randint(1, 53) for i in range(5))
 if balls[0]!= balls[1] and balls[1]!= balls[2] and balls[2]!=
balls[3] and balls[3]!= balls[4]:
  print(bform.format(*balls), pform.format(random.randint(1,
42)))
 sets=sets-1
 
Thanks

>> BTW the exercise instructions say to use the choice function.
>
>I am not a fan of exercises that say to do something the wrong way, but 
>if you really had to,
>
>n54 = [i for i in range(1, 54)]
>random.choice(n54)
>
>An alternative to choosing numbers is to choose from 2-char number strings.
>
>n53 = ['%2d' % i for i in range(1, 54)]
>
>But then you have to figure out how to avoid having 6 pairs of quotes in 
>the output ;=)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Tuesday, 26 August 2014 19:46:55 UTC+1, Terry Reedy  wrote:
> On 8/26/2014 2:01 PM, Twirlip2 wrote:
> 
> > [...]

Here are the aforementioned error messages (sorry, I didn't realise I could 
simply "select all" and "copy" text from a command window) - I hope the 
formatting doesn't get messed up. (I haven't used Google Groups in years.)

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Traceback (most recent call last):
  File "I:\Python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
  File "I:\Python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "I:\Python34\lib\idlelib\__main__.py", line 8, in 
import idlelib.PyShell
  File "I:\Python34\lib\idlelib\PyShell.py", line 18, in 
from code import InteractiveInterpreter
  File "E:\Work\Comp\Python\Lib\code.py", line 28
path = getenv('PYTHONPATH') + r'\'
 ^
SyntaxError: EOL while scanning string literal
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
On Tuesday, 26 August 2014 19:46:55 UTC+1, Terry Reedy  wrote:
> On 8/26/2014 2:01 PM, Twirlip2 wrote:
> 
> > I've been using IDLE with Python 3.4.0 on Windows XP (SP3),
> 
> ...
> 
> 
> 
> Does all non-Python stuff seem to be working?

Yes.
 
> > For a few days, I'd been frequently running a second instance of
> 
> > IDLE, to test a new version of the same script.  Today, having closed
> 
> > this instance, I tried to open one again, but I briefly saw an error
> 
> > message about not being able to create a thread, or something like
> 
> > that.
> 
> 
> 
> In Command Prompt, 'python -m idlelib' should run Idle and display 
> 
> (without disappearing) any available error messages.

See below - it's starting to become much clearer what has happened (but it's 
not all clear yet) - thanks muchly for this suggestion!
 
> Idle imports tkinter which imports threading. If that fails, Idle never 
> 
> visibly starts.  If the imports succeed, and Idle starts, but cannot 
> 
> connect to a subprocess, it displays a message in Shell. (I have 
> 
> occasionally seen this, but close Idle and retry always works.)  Your 
> 
> description suggests the former.
> 
> 
> 
> Does 'python' itself start. If so, and you get interactive prompt, does 
> 
> 'import threading' work?  Ditto 'import tkinter'?  If so, does 
> 
> 'tkinter.Tk()' bring up an empty tk window?

All those 4 things worked normally.

> Back at interactive prompt, what happens with 'python -m test'?  There 
> 
> are a couple of modules that may sometimes fail, but the rest should not.

I'll try this later - just out of interest - but your first suggestion has 
already borne fruit.

> > 3. Installed 3.4.1 (over 3.4.0). It made no difference to the
> 
> > problem. (I also had to do a hard reboot of the system, after it had
> 
> > completely ground to a halt when I tried to reboot in the normal
> 
> > way.)
> 
> 
> 
> Upgrading on top of broken Python may not work. If the tests above fail, 
> 
> re-install after un-installing.  Un-installing will leave /python34 but 
> 
> only with things you added (or separately installed). You may need to 
> 
> 're-install' 3.4.0 to un-install.

Mercifully, it looks like Python is not broken, but I have done something Silly!

The result of "python -m idlelib" in a Windows command window is a short stack 
of error messages, culminating in the revelation that Python is trying to 
execute (or at any rate syntax-check) one of the many source code I files I had 
just spent the entire morning and much of the afternoon editing.

Of course, they are bound to be festooned with errors; the reason I was trying 
to start the second IDLE instance, in the first place, was to start trying to 
debug all the work I had just done, but I was never able to get to it!

What I don't yet understand is why Python is trying to execute anything at all.

But I'm sure there's a simple explanation, and there'll certainly be at least a 
workaround, even if I have to temporarily move all my recently-edited source 
code files to another location!

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


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Grant Edwards
On 2014-08-26, Twirlip2  wrote:

Careful.  If you hit it with a big stick it might fall on your head
and give you a concussion making it hard to remember to not mention
the war.

-- 
Grant Edwards   grant.b.edwardsYow! I hope the
  at   ``Eurythmics'' practice
  gmail.combirth control ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This formating is really tricky

2014-08-26 Thread Gene Heskett
On Tuesday 26 August 2014 12:13:37 Chris Angelico did opine
And Gene did reply:
> On Wed, Aug 27, 2014 at 2:09 AM, Mark Lawrence  
wrote:
> > On 26/08/2014 12:24, MRAB wrote:
> >> On 2014-08-26 06:57, Mark Lawrence wrote:
> >>> On 26/08/2014 02:10, Joel Goldstick wrote:
>  you should try python-tudor mailing list
> >>> 
> >>> I'd try python-stewart and please don't top post, you've been
> >>> around long enough and ought to know better :)
> >> 
> >> Should that be "python-stuart"?
> > 
> > I'm not sure which is the UK version and which is the US version, can
> > others assist?
> 
> According to Wikipedia, the name spelling was changed at some point.
> So both are correct. We're now beautifully off-topic, but hey, that's
> what python-list seems to do best...
> 
> ChrisA

And that is what you folks to best, when trying to out-standup the last 
poster. Then it gets quite funny.

;-)

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)
Genes Web page 
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Terry Reedy

On 8/26/2014 2:01 PM, Twirlip2 wrote:

I've been using IDLE with Python 3.4.0 on Windows XP (SP3),

...

Does all non-Python stuff seem to be working?


For a few days, I'd been frequently running a second instance of
IDLE, to test a new version of the same script.  Today, having closed
this instance, I tried to open one again, but I briefly saw an error
message about not being able to create a thread, or something like
that.


In Command Prompt, 'python -m idlelib' should run Idle and display 
(without disappearing) any available error messages.


Idle imports tkinter which imports threading. If that fails, Idle never 
visibly starts.  If the imports succeed, and Idle starts, but cannot 
connect to a subprocess, it displays a message in Shell. (I have 
occasionally seen this, but close Idle and retry always works.)  Your 
description suggests the former.


Does 'python' itself start. If so, and you get interactive prompt, does 
'import threading' work?  Ditto 'import tkinter'?  If so, does 
'tkinter.Tk()' bring up an empty tk window?


Back at interactive prompt, what happens with 'python -m test'?  There 
are a couple of modules that may sometimes fail, but the rest should not.



3. Installed 3.4.1 (over 3.4.0). It made no difference to the
problem. (I also had to do a hard reboot of the system, after it had
completely ground to a halt when I tried to reboot in the normal
way.)


Upgrading on top of broken Python may not work. If the tests above fail, 
re-install after un-installing.  Un-installing will leave /python34 but 
only with things you added (or separately installed). You may need to 
're-install' 3.4.0 to un-install.


--
Terry Jan Reedy

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


Re: Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
On 2014-08-26, Terry Reedy  wrote:
> On 8/26/2014 12:03 PM, Jon Ribbens wrote:
>> Flask suggests the following file layout:
>>
>>  runflaskapp.py
>>  flaskapp/
>>  __init__.py
>>
>> runflaskapp.py contains:
>>
>>  from flaskapp import app
>>  app.run(debug=True)
>>
>> flaskapp/__init__.py contains:
>>
>>  from flask import Flask
>>  app = Flask(__name__)
>
> Unless there is something else in flaskapp, this seems senseless.  Why 
> not runflaskapp.py:
>
> from flask import Flask
> app = Flask(__name__)
> app.run(debug=True)

Because that's not how Flask apps work. I am showing a minimal test
case, obviously for any real app not only would __init__.py contain
more code, but there would be other files inside flaskapp/ too.
Then when deployed, 'runflaskapp.py' would either be changed or go
away entirely and the web server would just be pointed at 'flaskapp'.

>> Running this with 'python3 runflaskapp.py' works fine.
>
> You are either giving this in directory 'x' containing runflaskapp.py or 
> given a longer pathname. In either case, directory 'x' get prepended to 
> sys.path, so that 'import flaskapp' finds flaskapp in x.

Well, as I understand it actually the empty string is in sys.path,
which is taken by Python to mean 'the current directory'.

>> However it seems to me that a more Python3onic way of doing this
>> would be to rename 'runflaskapp.py' as 'flaskapp/__main__.py'
>> and then run the whole thing as 'python3 -m flaskapp'.
>
> In what directory?

In the same directory as above, i.e. the one containing 'flaskapp'.
It clearly does find 'flaskapp' initially, otherwise I would get
a different error message "/usr/bin/python3: No module named flaskapp".

> > Unfortunately this doesn't work:
>
> Because x does not get added to sys.path.

No, but the current directory does (effectively).

> Or put flaskapp in site_packages, which is on the import search path .

That's no use for development though.

The important part of my question is "why is running __main__.py
from inside flaskapp/ somehow different to running runflaskapp.py
from the parent directory?" It's probably a fairly Flask-specific
question.
-- 
https://mail.python.org/mailman/listinfo/python-list


IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

2014-08-26 Thread Twirlip2
I've been using IDLE with Python 3.4.0 on Windows XP (SP3), since March this 
year, and since May I've been running IDLE almost continuously, using it scores 
of times every day, mostly to run the same script (for running a media player 
on BBC WMA streams, to bypass the dreaded iPlayer).

No problems, until today.

For a few days, I'd been frequently running a second instance of IDLE, to test 
a new version of the same script.  Today, having closed this instance, I tried 
to open one again, but I briefly saw an error message about not being able to 
create a thread, or something like that. I'd seen similar messages before, but 
all that had ever been needed was to terminate a few other processes, and try 
again.  Not this time, however.

I closed the first IDLE instance as well - and since then, I haven't been able 
to get any instance of IDLE to run at all!

I have tried the following, all without success:

1. Closed other processes, and retried (as just mentioned).

2. Logged off, logged into an admin account, and tried running IDLE there.  
Still nothing happened, and still nothing showed in Task Manager | Processes.

3. Installed 3.4.1 (over 3.4.0). It made no difference to the problem. (I also 
had to do a hard reboot of the system, after it had completely ground to a halt 
when I tried to reboot in the normal way.)

4. Disabled the router (for safety), then (temporarily) disabled the antivirus 
program.  No joy.

5. Rebooted, instructed Windows Firewall to make an exception for pythonw.exe.  
Still no joy.

6. Downloaded Process Monitor, from 
, installed it, ran 
it, and filtered to show all events having process name 'pythonw.exe', and any 
result other than 'SUCCESS'. There were hundreds of such events, including many 
stating 'buffer overflow'. (I'll go into an admin account, run Process Monitor 
again, and give details of the results, if it will help.)

7. Deleted .idlerc - this had no effect on the problem, so I restored it.

8. Created shortcut with target , and 
double-clicked it, with no effect.

9. Ran the same command in a Windows command shell window.  Still no result.

I think that's everything I've tried, so far.  I'm pretty exhausted now, so I 
thought I'd ask for help.  Any ideas?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Terry Reedy

On 8/26/2014 12:03 PM, Jon Ribbens wrote:

Flask suggests the following file layout:

 runflaskapp.py
 flaskapp/
 __init__.py

runflaskapp.py contains:

 from flaskapp import app
 app.run(debug=True)

flaskapp/__init__.py contains:

 from flask import Flask
 app = Flask(__name__)


Unless there is something else in flaskapp, this seems senseless.  Why 
not runflaskapp.py:


from flask import Flask
app = Flask(__name__)
app.run(debug=True)


Running this with 'python3 runflaskapp.py' works fine.


You are either giving this in directory 'x' containing runflaskapp.py or 
given a longer pathname. In either case, directory 'x' get prepended to 
sys.path, so that 'import flaskapp' finds flaskapp in x.



However it
seems to me that a more Python3onic way of doing this would be to
rename 'runflaskapp.py' as 'flaskapp/__main__.py'

> and then run the whole thing as 'python3 -m flaskapp'.

In what directory?

> Unfortunately this doesn't work:

Because x does not get added to sys.path.


 $ python3 -m flaskapp
  * Running on http://127.0.0.1:5000/
  * Restarting with reloader
 Traceback (most recent call last):
   File "/home/username/src/flaskapp/__main__.py", line 1, in 
from flaskapp import app
 ImportError: No module named 'flaskapp'

Does anyone know why and how to fix it?


Since flaskapp/__main__.py is found and run, make the change suggested 
above that eliminates the flaskapp import.


Or put flaskapp in site_packages, which is on the import search path .

Pip, and I presume other installers, typically puts startup scripts in a 
directory that is on the system path. For Windows, this is 
pythonxy/Scripts.  But this is more than I would do for most local apps.


--
Terry Jan Reedy

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


Re: Small World Network model random data generation

2014-08-26 Thread Terry Reedy

On 8/26/2014 6:16 AM, lavanya addepalli wrote:

How can i generate a random data that is identical to my realworld data


I presume you mean same statistical properties.
https://en.wikipedia.org/wiki/Small-world_network
explains the difference between random networks and many real sw networks.


i am supposed to refer the attached paper


By Watts and Strogatz
https://en.wikipedia.org/wiki/Watts_and_Strogatz_Model
gives a compact description of their algorithm, without proofs.


Real Data
node pairs and the time they spend together connected


Your real data should have connect and disconnect (start and stop) 
times.  The data below could represent a decay situation where all 
connections exist at time 0 and the time represents how long they last 
before breaking.  Or a much different growth situation where there are 
initially no connections and they slowly accumulate. Or some sort of 
steady situation.



node node time in seconds
4391 2814 16.0
4945 3545 386.0
5045 4921 63078.0


etc. The small-world-network concept is a static, or perhaps snapshot 
concept.  Modeling link changes in a way that maintains the statistical 
properties is a harder problem.


--
Terry Jan Reedy

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


Re: This formating is really tricky

2014-08-26 Thread Mark Lawrence

On 26/08/2014 17:33, Chris Angelico wrote:

On Wed, Aug 27, 2014 at 2:28 AM, Peter Otten <__pete...@web.de> wrote:

No, "python-flight-attendant" ;)

http://xkcd.com/353/


Would be nice if that could be made Python 3 compatible.

ChrisA



Easy.

from __past__ import print_statement (untested)

--
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: Switching from nose to unittest2 - how to continue after an error?

2014-08-26 Thread Skip Montanaro
On Tue, Aug 26, 2014 at 11:58 AM, Terry Reedy  wrote:
> If you want to be understood, give a snippet of code, what happens now, and
> what you want to happen.

Thanks, but not really necessary. I have retreated into nose-land.

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


Re: Small World Network model random data generation

2014-08-26 Thread Terry Reedy

On 8/26/2014 6:16 AM, lavanya addepalli wrote:

How can i generate a random data that is identical to my realworld data

i am supposed to refer the attached paper


For binary data, give links rather than attachments.


--
Terry Jan Reedy

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


Re: Switching from nose to unittest2 - how to continue after an error?

2014-08-26 Thread Terry Reedy

On 8/26/2014 4:55 AM, Skip Montanaro wrote:

On Mon, Aug 25, 2014 at 4:47 PM, Terry Reedy  wrote:

I know of two ways to collect multiple failures within a test function:


Thanks, but I mean multiple test failures. I fully expect a specific
test to exit when it hits an assertion failure.


I obviously did not understand your question "How to continue after an 
error?" and still don't.  If you want to be understood, give a snippet 
of code, what happens now, and what you want to happen.


--
Terry Jan Reedy

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


Re: This formating is really tricky

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 2:28 AM, Peter Otten <__pete...@web.de> wrote:
> No, "python-flight-attendant" ;)
>
> http://xkcd.com/353/

Would be nice if that could be made Python 3 compatible.

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


Re: This formating is really tricky

2014-08-26 Thread Peter Otten
MRAB wrote:

> On 2014-08-26 06:57, Mark Lawrence wrote:
>> On 26/08/2014 02:10, Joel Goldstick wrote:
>>> you should try python-tudor mailing list
>>>
>>
>> I'd try python-stewart and please don't top post, you've been around
>> long enough and ought to know better :)
>>
> Should that be "python-stuart"?

No, "python-flight-attendant" ;)

http://xkcd.com/353/

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


Re: send keys in windows

2014-08-26 Thread Mark Lawrence

On 26/08/2014 15:14, Filippo Dal Bosco - wrote:

I am trying to learn how send keys and mouse click to a background
process  in windows
Where can I find complete documentation and examples ?

With Google I looked for books and internet link but I didn't find much.

thank




Start here 
http://stackoverflow.com/questions/1823762/sendkeys-for-python-3-1-on-windows


--
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: This formating is really tricky

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 2:09 AM, Mark Lawrence  wrote:
> On 26/08/2014 12:24, MRAB wrote:
>>
>> On 2014-08-26 06:57, Mark Lawrence wrote:
>>>
>>> On 26/08/2014 02:10, Joel Goldstick wrote:

 you should try python-tudor mailing list

>>>
>>> I'd try python-stewart and please don't top post, you've been around
>>> long enough and ought to know better :)
>>>
>> Should that be "python-stuart"?
>
>
> I'm not sure which is the UK version and which is the US version, can others
> assist?

According to Wikipedia, the name spelling was changed at some point.
So both are correct. We're now beautifully off-topic, but hey, that's
what python-list seems to do best...

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


Re: This formating is really tricky

2014-08-26 Thread Mark Lawrence

On 26/08/2014 12:24, MRAB wrote:

On 2014-08-26 06:57, Mark Lawrence wrote:

On 26/08/2014 02:10, Joel Goldstick wrote:

you should try python-tudor mailing list



I'd try python-stewart and please don't top post, you've been around
long enough and ought to know better :)


Should that be "python-stuart"?


I'm not sure which is the UK version and which is the US version, can 
others assist?


--
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: PyPI password rules

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 2:05 AM, Skip Montanaro  wrote:
> On Tue, Aug 26, 2014 at 10:52 AM, Chris Angelico  wrote:
>> Most of what Polly hears is fairly general chatter. There are a few
>> jargon terms like "metamagic" that are D&D-specific, but apart from
>> that, it's straight English.
>
> I guess I could write a little program that listens to my incoming
> email via IMAP. I'll have to see what that generates. Lots of Python
> and bike references, no doubt. :-)

That could be fun! And you wouldn't be generating passwords like
"videocard begat browser fetches", which just came up as I was playing
around now. Yeah, that makes an interesting picture.

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


Re: PyPI password rules

2014-08-26 Thread Skip Montanaro
On Tue, Aug 26, 2014 at 10:52 AM, Chris Angelico  wrote:
> Most of what Polly hears is fairly general chatter. There are a few
> jargon terms like "metamagic" that are D&D-specific, but apart from
> that, it's straight English.

I guess I could write a little program that listens to my incoming
email via IMAP. I'll have to see what that generates. Lots of Python
and bike references, no doubt. :-)

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


Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
Flask suggests the following file layout:

runflaskapp.py
flaskapp/
__init__.py

runflaskapp.py contains:

from flaskapp import app
app.run(debug=True)

flaskapp/__init__.py contains:

from flask import Flask
app = Flask(__name__)

Running this with 'python3 runflaskapp.py' works fine. However it
seems to me that a more Python3onic way of doing this would be to
rename 'runflaskapp.py' as 'flaskapp/__main__.py' and then run
the whole thing as 'python3 -m flaskapp'. Unfortunately this doesn't
work:

$ python3 -m flaskapp
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader
Traceback (most recent call last):
  File "/home/username/src/flaskapp/__main__.py", line 1, in 
from flaskapp import app
ImportError: No module named 'flaskapp'

Does anyone know why and how to fix it?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyPI password rules

2014-08-26 Thread Chris Angelico
On Wed, Aug 27, 2014 at 1:48 AM, Skip Montanaro  wrote:
> On Tue, Aug 26, 2014 at 9:02 AM, Chris Angelico  wrote:
>> On my Dungeons & Dragons server, in the common room, I have a parrot
>> named Polly. She listens to everything people say,...
>
> Ah, okay. Nice approach. Not a D&D player, so I'll stick with my
> common words for now, until and unless I come up with something
> Polly-like.

Most of what Polly hears is fairly general chatter. There are a few
jargon terms like "metamagic" that are D&D-specific, but apart from
that, it's straight English.

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


Re: PyPI password rules

2014-08-26 Thread Skip Montanaro
On Tue, Aug 26, 2014 at 9:02 AM, Chris Angelico  wrote:
> On my Dungeons & Dragons server, in the common room, I have a parrot
> named Polly. She listens to everything people say,...

Ah, okay. Nice approach. Not a D&D player, so I'll stick with my
common words for now, until and unless I come up with something
Polly-like.

I just tried to change my Linux password using the output from my
little XKCD 936 script. The response? "it is too
simplistic/systematic". :-( My next attempt succeeded though, so
perhaps it had something to do with the length of a couple of the
words in "norm tops owning posted".

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


Re: help! about pypcap.dispatch

2014-08-26 Thread Chris Angelico
On Tue, Aug 26, 2014 at 8:44 PM,   wrote:
> Hi,
>
>I'm using Python 2.7.6 in Centos 6.5.
>
>I have defined
>"p = pcap.pcap(timeout_ms=1000)
> def function(timestamp,pkt,*args):
>"
>and try to run "p.dispatch(-1,function)"
>
>and I got this:
>p.dispatch(-1,function)
>File "pcap.pyx", line 296, in pcap.pcap.dispatch (pcap.c:3182)
>   TypeError: raise: exception class must be a subclass of BaseException
>
>why this happened? Anybody know how to solve it?

Where did pcap.pyx come from? What version is it? Is it something that
was written for an ancient version of Python? It might be raising a
string exception.

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


send keys in windows

2014-08-26 Thread Filippo Dal Bosco -
I am trying to learn how send keys and mouse click to a background
process  in windows  
Where can I find complete documentation and examples ?

With Google I looked for books and internet link but I didn't find much.

thank


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


Re: PyPI password rules

2014-08-26 Thread Chris Angelico
On Tue, Aug 26, 2014 at 11:28 PM, Skip Montanaro  wrote:
> On Tue, Aug 26, 2014 at 1:16 AM, Chris Angelico  wrote:
>> Currently, her full dictionary is 12759 words
>
> Chris,
>
> How did you come up with that list? I took the New Academic Word
> List[1] + the New General Service List[2] (sans duplicates) and wound
> up with 1646 words of length four through six. Did you cap your word
> list by length (short or long)?

On my Dungeons & Dragons server, in the common room, I have a parrot
named Polly. She listens to everything people say, discarding anything
that's more than about one line (so, short sentences only), and will
randomly echo some of it back. Since she has a great memory for words,
she's been tasked with organizing the local Scrabble variant
(Pollylogy), and more recently, with the generation of XKCD 936
passwords. So the words she offers, for those passwords, are pretty
much any words she's ever heard... bar profanity, which we train out
of her (by saying "Bad Polly!" any time she swears). There's no
minimum word length, but she ignores all words with non-letters (in
fact, currently she ignores anything with non-ASCII letters, too; as
she primarily speaks English [1], this doesn't cut out much that would
be legit, and does cut out lots of non-words), and avoids anything
with upper-case letters (to keep out names, for instance).

ChrisA

[1] At the request of one of my players, I have another parrot in the
game who speaks only Latin. Yeah, that makes for interesting
conversations.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Small World Network model random data generation

2014-08-26 Thread William Ray Wing
On Aug 26, 2014, at 9:23 AM, Dennis Lee Bieber  wrote:

> On Tue, 26 Aug 2014 12:16:33 +0200, lavanya addepalli 
> declaimed the following:
> 
>> How can i generate a random data that is identical to my realworld data
>> 
> 
>   By definition, "random data" will be unlikely to ever be "identical" to
> your "realworld data".
> 
> 
>> i am supposed to refer the attached paper
>> 
>> Real Data
>> 
>> node pairs and the time they spend together connected
>> 
>> node node time in seconds
>> 4391 2814 16.0

[byte]

>> 1885 1158 351.0
>> 1349 1174 6375.0
>> 
> 
>   Since I see no cases of duplicate node /pairs/ it is difficult to
> figure out just what that data really represents...
> 
>   With enough data, with duplicate pairs having different times, I'd
> likely group by pairs, generate mean and standard deviation for the times
> of the matching pairs, then generate some count of the pairs to develop
> weights... Finally, using the weights I'd attempt to generate random node
> pairs and then use the mean/SD of the result pair to generate a time from
> the gaussian distribution.
> 
>   With only the data you have, I'd end up with a sparse 2D matrix
> M[first_node, second_node] = time
> 
>   And then selecting random samples from that...
> -- 
>   Wulfraed Dennis Lee Bieber AF6VN
>wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/

I think the OP wanted to create some sort of test file that was formatted
like his real-world data, but was filled with artificial data.  That, of
course simply becomes an exercise in creating lists of random 4-digit integers
and floats, then arranging them as lines and writing out the data.

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


Re: PyPI password rules

2014-08-26 Thread Skip Montanaro
On Tue, Aug 26, 2014 at 1:16 AM, Chris Angelico  wrote:
> Currently, her full dictionary is 12759 words

Chris,

How did you come up with that list? I took the New Academic Word
List[1] + the New General Service List[2] (sans duplicates) and wound
up with 1646 words of length four through six. Did you cap your word
list by length (short or long)?

Thx,

Skip

[1]: http://www.newacademicwordlist.org/
[2]: http://www.newgeneralservicelist.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This formating is really tricky

2014-08-26 Thread Joel Goldstick
>>> you should try python-tudor mailing list
>>>
>>
>> I'd try python-stewart and please don't top post, you've been around
>> long enough and ought to know better :)
>>
> Should that be "python-stuart"?
> --
> https://mail.python.org/mailman/listinfo/python-list

Glad I could add to the discussion

-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This formating is really tricky

2014-08-26 Thread MRAB

On 2014-08-26 06:57, Mark Lawrence wrote:

On 26/08/2014 02:10, Joel Goldstick wrote:

you should try python-tudor mailing list



I'd try python-stewart and please don't top post, you've been around
long enough and ought to know better :)


Should that be "python-stuart"?
--
https://mail.python.org/mailman/listinfo/python-list


Re: error building lxml.etree

2014-08-26 Thread Robin Becker

On 22/08/2014 18:53, Stefan Behnel wrote:

Robin Becker schrieb am 22.08.2014 um 17:50:

I'm trying to build a bunch of extensions in a 2.7 virtual environment on a

.


Has anyone else seen this error? It's entirely possible that it might be I
don't have enough memory or something


Yes, that's most likely it. Having 500MB+ of free(!) RAM is a good idea for
the build.



lxml builds almost always take a long time.


For testing, you can speed things up quite substantially by using "-O0" as
your CFLAGS. Not a good idea for a production system, though.

You might also get away with building a (static?) wheel on another
compatible Linux system that has more RAM.

Stefan


I exported the VM to a higher spec host box and there I was able to build lxml 
without issue after increasing the VM base memory.

--
Robin Becker

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


help! about pypcap.dispatch

2014-08-26 Thread doit4um
Hi,
 
   I'm using Python 2.7.6 in Centos 6.5. 
   
   I have defined  
   "p = pcap.pcap(timeout_ms=1000)
def function(timestamp,pkt,*args):
   "
   and try to run "p.dispatch(-1,function)"

   and I got this:
   p.dispatch(-1,function)
   File "pcap.pyx", line 296, in pcap.pcap.dispatch (pcap.c:3182)
  TypeError: raise: exception class must be a subclass of BaseException

   why this happened? Anybody know how to solve it?

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


Re: This formating is really tricky

2014-08-26 Thread alister
On Tue, 26 Aug 2014 12:32:14 +0300, Marko Rauhamaa wrote:

> alister :
> 
>> Oh Wow I didn't know Python was that old - it even pre-dates
>> Electricity :-)
> 
> Electricity arose already before the Great Inflation.
> 
> 
> Marko

but it was not in controlled use by mankind at that time



-- 
Whip me.  Beat me.  Make me maintain AIX.
-- Stephan Zielinski
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: This formating is really tricky

2014-08-26 Thread Marko Rauhamaa
alister :

> Oh Wow I didn't know Python was that old - it even pre-dates 
> Electricity :-)

Electricity arose already before the Great Inflation.


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


Re: This formating is really tricky

2014-08-26 Thread alister
On Mon, 25 Aug 2014 21:10:47 -0400, Joel Goldstick wrote:

> you should try python-tudor mailing list
> 
Oh Wow I didn't know Python was that old - it even pre-dates 
Electricity :-)

-- 
Hand, n.:
A singular instrument worn at the end of a human arm and
commonly thrust into somebody's pocket.
-- Ambrose Bierce, "The Devil's Dictionary"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Switching from nose to unittest2 - how to continue after an error?

2014-08-26 Thread Skip Montanaro
On Mon, Aug 25, 2014 at 4:47 PM, Terry Reedy  wrote:
> I know of two ways to collect multiple failures within a test function:

Thanks, but I mean multiple test failures. I fully expect a specific
test to exit when it hits an assertion failure.

I suspect my problem is due to lack of support for the assert
statement by unittest. I'll just go back to nose1 for now.

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


Re: Python vs C++

2014-08-26 Thread Amirouche Boubekki
2014-08-26 6:02 GMT+02:00 Ian Kelly :

> On Mon, Aug 25, 2014 at 4:52 AM, Amirouche Boubekki <
> amirouche.boube...@gmail.com> wrote:
> >  - I am a big fan of Final Fantasy games, it seems to be an easy game
> experience to code
>
> Maybe not so easy, if the horrifying number of bugs in the early games of
> the series are any indication.
>

I started with FF VII, I don't remember any bugs.


>
> I'm not sure what makes this a C++ project in any case.
>

True.


> It would be just as easy or easier in Python, or one could save a lot more
> effort by just using RPG Maker like every other indie RPG developer seems
> to do.
>

I don't think there is FLOSS equivalent.

Anyway, I have other ideas:

- An "after effect" equivalent
- This might be the same thing as the above, a live processing of vidéos. I
tried using python bindings of gstreamer six months ago, I failed. Part of
the failure is that g-software suite doesn't care much about this usecase.
- port torus trooper to C++ (
http://www.asahi-net.or.jp/~cs8k-cyu/windows/tt_e.html)
- Contribute to cling, cern's C++ interpreter based on llvm
. I think PyPy people are
interested to use it too.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Password strategy [OT] was: PyPI password rules

2014-08-26 Thread Chris Angelico
On Tue, Aug 26, 2014 at 5:45 PM, Andrew Berg
 wrote:
> On 2014.08.26 01:16, Chris Angelico wrote:
>> A huge THANK YOU to whoever set the rules for PyPI passwords! You're
>> allowed to go with a monocase password, as long as it's at least 16
>> characters in length. Finally, someone who recognizes XKCD 936
>> passwords!
>>
>> And yes, I generated an XKCD 936 password for the job. My parrot is
>> good at that... uses a dictionary consisting of every word ever noted
>> by her, and can optionally trim it to "most common N words" for any
>> given value of N.
> While a vast improvement over the kinds of passwords many places would like to
> impose, xkcd 936 passwords can still be difficult to remember. I prefer 
> phrases
> with context (and proper punctuation and capitalization if practical).
> Something with context is generally easy for a human to remember, but 
> difficult
> for a machine to guess.
>
> "keyboard television barf machine" or "Yay for the download counter!"
> Which one is easier to remember and harder to guess?

As long as your sentence will be hard to guess, it's going to fit the
requirements anyway. And by the look of it, PyPI will accept that
password too. (Tip: Do not actually use either of the above
passwords.) What I like doing is running my 936 generator until I see
something that creates a picture in my head. (It usually doesn't take
very many tries.) That's what makes the password memorable.

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


Password strategy [OT] was: PyPI password rules

2014-08-26 Thread Andrew Berg
On 2014.08.26 01:16, Chris Angelico wrote:
> A huge THANK YOU to whoever set the rules for PyPI passwords! You're
> allowed to go with a monocase password, as long as it's at least 16
> characters in length. Finally, someone who recognizes XKCD 936
> passwords!
> 
> And yes, I generated an XKCD 936 password for the job. My parrot is
> good at that... uses a dictionary consisting of every word ever noted
> by her, and can optionally trim it to "most common N words" for any
> given value of N.
While a vast improvement over the kinds of passwords many places would like to
impose, xkcd 936 passwords can still be difficult to remember. I prefer phrases
with context (and proper punctuation and capitalization if practical).
Something with context is generally easy for a human to remember, but difficult
for a machine to guess.

"keyboard television barf machine" or "Yay for the download counter!"
Which one is easier to remember and harder to guess?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help improving the future of debugging

2014-08-26 Thread Heinz Schmitz
Mark Lawrence  wrote:

>>> since 1974 researchers and software developers try to ease software
>>> debugging.

>> I'm really curious: where did the date 1974 come from?  What happened
>> then? Hadn't people already been trying to ease software debugging for
>> at least 20 years prior to that? :)

>It's a typo, it should have been 1944 :)

What about 1941?
https://en.wikipedia.org/wiki/Konrad_Zuse
"His greatest achievement was the world's first programmable
 computer; the functional program-controlled Turing-complete Z3
 became operational in May 1941."

Regards,
H.


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