Cross Platform

2013-09-05 Thread Chandru Rajendran
Hi all,

I have a doubt regarding the python cross platform.
If we write Class in windows ,whether we can without any modifications in 
Linux, if so then how about the GUI programming and Libraries.
Please provide needful information.

Thanks,
Chandru

 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not 
to copy, disclose, or distribute this e-mail or its contents to any other 
person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken 
every reasonable precaution to minimize this risk, but is not liable for any 
damage 
you may sustain as a result of any virus in this e-mail. You should carry out 
your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this 
e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Beginner's guide to Python

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 14:14:34 +1000, Chris Angelico wrote:

> ...Python's object model tends to be less well suited to massive
> scaling; 

That's probably true.


> I don't know about PyPy and other Pythons, but certainly
> CPython isn't designed to run on arbitrary numbers of cores (once you go
> to multiprocessing, you then need to worry about IPC; if you work in a
> lower level language like C, you can use threads and directly access
> each other's memory). 

I think that's an exaggeration. CPython *is* designed to run on an 
arbitrary number of cores, but you need to approach it via techniques 
that you might not use in other languages.

It would only be valid to say that "CPython is not designed to use 
multiple cores" if threads were the *only* valid way to use multiple 
cores. "Use multiprocessing" is just as much a valid way to use multiple 
cores as "use threads" might be in another language, and by some 
accounts, better than threads.

Or you can use IronPython or Jython, neither of which have the GIL. Or 
use Stackless:

http://entitycrisis.blogspot.com.au/2009/06/stackless-vs-gil-its-draw.html


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


Re: split lines from stdin into a list of unicode strings

2013-09-05 Thread Kurt Mueller
Am 29.08.2013 11:12, schrieb Peter Otten:
> [email protected] wrote:
>> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
>>> On 28/8/2013 04:32, Kurt Mueller wrote:
 For some text manipulation tasks I need a template to split lines
 from stdin into a list of strings the way shlex.split() does it.
 The encoding of the input can vary.

> You can compromise and read ahead a limited number of lines. Here's my demo 
> script (The interesting part is detect_encoding(), I got a bit distracted by 
> unrelated stuff...). The script does one extra decode/encode cycle -- it 
> should be easy to avoid that if you run into performance issues.

I took your script as a template.
But I used the libmagic library (pyhton-magic) instead of chardet.
See http://linux.die.net/man/3/libmagic
and https://github.com/ahupp/python-magic
( I made tests with files of different size, up to 1.2 [GB] )

I had following issues:

- I a real file, the encoding was detected as 'ascii' for detect_lines=1000.
  In line 1002 there was an umlaut character. So then the line.decode(encoding) 
failed.
  I think to add the errors parameter, line.decode(encoding, errors='replace')

- If the buffer was bigger than about some Megabytes, the returned encoding
  from libmagic was always None. The big files had very long lines ( more than 
4k per line ).
  So with detect_lines=1000 this limit was exceeded.

- The magic.buffer() ( the equivalent of chardet.detect() ) takes about 2 
seconds
  per megabyte buffer.



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


Re: NameError: global name '' is not defined , but a bit differences

2013-09-05 Thread Terry Reedy

On 9/5/2013 1:38 AM, Benjamin Kaplan wrote:

On Wed, Sep 4, 2013 at 9:17 PM, Mohsen Pahlevanzadeh
 wrote:



i get the error :

NameError: global name 'ui' is not defined

Complete question is at :
http://stackoverflow.com/questions/18627608/nameerror-global-name-is-not-defined-but-differences


Mohsen, I consider this post to be close to spamming in that its purpose 
is to drive traffic to your post on SO. SO says you posted the question 
3 hrs ago, while my mail agent says you posted the link two hours ago. 
Ask a question on one forum and stick with that for at least a few days.



Please don't just post a link to Stack Overflow for your questions. It
means that if Stack Overflow ever shuts down, this question is useless
to anyone else looking at this post and also adds an extra step to
anyone on this list wanting to answer your question- we're helping you
in our spare time because we want to help people with these things.
Please don't make us do extra work to help you.

Just a note- doing a "from module import *" is considered poor coding
style because it makes it difficult to figure out where all the names
are coming from, especially if you start doing multiple import *s in a
single code file. Either explicitly import the names you need ("from
ui.interface.interface import InterfaceCodes") or import the module
without adding the names to the local namespace ("import
ui.interface.interface")


--
Terry Jan Reedy

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


Re: split lines from stdin into a list of unicode strings

2013-09-05 Thread Peter Otten
Kurt Mueller wrote:

> Am 29.08.2013 11:12, schrieb Peter Otten:
>> [email protected] wrote:
>>> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
 On 28/8/2013 04:32, Kurt Mueller wrote:
> For some text manipulation tasks I need a template to split lines
> from stdin into a list of strings the way shlex.split() does it.
> The encoding of the input can vary.
> 
>> You can compromise and read ahead a limited number of lines. Here's my
>> demo script (The interesting part is detect_encoding(), I got a bit
>> distracted by unrelated stuff...). The script does one extra
>> decode/encode cycle -- it should be easy to avoid that if you run into
>> performance issues.
> 
> I took your script as a template.
> But I used the libmagic library (pyhton-magic) instead of chardet.
> See http://linux.die.net/man/3/libmagic
> and https://github.com/ahupp/python-magic
> ( I made tests with files of different size, up to 1.2 [GB] )
> 
> I had following issues:
> 
> - I a real file, the encoding was detected as 'ascii' for
> detect_lines=1000.
>   In line 1002 there was an umlaut character. So then the
>   line.decode(encoding) failed. I think to add the errors parameter,
>   line.decode(encoding, errors='replace')

Tough luck ;) You could try and tackle the problem by skipping leading 
ascii-only lines. Untested:

def detect_encoding(instream, encoding, detect_lines, skip_ascii=True):
if encoding is None:
encoding = instream.encoding
if encoding is None:
if skip_ascii:
try:
for line in instream:
yield line.decode("ascii")
except UnicodeDecodeError:
pass
else:
return
head = [line]
head.extend(islice(instream, detect_lines-1))
encoding =  chardet.detect("".join(head))["encoding"]
instream = chain(head, instream)
for line in instream:
yield line.decode(encoding)

Or keep two lists, one with all, and one with only non-ascii lines, and read 
lines until there are enough lines in the list of non-ascii strings to make 
a good guess. Then take that list to determine the encoding.

You can even combine both approaches...

> - If the buffer was bigger than about some Megabytes, the returned
> encoding
>   from libmagic was always None. The big files had very long lines ( more
>   than 4k per line ). So with detect_lines=1000 this limit was exceeded.
> 
> - The magic.buffer() ( the equivalent of chardet.detect() ) takes about 2
> seconds
>   per megabyte buffer.


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


Python KeyError

2013-09-05 Thread Robert Gliguroski
Dear Sirs,

I would like to ask a question that may seem a little off-topic but since it is 
related to Python and I really cannot solve it - I thought to try to ask for 
some help here.

I have installed OpenERP, an open source ERP software and then I installed an 
extension for connecting it to Magento. But when I configure it and try to 
connect them, I am getting and error that says:

"File "/opt/openerp/v7/server/openerp/modules/registry.py", line 102, in 
__getitem__
return self.models[model_name]
KeyError: u'magento.instance'"

This is the function in the registry.py file:

"def __getitem__(self, model_name):
""" Return a model for a given name or raise KeyError if it doesn't exist."""
return self.models[model_name]
"

Any help is appreciated, thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 09:31:41 +0300, Ferrous Cranus wrote:

[...]
> UBJECT = u"SuperHost Guest Mail από τον [ %s ]" % FROM
>   
> MESSAGE = "From: %s\n" + "To: %s\n" + "Subject: %s\n\n%s\n" % (FROM, TO,
> SUBJECT, MESSAGE)
> MESSAGE = MESSAGE.encode('utf-8')
> 
> 
> but i still get the same error messgae

And? What is the error message telling you? Don't just ask for help every 
single time you get an exception. The error says:

TypeError: not all arguments converted during string formatting


What does that mean? The string formatting operator is % and you can, and 
should, experiment on it yourself:

py> " %s" % 'hello'
' hello'


Now try to get the error you see:

py> "%s" % ('hello', "world")
Traceback (most recent call last):
  File "", line 1, in 
TypeError: not all arguments converted during string formatting

You have two strings on the right hand side of the % operator, but only 
one %s target on the left.

Now how about this?


py> "aa%s" + "bb%s" % ("hello", "world")
Traceback (most recent call last):
  File "", line 1, in 
TypeError: not all arguments converted during string formatting


What's the precedence of + and % operators? Which one gets executed 
first? Hint:


py> 8 + 2 % 5
10
py> (8 + 2) % 5
0
py> 8 + (2 % 5)
10

Even though these examples are with ints, not strings, the precedence is 
the same.

Go back to your code. Read your code. Does it look closer to this:

8 + 2 % 5

or this?

(8 + 2) % 5


Can you solve this problem now?



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


Re: Find out where a class is used throughout a program.

2013-09-05 Thread Dave Angel
On 4/9/2013 12:32, Azureaus wrote:

> Hi All,
> I'm fairly new to Python so please forgive me If I sound confused or include 
> anything a bit irrelevant. I've had some great responses from this group 
> already though so thanks.
>
> I have a source file that is laid out roughly like
>
> class:
> class methods
> methods 
> init statement

Perhaps you mean the __init__() method ?  This method is invoked when an
object of this class is created, and generally has the job of
initializing the instance data.  There may also (or instead) be a
__new__() method, which is the constructor.

> class:
> method
>
> It doesn't seem to have a run method unlike other similar source files I have 
> so it seems to be that this is being referenced from other files and is 
> almost a 'utility file'.

A method is a function located inside a class.  i think by "run method"
you are referring to top-level code.  That is code that is executed when
the script/module is first loaded.  You are right that if there is no
top-level code, then the file must be intended as a module (or library,
as it is sometimes called).  However nearly every module will have some
top-level code, even if it's only an import statement or a class
instance assignment.

>
> To try and make this question as general as possible - is there a way of 
> finding out / visualising where a particular class is called/used throughout 
> a program? I need to find out the way in which these classes are being used 
> and their typical input (and where the output from these are going) so I can 
> have a play around and really figure out how it works. Without a run method 
> to call, or an idea of expected input/output it's difficult. Also without 
> some sort of trace it's difficult.

As others have pointed out, an IDE can help greatly with this.  But your
first line of attack should be the documentation included with the
file(s).  If there's none, then perhaps it's throwaway code, and not
worth worrying about.

>
> I spoke to colleague and was told to look into dir() method in a Python shell 
> which I will do this evening but if anyone has any suggestions that would be 
> great. Even better if you think this is what I'm after a quick example/use 
> case would be even better. Or maybe I'm looking at this the wrong way and you 
> can point me towards some docs?
> Thanks for your help.

-- 
DaveA


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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus


Even though these examples are with ints, not strings, the precedence is
the same.

Go back to your code. Read your code. Does it look closer to this:

8 + 2 % 5

or this?

(8 + 2) % 5


Can you solve this problem now?

Yes Steven, according to your precedence example now i can:

MESSAGE = ( "From: %s\n" + "To: %s\n" + "Subject: %s\n\n%s\n" ) % ( 
FROM, TO, SUBJECT, MESSAGE )

MESSAGE = MESSAGE.encode('utf-8')



it just need the whole concatenation thing in parenthesis so to be 
executed first but now:



# send the mail
server.sendmail( [ MESSAGE ] )

or

# send the mail
server.sendmail( MESSAGE )

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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 5/9/2013 12:34 μμ, ο/η Ferrous Cranus έγραψε:


Even though these examples are with ints, not strings, the precedence is
the same.

Go back to your code. Read your code. Does it look closer to this:

8 + 2 % 5

or this?

(8 + 2) % 5


Can you solve this problem now?

Yes Steven, according to your precedence example now i can:

MESSAGE = ( "From: %s\n" + "To: %s\n" + "Subject: %s\n\n%s\n" ) % (
FROM, TO, SUBJECT, MESSAGE )
 MESSAGE = MESSAGE.encode('utf-8')



it just need the whole concatenation thing in parenthesis so to be
executed first but now:


 # send the mail
 server.sendmail( [ MESSAGE ] )

or

 # send the mail
 server.sendmail( MESSAGE )

both fail.

The error messge says:


[email protected] [~]# cat /tmp/err.out
sendmail =>  13-09-05 12:20:53 (, 
TypeError("sendmail() missing 2 required positional arguments: 
'to_addrs' and 'msg'",), )

[email protected] [~]#

but all of the needed args are within MESSAGE.
Cant it take it from there?

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


Buy carisoprodol online

2013-09-05 Thread buypharmacypill
Soma or Carisoprodol is basically a muscle relaxing medicine which is used in 
combination to cure muscle tightening and muscles pains after an injury or 
because of some other musculoskeletal condition. Soma or carisoprodol drugs 
have the composition called Carisoprodol which is used for treatment of 
relentless musculoskeletal disorders in the adults. 

Although having analgesic properties this drug is not recommended for treating 
other body aches and pains and should only be used as a drug for muscle 
relaxant.

New York City  

Call Us on our TOLL FREE Customer Services Number. 1-855-251-3111  

E - Mail - topdrugmart@ gmail.com  

Website ->: 
http://www.topdrugmart.com/muscle-relaxant/buy-soma-carisoprodol.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Dave Angel
On 5/9/2013 05:36, Ferrous Cranus wrote:

>
>
> [email protected] [~]# cat /tmp/err.out
> sendmail =>  13-09-05 12:20:53 (, 
> TypeError("sendmail() missing 2 required positional arguments: 
> 'to_addrs' and 'msg'",), )
> [email protected] [~]#
>
> but all of the needed args are within MESSAGE.
> Cant it take it from there?
>

Do you know how to find a link like this?

http://docs.python.org/3.3/library/smtplib.html#smtplib.SMTP.sendmail


-- 
DaveA


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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 5/9/2013 1:33 μμ, ο/η Dave Angel έγραψε:

On 5/9/2013 05:36, Ferrous Cranus wrote:




[email protected] [~]# cat /tmp/err.out
sendmail =>  13-09-05 12:20:53 (,
TypeError("sendmail() missing 2 required positional arguments:
'to_addrs' and 'msg'",), )
[email protected] [~]#

but all of the needed args are within MESSAGE.
Cant it take it from there?



Do you know how to find a link like this?

http://docs.python.org/3.3/library/smtplib.html#smtplib.SMTP.sendmail


is there way to alter tha FROM field to the one used in the webform by 
the visitor?


GMail adds the Sender by default is there some other service that 
doesn't and use the FROM field?


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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread feedthetroll
Am Donnerstag, 5. September 2013 12:48:54 UTC+2 schrieb Ferrous Cranus:
> is there way to alter tha FROM field to the one used in the webform by 
> the visitor?
Yes it ist. You did it in your code.
But gmail alters it AFTER you. So again, you did not care to read / understand 
the answers you got.

> GMail adds the Sender by default is there some other service that 
> doesn't and use the FROM field?
Yes. Already answered:
Am Mittwoch, 4. September 2013 14:18:55 UTC+2 schrieb Heiko Wundram:
> Am 03.09.2013 09:48, schrieb Ferrous Cranus:
>> Is there a workaround for that please?
> Yes, use/setup your own mailserver. Google will not allow you to send
> as ("i.e., From:") an arbitrary address besides the one you've
> authenticated as.
And again, you did not care to read / understand the answers you got.

So again: You are a troll.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 5/9/2013 2:02 μμ, ο/η [email protected] έγραψε:

Am 03.09.2013 09:48, schrieb Ferrous Cranus:

Is there a workaround for that please?

Yes, use/setup your own mailserver. Google will not allow you to send
as ("i.e., From:") an arbitrary address besides the one you've
authenticated as.

And again, you did not care to read / understand the answers you got.

So again: You are a troll.


I'm perfectly awra of the answers given to me. I do car to read them and 
do care to udnerstand them.


I need information on how to setup my own mail server

i cannot even connect to my 'mail.mydomain.com' mail server like i do 
with GMail's.


So:

server = smtplib.SMTP(localhost)

doesn't help, i cannot efen connect to my localhost mail server form 
within my script.


An alternative is needed, one that doesnt add up things as Sender but 
uses fROM field isntead.


--
Webhost 

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


Re: semicolon at end of python's statements

2013-09-05 Thread Duncan Booth
Chris Angelico  wrote:

> On Thu, Aug 29, 2013 at 10:18 AM, Mohsen Pahlevanzadeh
> wrote:
>> Dear all,
>>
>> I'm C++ programmer and unfortunately put semicolon at end of my
>> statements in python.
>>
>> Quesion:
>> What's really defferences between putting semicolon and don't put?
> 
> Very little. Putting the semicolon makes you look like a C programmer
> who's new to Python; omitting it makes you look like you actually
> understand Python :)
> 
> As a C and C++ programmer myself, I know where you're coming from, but
> putting semicolons at the ends of Python statements is as useless as
> putting lots of (((irritating (((superfluous
> (((parentheses) in your C++ code. The parser won't mind,
> but subsequent programmers will wonder what these unnecessary
> syntactic elements are for.
> 
> ChrisA
> 

Someone I knew actually used these definitions when writing C in a Pascalish, 
Algol68ish 
style (if I remembered them correctly):

#define IF if(((
#define AND ))&&((
#define OR )||(
#define THEN ))){
#define ELSE }else{
#define FI }


-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-09-05 Thread Chris Angelico
On Thu, Sep 5, 2013 at 9:33 PM, Duncan Booth
 wrote:
> Someone I knew actually used these definitions when writing C in a Pascalish, 
> Algol68ish
> style (if I remembered them correctly):
>
> #define IF if(((
> #define AND ))&&((
> #define OR )||(
> #define THEN ))){
> #define ELSE }else{
> #define FI }

Because s/he thought it made for better code, or as a joke? Usually I
see this sort of thing as the latter...

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


Using netrc when user password is blank

2013-09-05 Thread loial
I am having issues using the netrc package for users where the password is 
blank.
It works fine for users with password is not blank and is spacified in the 
.netrc 

I am not sure if this is an issue with the .netrc file or my use of the .netrc 
package.

.netrc file looks like :

machine myserver login john password 


Code is


username, ignore, password = netrc.netrc().hosts[hostname]


This fails saying the .netrc is malformed.
 
How should I specify the line in  the .netc when the password is blank? Or is 
it not possible



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


Re: how to detect comment in source code file ?

2013-09-05 Thread Piet van Oostrum
Dennis Lee Bieber  writes:

> On Tue, 3 Sep 2013 23:05:57 -0700 (PDT), [email protected] declaimed the
> following:
>
>>how works python interpreter for finding comment ?
>>if possible find nested comment ?
>
>   Python does not have "nested comment". Comments begin at any #
> character that is not inside a string (something inside ' or " pairs).

You could consider this a kind of nested comment :)

# if condition:
# # calculate the amount
# amount = sum(parts)
-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread feedthetroll
Am Donnerstag, 5. September 2013 13:20:23 UTC+2 schrieb Ferrous Cranus:
> Στις 5/9/2013 2:02 μμ, ο/η feedthetroll έγραψε:
>>> Am 03.09.2013 09:48, schrieb Ferrous Cranus:
 Is there a workaround for that please?
>>> Yes, use/setup your own mailserver. Google will not allow you to send
>>> as ("i.e., From:") an arbitrary address besides the one you've
>>> authenticated as.
>> And again, you did not care to read / understand the answers you got.
>> So again: You are a troll.
> 
> I'm perfectly awra of the answers given to me. I do car to read them and 
> do care to udnerstand them.
> 
> I need information on how to setup my own mail server
> i cannot even connect to my 'mail.mydomain.com' mail server like i do 
> with GMail's.
And you can solve this promblem by asking "How can I change the FROM field with 
python?" (which was your last question in this context, after you read and 
understood the cited answers)? ... Good luck!

Beeing serious:
Which mailserver did you install? postfix, exim, sendmail, ...?
Check that and read its dokumentation how to configure authentication.
Then you can use it.
And if you get stuck: A python list is NOT THE RIGHT PLACE to ask questions 
about the configuration of mailservers. Find the correct list for your 
mailserver and ask there!

> 
> So:
> server = smtplib.SMTP(localhost)
> doesn't help, i cannot efen connect to my localhost mail server form 
> within my script.
See above.

> An alternative is needed, one that doesnt add up things as Sender but 
> uses fROM field isntead.
No problem. Configure your own mail server the way you want it to work.

But remembering your attitude to security-things it would be better for us if 
you did NOT adminstrate a mailserver. We do not need another open relay.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 5/9/2013 3:18 μμ, ο/η [email protected] έγραψε:

Beeing serious:
Which mailserver did you install? postfix, exim, sendmail, ...?
Check that and read its dokumentation how to configure authentication.
Then you can use it.
And if you get stuck: A python list is NOT THE RIGHT PLACE to ask questions 
about the configuration of mailservers. Find the correct list for your 
mailserver and ask there!



My WHM uses DoveCot as enaled mail server but i have no idea how to 
setip up to work.


i cannot connect to it via my python script.

i looked over at my WHM for configuration but i didnt find out how to 
properly configure it.


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


Importing Definitions

2013-09-05 Thread Azureaus
Hi all,
Thank you all for your help so far in the group.

Lets say I have some definitions in a module1.py e.g.

import sys
A,B,C,D,E = range(5)
def method1():
more code
end

Then a second module module2.py where I wish to use these definitions
import module1.py
print A

This will throw an error saying "global name 'A' is not defined."

Now I know if there was a method I wanted to reference I could do something 
like this in module2.
from module1 import method1

which would mean from that point on I could just reference it as method1 rather 
than module1.method1, is there such a way I could do this with definitions??

Thanks!

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


PyDev 2.8.2 released

2013-09-05 Thread Fabio Zadrozny
Hi All,

PyDev 2.8.2 has been released

Details on PyDev: http://pydev.org
Details on its development: http://pydev.blogspot.com
Become a supporter and help to keep it going forward:
https://sw-brainwy.rhcloud.com/

Release Highlights:
---

* The type inference engine now accepts comments in the format **#@type a:
str** to get the type.

* Interpreter configuration properly deals with characters with ampersand.

* Interactive console can now work with PySide and wxPython to create
widgets without blocking.

* Debugger now working properly with Jython 2.1.

* Markups in sphinx or epydoc format can now have a different color in
docstrings.

* Code-completion for the sphinx markup is provided in docstrings.

* Fixed issue when resolving module names (which could make PyDev find
modules as Lib.math instead of math if the interpreter folder was added to
the PYTHONPATH and not only the Lib folder).

* When configuring project source folders (PYTHONPATH), it's possible to
make use of the PROJECT_DIR_NAME variable.

* **Patches by Trey Greer**:

* PyLint 1.0 is now properly supported.

* **Patches by Jonah Graham:**

* Fixed issue in interactive console interaction with XML-RPC.

* Interactive console history is saved to persistent location.

* It's possible to filter variables in the variables view menu (can be
activated with Ctrl+F10 focusing the variables view > PyDev,
select/deselect filters).

* Eclipse variables are expanded in the initial interpreter commands for
the interactive console.

* An evaluate button (same as Ctrl+Alt+Enter) is now available in the
toolbar.

* **Patches by by Anselm Kruis:**

* Fixed issues related to having the interpreter or workspace in locations
with non-ascii characters.

* **Patches by Jeremy Carroll:**

* It's now possible to use PEP-8 style imports (default now, can be
unconfigured at window > preferencs > pydev > editor > code style >
imports).

* It's possible to configure the organize imports to remove unused imports
(must be enabled in window > preferencs > pydev > editor > code style >
imports).

* **Patches by Andrew Ferrazzutti:**

* Better heuristics to discover file in workspace related to open files
when debugging.

* Improvements in the PyDev project configuration and wizard.

* It's possible to mark/unmark folders as source folders with a right-click
context menu.

* Auto-Configuration of interpreter streamlined.

* **Patches by Andre Berg:**

* It's possible to have a change action which will keep a variable updated
when file is changed (i.e.: __date__ = '2013-01-01' would be updated when
file is saved to a new date).


What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python, Jython and
IronPython development -- making Eclipse a first class Python IDE -- It
comes with many goodies such as code completion, syntax highlighting,
syntax analysis, refactor, debug and many others.


Cheers,

--
Fabio Zadrozny
--
Software Developer

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find out where a class is used throughout a program.

2013-09-05 Thread Azureaus
On Wednesday, 4 September 2013 17:32:28 UTC+1, Azureaus  wrote:
> Hi All,
> 
> I'm fairly new to Python so please forgive me If I sound confused or include 
> anything a bit irrelevant. I've had some great responses from this group 
> already though so thanks.
> 
> 
> 
> I have a source file that is laid out roughly like
> 
> 
> 
> class:
> 
> class methods
> 
> methods 
> 
> init statement
> 
> class:
> 
> method
> 
> 
> 
> It doesn't seem to have a run method unlike other similar source files I have 
> so it seems to be that this is being referenced from other files and is 
> almost a 'utility file'.
> 
> 
> 
> To try and make this question as general as possible - is there a way of 
> finding out / visualising where a particular class is called/used throughout 
> a program? I need to find out the way in which these classes are being used 
> and their typical input (and where the output from these are going) so I can 
> have a play around and really figure out how it works. Without a run method 
> to call, or an idea of expected input/output it's difficult. Also without 
> some sort of trace it's difficult.
> 
> 
> 
> I spoke to colleague and was told to look into dir() method in a Python shell 
> which I will do this evening but if anyone has any suggestions that would be 
> great. Even better if you think this is what I'm after a quick example/use 
> case would be even better. Or maybe I'm looking at this the wrong way and you 
> can point me towards some docs?
> 
> Thanks for your help.

Thanks you all for your time and responses they have been a great help. The 
practical examples were especially helpful. I'm going to go through the 
suggestions and try them out to find which one is most suited but overall I 
feel like my understanding/knowledge of Python has increased which is really 
the whole point. I think I'm going to be a regular here :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cross Platform

2013-09-05 Thread William Ray Wing
On Sep 4, 2013, at 11:47 PM, Chandru Rajendran  
wrote:

> Hi all,
> 
> I have a doubt regarding the python cross platform.

I think you mean you have a question...

> If we write Class in windows ,whether we can without any modifications in 
> Linux, if so then how about the GUI programming and Libraries.
> Please provide needful information.
> 
> Thanks,
> Chandru
> 

If (and this is a big if), but if you restrict yourself to using libraries 
which are themselves cross platform (Google "Python standard library" without 
the quotes) and don't spawn sub-jobs that invoke os-specific operations, then 
yes - python can be completely and cleanly cross platform.  With respect to GUI 
programming, that simply means using one of the cross-platform GUI libraries.  
In this context Tk and ttk (which are part of the standard library) have the 
advantage of being both cross platform AND offering native appearance on all 
platforms.

-Bill

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


Re: Find out where a class is used throughout a program.

2013-09-05 Thread Chris Angelico
On Thu, Sep 5, 2013 at 10:42 PM, Azureaus  wrote:
> I think I'm going to be a regular here :)

Glad to have you around! Interesting and thoughtful questions, as much
as informative answers, are what make this list/group worth being in.
I originally came to ask a question, hung around to answer a few, and
stuck here because there's so much awesome and crazy wit...

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


RE: Cross Platform

2013-09-05 Thread Chandru Rajendran
Thank you William.

-Original Message-
From: William Ray Wing [mailto:[email protected]] 
Sent: Thursday, September 05, 2013 6:18 PM
To: Chandru Rajendran
Cc: William Ray Wing; [email protected]
Subject: Re: Cross Platform

On Sep 4, 2013, at 11:47 PM, Chandru Rajendran  
wrote:

> Hi all,
> 
> I have a doubt regarding the python cross platform.

I think you mean you have a question...

> If we write Class in windows ,whether we can without any modifications in 
> Linux, if so then how about the GUI programming and Libraries.
> Please provide needful information.
> 
> Thanks,
> Chandru
> 

If (and this is a big if), but if you restrict yourself to using libraries 
which are themselves cross platform (Google "Python standard library" without 
the quotes) and don't spawn sub-jobs that invoke os-specific operations, then 
yes - python can be completely and cleanly cross platform.  With respect to GUI 
programming, that simply means using one of the cross-platform GUI libraries.  
In this context Tk and ttk (which are part of the standard library) have the 
advantage of being both cross platform AND offering native appearance on all 
platforms.

-Bill


 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not 
to copy, disclose, or distribute this e-mail or its contents to any other 
person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken 
every reasonable precaution to minimize this risk, but is not liable for any 
damage 
you may sustain as a result of any virus in this e-mail. You should carry out 
your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this 
e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Importing Definitions

2013-09-05 Thread Chris Angelico
On Thu, Sep 5, 2013 at 10:39 PM, Azureaus  wrote:
> Lets say I have some definitions in a module1.py e.g.
>
> import sys
> A,B,C,D,E = range(5)
> def method1():
> more code
> end
>
> Then a second module module2.py where I wish to use these definitions
> import module1.py
> print A
>
> This will throw an error saying "global name 'A' is not defined."
>
> Now I know if there was a method I wanted to reference I could do something 
> like this in module2.
> from module1 import method1
>
> which would mean from that point on I could just reference it as method1 
> rather than module1.method1, is there such a way I could do this with 
> definitions??

You can! Any name will work, functions aren't special.

from module1 import method1, A, B, C, D, E

If you want all of them at once, you may want:

from module1 import *

but this can make your code confusing.

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


Re: Importing Definitions

2013-09-05 Thread Peter Otten
Azureaus wrote:

> This will throw an error saying "global name 'A' is not defined."
> 
> Now I know if there was a method I wanted to reference I could do
> something like this in module2. 

> from module1 import method1

What a crazy idea! How could anyone ever think of that!
 
> which would mean from that point on I could just reference it as method1
> rather than module1.method1, is there such a way I could do this with
> definitions??

Please read the tutorial, especially

http://docs.python.org/2/tutorial/modules.html#more-on-modules

before you come up with more crazy shit like this ;)

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


Plot in MatPlotLib

2013-09-05 Thread Chandru Rajendran
Hi all,

I have written the types to plot in Matplotlib.

#Usage Type  1
plt.plot(t,s)
plt.show()
#Usage type 2
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(t,s)
plt.show()


I want difference between these types and other ways in which we can use plot.


Thanks & Regards,
Chandru

 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are 
not
to copy, disclose, or distribute this e-mail or its contents to any other 
person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has 
taken
every reasonable precaution to minimize this risk, but is not liable for any 
damage
you may sustain as a result of any virus in this e-mail. You should carry out 
your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this 
e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: split lines from stdin into a list of unicode strings

2013-09-05 Thread Kurt Mueller
Am 05.09.2013 10:33, schrieb Peter Otten:
> Kurt Mueller wrote:
>> Am 29.08.2013 11:12, schrieb Peter Otten:
>>> [email protected] wrote:
 On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
> On 28/8/2013 04:32, Kurt Mueller wrote:
>> For some text manipulation tasks I need a template to split lines
>> from stdin into a list of strings the way shlex.split() does it.
>> The encoding of the input can vary.
>> I took your script as a template.
>> But I used the libmagic library (pyhton-magic) instead of chardet.
>> See http://linux.die.net/man/3/libmagic
>> and https://github.com/ahupp/python-magic
>> ( I made tests with files of different size, up to 1.2 [GB] )
>> I had following issues:
>> - I a real file, the encoding was detected as 'ascii' for
>> detect_lines=1000.
>>   In line 1002 there was an umlaut character. So then the
>>   line.decode(encoding) failed. I think to add the errors parameter,
>>   line.decode(encoding, errors='replace')
> 
> Tough luck ;) You could try and tackle the problem by skipping leading 
> ascii-only lines. Untested:
> 
> def detect_encoding(instream, encoding, detect_lines, skip_ascii=True):
> if encoding is None:
> encoding = instream.encoding
> if encoding is None:
> if skip_ascii:
> try:
> for line in instream:
> yield line.decode("ascii")
> except UnicodeDecodeError:
> pass
> else:
> return
> head = [line]
> head.extend(islice(instream, detect_lines-1))
> encoding =  chardet.detect("".join(head))["encoding"]
> instream = chain(head, instream)
> for line in instream:
> yield line.decode(encoding)

I find this solution as a generator very nice.
With just some small modifications it runs fine for now.
( line is undefined if skip_ascii is False. )

For ascii only files chardet or libmagic will not be bothered.
And the detect_lines comes not in charge, until there are
some non ascii characters.

--
def decode_stream_lines( inpt_strm, enco_type, numb_inpt, skip_asci=True, ):
if enco_type is None:
enco_type = inpt_strm.encoding
if enco_type is None:
line_head = []
if skip_asci:
try:
for line in inpt_strm:
yield line.decode( 'ascii' )
except UnicodeDecodeError:
line_head = [ line ] # last line was not ascii
else:
return # all lines were ascii
line_head.extend( islice( inpt_strm, numb_inpt - 1 ) )
magc_enco = magic.open( magic.MAGIC_MIME_ENCODING )
magc_enco.load()
enco_type = magc_enco.buffer( "".join( line_head ) )
magc_enco.close()
print( I_AM + '-ERROR: enco_type=' + repr( enco_type ), 
file=sys.stderr, )
if  enco_type.rfind( 'binary' ) >= 0: # binary, 
application/mswordbinary, application/vnd.ms-excelbinary and the like
return
inpt_strm = chain( line_head, inpt_strm )
for line in inpt_strm:
yield line.decode( enco_type, errors='replace' )
--


Thank you very much!
-- 
Kurt Mueller
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread feedthetroll
Am Donnerstag, 5. September 2013 14:36:19 UTC+2 schrieb Ferrous Cranus:
> Στις 5/9/2013 3:18 μμ, ο/η feedthetroll έγραψε:
>> Beeing serious:
>> Which mailserver did you install? postfix, exim, sendmail, ...?
>> Check that and read its dokumentation how to configure authentication.
>> Then you can use it.
> 
>> And if you get stuck: A python list is NOT THE RIGHT PLACE to ask questions
>> about the configuration of mailservers. Find the correct list for your
>> mailserver and ask there!
> 
> My WHM
WHM (http://www.globalacronyms.com/whm):
Meaning of Acronym WHM   Language Category
Watt Hour Meter  Acronym in English   Science, Unit Measure,
  Chemistry, Biology, Acronym
Work Hour Management Acronym in English   General, Common Abbreviation,
  Slang, Acronym

> uses DoveCot as enaled mail server but i have no idea how to 
> setip up to work.
> i cannot connect to it via my python script.
OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent, Message 
Transport Agent) like postfix, exim, sendmail, ...

DoveCot is good for "reading" mail (="mailbox management", "pop3(s)", 
"imap(s)"). You cannot send mails using DoveCot. (You can use a WebMailService 
to access DoveCot for reading and a MTA for sending mails.)

So you have to find out, which MTA you installed (you have root access, don't 
you) and configure it.

But this is (like so often) becoming extremely offtopic.

> i looked over at my WHM for configuration but i didnt find out how to 
> properly configure it.
http://www.dovecot.org/documentation.html - but DoveCot won't help you here.

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


Re: Importing Definitions

2013-09-05 Thread Ethan Furman

On 09/05/2013 05:39 AM, Azureaus wrote:


This will throw an error saying "global name 'A' is not defined."


In Python, "global" really means "module-level".



Now I know if there was a method I wanted to reference I could do something 
like this in module2.
from module1 import method1

which would mean from that point on I could just reference it as method1 rather 
than module1.method1, is there such a way I could do this with definitions??


from module1 import data1

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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 5/9/2013 4:29 μμ, ο/η [email protected] έγραψε:

uses DoveCot as enaled mail server but i have no idea how to
setip up to work.
i cannot connect to it via my python script.

OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent, Message 
Transport Agent) like postfix, exim, sendmail, ...

DoveCot is good for "reading" mail (="mailbox management", "pop3(s)", 
"imap(s)"). You cannot send mails using DoveCot. (You can use a WebMailService to access DoveCot for reading 
and a MTA for sending mails.)

So you have to find out, which MTA you installed (you have root access, don't 
you) and configure it.

But this is (like so often) becoming extremely offtopic.



i as root just inatslled

sendmail and mailx. i have edited the ~/.mailrc to use:


[email protected] [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=may)gmail
set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
}



And now i'm trying  to:


cmd = "echo %s | mailx -A gmail -r %s -s %s %s"  %  (MESSAGE, FROM, 
SUBJECT, TO)

p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
output, errors = p.communicate()
print( errors, output )


Any ideas please why this fails to work?
while i remove the '-A gmail' string in the cmd line then i can send 
fast mail but only to mail containing the @superhost.gr trail.


i need to be eble to send to external mails to.

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


Re: semicolon at end of python's statements

2013-09-05 Thread Jeremy Sanders
Chris Angelico wrote:

> Because s/he thought it made for better code, or as a joke? Usually I
> see this sort of thing as the latter...

http://oldhome.schmorp.de/marc/bournegol.html
http://utcc.utoronto.ca/~cks/space/blog/programming/BourneGol

Jeremy


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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 5/9/2013 4:38 μμ, ο/η Ferrous Cranus έγραψε:

Στις 5/9/2013 4:29 μμ, ο/η [email protected] έγραψε:

uses DoveCot as enaled mail server but i have no idea how to
setip up to work.
i cannot connect to it via my python script.

OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent,
Message Transport Agent) like postfix, exim, sendmail, ...

DoveCot is good for "reading" mail (="mailbox management", "pop3(s)",
"imap(s)"). You cannot send mails using DoveCot. (You can use a
WebMailService to access DoveCot for reading and a MTA for sending
mails.)

So you have to find out, which MTA you installed (you have root
access, don't you) and configure it.

But this is (like so often) becoming extremely offtopic.



i as root just inatslled

sendmail and mailx. i have edited the ~/.mailrc to use:


[email protected] [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=may)gmail
set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
}



And now i'm trying  to:


cmd = "echo %s | mailx -A gmail -r %s -s %s %s"  %  (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
output, errors = p.communicate()
print( errors, output )


Any ideas please why this fails to work?
while i remove the '-A gmail' string in the cmd line then i can send
fast mail but only to mail containing the @superhost.gr trail.

i need to be eble to send to external mails to.


Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.

is what iam receivign  as error output

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


Re: semicolon at end of python's statements

2013-09-05 Thread Grant Edwards
On 2013-09-05, Duncan Booth  wrote:

> Someone I knew actually used these definitions when writing C in a
> Pascalish, Algol68ish style (if I remembered them correctly):
>
> #define IF if(((
> #define AND ))&&((
> #define OR )||(
> #define THEN ))){
> #define ELSE }else{
> #define FI }

Yep, I once knew somebody who used a set of macros like that to make C
programs look as much like some dialect of BASIC as possible.  He also
wrote his letters/memos in Lotus 1,2,3...

-- 
Grant Edwards   grant.b.edwardsYow! I want to mail a
  at   bronzed artichoke to
  gmail.comNicaragua!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-09-05 Thread Chris Angelico
On Fri, Sep 6, 2013 at 12:05 AM, Jeremy Sanders
 wrote:
> Chris Angelico wrote:
>
>> Because s/he thought it made for better code, or as a joke? Usually I
>> see this sort of thing as the latter...
>
> http://oldhome.schmorp.de/marc/bournegol.html
> http://utcc.utoronto.ca/~cks/space/blog/programming/BourneGol

Yep, that's some impressive code right there!

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


Pcap network buffer

2013-09-05 Thread hareksu
Hi all,

 I've been writing an application for capturing multiple HD network video 
streams using a linux laptop with packet capture. For this I've used pcapy, 
which wraps parts of libpcap. The problem is that with the default network 
buffer size, I end up with corrupted video, so I changed the default buffer 
size and tried again, to no avail. I dug into the problem a bit, and noticed 
that both tcpdump and wireshark can set the buffer size, in which case I record 
without problem, and the libpcap C library has an fucntion pcap_set_buffer_size 
reflecting this, but neither pcapy or pylibpcap seem to include this 
functionality. 
 So my question is this: is there a python way to set this buffer size, or do I 
need to write this in C? Thanks in advance.

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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread feedthetroll
Am Donnerstag, 5. September 2013 15:38:25 UTC+2 schrieb Ferrous Cranus:
> Στις 5/9/2013 4:29 μμ, ο/η feedthetroll έγραψε:
>>> uses DoveCot as enaled mail server but i have no idea how to
>>> setip up to work.
>>> i cannot connect to it via my python script.
>> OK, I should have been more exact:
>> To send mails you need a "smtp-server" (MTA - Mail Transfer Agent,
>> Message Transport Agent) like postfix, exim, sendmail, ...
>>
>> DoveCot is good for "reading" mail (="mailbox management", "pop3(s)",
>> "imap(s)"). You cannot send mails using DoveCot. (You can use a
>> WebMailService to access DoveCot for reading and a MTA for sending mails.)
>>
>> So you have to find out, which MTA you installed (you have root access,
>> don't you) and configure it.
>>
>> But this is (like so often) becoming extremely offtopic.
> 
> i as root just inatslled
> 
> sendmail and mailx. i have edited the ~/.mailrc to use:
>
> [email protected] [~/www/cgi-bin]# cat ~/.mailrc
> account gmail {
> set smtp-use-starttls
> set smtp=smtp://smtp.gmail.com:587
> set smtp-auth=login
> set smtp-auth-user=may)gmail
> set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
> }
Don't use gmail. Gmail is the cause of your problem. As long as you use it 
(whatever way you use) the problem will persist. USE YOUR SENDMAIL.

> And now i'm trying  to:
> cmd = "echo %s | mailx -A gmail -r %s -s %s %s"  %  (MESSAGE, FROM, 
> SUBJECT, TO)
> p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
> output, errors = p.communicate()
> print( errors, output )
DONT INVOKE THIS VIA PYTHON. Use the shell. If it works there, you can try it 
with python.

> Any ideas please why this fails to work?
> while i remove the '-A gmail' string in the cmd line then i can send 
> fast mail but only to mail containing the @superhost.gr trail.
> i need to be eble to send to external mails to.
THIS IS NOT A SENDMAIL LIST!
Solve your sendmail-problem and then, if it still does not work from python 
come back with a smart question.

FUP: comp.mail.sendmail
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 5/9/2013 6:00 μμ, ο/η [email protected] έγραψε:

Am Donnerstag, 5. September 2013 15:38:25 UTC+2 schrieb Ferrous Cranus:

Στις 5/9/2013 4:29 μμ, ο/η feedthetroll έγραψε:

uses DoveCot as enaled mail server but i have no idea how to
setip up to work.
i cannot connect to it via my python script.

OK, I should have been more exact:
To send mails you need a "smtp-server" (MTA - Mail Transfer Agent,
Message Transport Agent) like postfix, exim, sendmail, ...

DoveCot is good for "reading" mail (="mailbox management", "pop3(s)",
"imap(s)"). You cannot send mails using DoveCot. (You can use a
WebMailService to access DoveCot for reading and a MTA for sending mails.)

So you have to find out, which MTA you installed (you have root access,
don't you) and configure it.

But this is (like so often) becoming extremely offtopic.


i as root just inatslled

sendmail and mailx. i have edited the ~/.mailrc to use:

[email protected] [~/www/cgi-bin]# cat ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=may)gmail
set smtp-auth-password=my_gmail_pass_not_stupid_enough_to_wite _it_again
}

Don't use gmail. Gmail is the cause of your problem. As long as you use it 
(whatever way you use) the problem will persist. USE YOUR SENDMAIL.


And now i'm trying  to:
cmd = "echo %s | mailx -A gmail -r %s -s %s %s"  %  (MESSAGE, FROM,
SUBJECT, TO)
p=subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE )
output, errors = p.communicate()
print( errors, output )

DONT INVOKE THIS VIA PYTHON. Use the shell. If it works there, you can try it 
with python.


Any ideas please why this fails to work?
while i remove the '-A gmail' string in the cmd line then i can send
fast mail but only to mail containing the @superhost.gr trail.
i need to be eble to send to external mails to.

THIS IS NOT A SENDMAIL LIST!
Solve your sendmail-problem and then, if it still does not work from python 
come back with a smart question.

FUP: comp.mail.sendmail


pok i will ask to sendmail list

but tell me please mailx and senmail are 2 differnt MTAs or mailx makes 
use of sendmail MTA?


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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Piet van Oostrum
Ferrous Cranus  writes:

> it just need the whole concatenation thing in parenthesis so to be
> executed first but now:
>
>
>   # send the mail
>   server.sendmail( [ MESSAGE ] )
>
> or
>
>   # send the mail
>   server.sendmail( MESSAGE )
>
> both fail.

The first thing you should do then is to look up the documentation of
sendmail. http://docs.python.org/ has a good index where you can look
for sendmail.
-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-09-05 Thread Duncan Booth
Chris Angelico  wrote:

> On Fri, Sep 6, 2013 at 12:05 AM, Jeremy Sanders
> wrote:
>> Chris Angelico wrote:
>>
>>> Because s/he thought it made for better code, or as a joke? Usually I
>>> see this sort of thing as the latter...

It was intended for clearer code, which is true if you don't like curly 
braces, and who does round here?

>>
>> http://oldhome.schmorp.de/marc/bournegol.html
>> http://utcc.utoronto.ca/~cks/space/blog/programming/BourneGol
> 
> Yep, that's some impressive code right there!
> 
> ChrisA
> 

That brings back memories all right, but its not as good as the version I 
remember as it doesn't 'fix' the logical operator priorities.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread jsrig88
Could someone please paraphrase this statement about variables and functions in 
Python?

I am going through the tutorials on docs.python.org, and I came across this 
excerpt from http://docs.python.org/3/tutorial/controlflow.html:

"The execution of a function introduces a new symbol table used for the local 
variables of the function. More precisely, all variable assignments in a 
function store the value in the local symbol table; whereas variable references 
first look in the local symbol table, then in the local symbol tables of 
enclosing functions, then in the global symbol table, and finally in the table 
of built-in names. Thus, global variables cannot be directly assigned a value 
within a function (unless named in a global statement), although they may be 
referenced.

"The actual parameters (arguments) to a function call are introduced in the 
local symbol table of the called function when it is called; thus, arguments 
are passed using call by value (where the value is always an object reference, 
not the value of the object). [1] When a function calls another function, a new 
local symbol table is created for that call."

Even as a professional programmer, I'm not really able to follow this.  It 
appears to be self-contradictory, amgiguous, incomplete, and possessive of 
logical missteps.  The problem with looking for this information elsewhere is 
that it's not going to be all in one spot like this half the time, and it's not 
going to be readily searchable on Google without more knowledge of what it's 
referring to.  However this looks like something that's too important to 
overlook.

I can tell it's referring to things like scope, pass-by-value, references, 
probably the call stack, etc., but it is written extremely poorly.  Translation 
please?  Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread Dave Angel
On 5/9/2013 12:37, [email protected] wrote:

> I am going through the tutorials on docs.python.org, and I came across this 
> excerpt from http://docs.python.org/3/tutorial/controlflow.html:
>
> "The execution of a function introduces a new symbol table used for the local 
> variables of the function. More precisely, all variable assignments in a 
> function store the value in the local symbol table; whereas variable 
> references first look in the local symbol table, then in the local symbol 
> tables of enclosing functions, then in the global symbol table, and finally 
> in the table of built-in names. Thus, global variables cannot be directly 
> assigned a value within a function (unless named in a global statement), 
> although they may be referenced.

That new symbol table is per call, thus it's equivalent to a stack
frame. A new stack frame is created when the function is called.  The
names in that stack frame are the function parameter names, plus all the
names that are assigned to within that function, minus any names that
were declared as global or as nonlocal.  The list of such names is
determined at compile time,not during the run of the function.

Any reference within that function to names NOT in that local symbol
table will be resolved at run time in a particular order;  first in any
enclosing functions (nested function definitions, which is NOT the same
as nested calls), then in the global namespace, then in builtins.  If
the name cannot be found in any of those places, you'll get a runtime
exception, something like NameError: global name 'b' is not defined



>
> "The actual parameters (arguments) to a function call are introduced in the 
> local
> symbol table of the called function when it is called; thus, arguments are 
> passed
> using call by value (where the value is always an object reference, not the 
> value
> of the object). [1] When a function calls another function, a new local symbol
> table is created for that call."
>
> Even as a professional programmer, I'm not really able to follow this.  It 
> seems self-contradictory, amgiguous, and incomplete.  The problem with 
> looking for this information elsewhere is that it's not going to be all in 
> one spot like this half the time, and it's not going to be readily searchable 
> on Google without more knowledge of what it's referring to.  However this 
> looks like something that's too important to overlook.
>
> I can tell it's referring to things like scope, pass-by-value, references, 
> probably the call stack, etc., but it is written extremely poorly.  
> Translation please?  Thanks!

Python doesn't do pass-by-value nor pass-by-reference.  The expression
in the calling argument is some object.  During a call to a function,
that object is bound to the parameter name, which is a local variable in
the called function.  The object is NOT copied, it is effectively
shared.  if the object is immutable, the distinction is unimportant, but
if the object is changed, it's changed for all names that are bound to
the same object.

-- 
DaveA

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


Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread newspost2012
Am Donnerstag, 5. September 2013 19:05:17 UTC+2 schrieb Joel Goldstick:
> On Thu, Sep 5, 2013 at 12:40 PM,   wrote:
>> ...
>> Even as a professional programmer, I'm not really able to follow this.
>> It appears to be self-contradictory, amgiguous, incomplete, and possessive
>> of logical missteps.  The problem with looking for this information
>> elsewhere is that it's not going to be all in one spot like this half the
>> time, and it's not going to be readily searchable on Google without more
>> knowledge of what it's referring to.  However this looks like something
>> that's too important to overlook.
>>
>> I can tell it's referring to things like scope, pass-by-value, references,
>> probably the call stack, etc., but it is written extremely poorly.
>> Translation please?  Thanks!
>
> Nearly everyone gets confused by this initially.  You should google
> python namespaces

You can also take a look at http://nedbatchelder.com/text/names.html
It was a great help for me. Many thanks Ned!

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


Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread jsrig88
I am going through the tutorials on docs.python.org, and I came across this 
excerpt from http://docs.python.org/3/tutorial/controlflow.html:

"The execution of a function introduces a new symbol table used for the local 
variables of the function. More precisely, all variable assignments in a 
function store the value in the local symbol table; whereas variable references 
first look in the local symbol table, then in the local symbol tables of 
enclosing functions, then in the global symbol table, and finally in the table 
of built-in names. Thus, global variables cannot be directly assigned a value 
within a function (unless named in a global statement), although they may be 
referenced.

"The actual parameters (arguments) to a function call are introduced in the 
local
symbol table of the called function when it is called; thus, arguments are 
passed
using call by value (where the value is always an object reference, not the 
value
of the object). [1] When a function calls another function, a new local symbol
table is created for that call."

Even as a professional programmer, I'm not really able to follow this.  It 
seems self-contradictory, amgiguous, and incomplete.  The problem with looking 
for this information elsewhere is that it's not going to be all in one spot 
like this half the time, and it's not going to be readily searchable on Google 
without more knowledge of what it's referring to.  However this looks like 
something that's too important to overlook.

I can tell it's referring to things like scope, pass-by-value, references, 
probably the call stack, etc., but it is written extremely poorly.  Translation 
please?  Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread Joel Goldstick
On Thu, Sep 5, 2013 at 12:40 PM,   wrote:
> Could someone please paraphrase this statement about variables and functions 
> in Python?
>
> I am going through the tutorials on docs.python.org, and I came across this 
> excerpt from http://docs.python.org/3/tutorial/controlflow.html:
>
> "The execution of a function introduces a new symbol table used for the local 
> variables of the function. More precisely, all variable assignments in a 
> function store the value in the local symbol table; whereas variable 
> references first look in the local symbol table, then in the local symbol 
> tables of enclosing functions, then in the global symbol table, and finally 
> in the table of built-in names. Thus, global variables cannot be directly 
> assigned a value within a function (unless named in a global statement), 
> although they may be referenced.
>
> "The actual parameters (arguments) to a function call are introduced in the 
> local symbol table of the called function when it is called; thus, arguments 
> are passed using call by value (where the value is always an object 
> reference, not the value of the object). [1] When a function calls another 
> function, a new local symbol table is created for that call."
>
> Even as a professional programmer, I'm not really able to follow this.  It 
> appears to be self-contradictory, amgiguous, incomplete, and possessive of 
> logical missteps.  The problem with looking for this information elsewhere is 
> that it's not going to be all in one spot like this half the time, and it's 
> not going to be readily searchable on Google without more knowledge of what 
> it's referring to.  However this looks like something that's too important to 
> overlook.
>
> I can tell it's referring to things like scope, pass-by-value, references, 
> probably the call stack, etc., but it is written extremely poorly.  
> Translation please?  Thanks!
> --
> https://mail.python.org/mailman/listinfo/python-list

Nearly everyone gets confused by this initially.  You should google
python namespaces

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


Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread Neil Cerutti
On 2013-09-05, [email protected]  wrote:
> I am going through the tutorials on docs.python.org, and I came
> across this excerpt from
> http://docs.python.org/3/tutorial/controlflow.html:
>
> "The execution of a function introduces a new symbol table used
> for the local variables of the function. More precisely, all
> variable assignments in a function store the value in the local
> symbol table; whereas variable references first look in the
> local symbol table, then in the local symbol tables of
> enclosing functions, then in the global symbol table, and
> finally in the table of built-in names. Thus, global variables
> cannot be directly assigned a value within a function (unless
> named in a global statement), although they may be referenced.

Every function has its own scope, which is a list of its local
variables.

When you assign to a local name in a function, you are assigning
to the symbol table that stores those variables.

Not spelled out exactly is that every unqualified name assigned
to in a function is assumed to be a local variable. So this is an
error:

>>> x = 5
>>> def foo():
...   print(x)
...   x = 7
...
>>> foo()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in foo
UnboundLocalError: local variable 'x' referenced before assignment

If the assignement to x is removed, then you can refer to the
global variable just fine.

>>> x = 5
>>> def foo():
...   print(x)
...
>>> foo()
5

In a function, you can allow assignment to global variables using
the global statement.

>>> x = 5
>>> def foo():
...   global x
...   print(x)
...   x = 7
...
>>> foo()
5
>>> x
7

> "The actual parameters (arguments) to a function call are
> introduced in the local symbol table of the called function
> when it is called; thus, arguments are passed using call by
> value (where the value is always an object reference, not the
> value of the object). [1] When a function calls another
> function, a new local symbol table is created for that call."

When you call a function, it is as if an assignment of the
arguments to the function paramters takes place.

def foo(x, y):
  print(x, y)

When I call foo(1, 2), the effect is:

1. The local variable x is assigned to the object returned by the
   expression 1
2. The local y is assigned to the object returned by the expression 2
3. The body of function foo is run.

Assignments in Python are name-binding.  Objects are passed into
functions by assignment. If you understand how assignment works
in Python, that's a good explanation.

Finally, every time you call a function a new symbol table is
built. So I can do the following without names conflicting:

def foo(x, y):
   if x == 0:
 return y
   y *= 2
   return foo(x-1, y)

> Even as a professional programmer, I'm not really able to
> follow this.  It seems self-contradictory, amgiguous, and
> incomplete.  The problem with looking for this information
> elsewhere is that it's not going to be all in one spot like
> this half the time, and it's not going to be readily searchable
> on Google without more knowledge of what it's referring to.
> However this looks like something that's too important to
> overlook.

It's not ambiguous, self-contradictory or incomplete. But it's
very densely packed with information; perhaps it's too complete.

> I can tell it's referring to things like scope, pass-by-value,
> references, probably the call stack, etc., but it is written
> extremely poorly.  Translation please?  Thanks!

I don't think that's a fair criticism, but it might be too
technical for a language tutorial.

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


Re: Importing Definitions

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 22:50:35 +1000, Chris Angelico wrote:

> On Thu, Sep 5, 2013 at 10:39 PM, Azureaus 
> wrote:

>> Now I know if there was a method I wanted to reference I could do
>> something like this in module2. from module1 import method1
>>
>> which would mean from that point on I could just reference it as
>> method1 rather than module1.method1, is there such a way I could do
>> this with definitions??
> 
> You can! Any name will work, functions aren't special.
> 
> from module1 import method1, A, B, C, D, E

Better practice is to use:

import module1
print module1.A
print module2.B

and so forth since that makes it far more clear what you are doing and 
where they come from. But it's not compulsory.



> If you want all of them at once, you may want:
> 
> from module1 import *
> 
> but this can make your code confusing.

Shame on you Chris :-) Don't teach newbies to set their head on fire 
before teaching them where the fire extinguisher is.

Azureaus, don't use the form "from module import *" unless you really 
need to, and as a beginner, you almost never really need to.

(And as an expert, you will really need to even less!)


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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread feedthetroll
Am Donnerstag, 5. September 2013 17:59:42 UTC+2 schrieb Ferrous Cranus:
> ok i will ask to sendmail list
Take a look at: 

> but tell me please mailx and senmail are 2 differnt MTAs or mailx makes 
> use of sendmail MTA?
mailx is a MUA (Mail User Agent) used to read and write mails.
For sending mails it uses the MTA.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 12:36:57 +0300, Ferrous Cranus wrote:

> [email protected] [~]# cat /tmp/err.out sendmail =>  13-09-05 12:20:53
> (, TypeError("sendmail() missing 2 required
> positional arguments: 'to_addrs' and 'msg'",),  0x7f3fb4f44488>) [email protected] [~]#
> 
> but all of the needed args are within MESSAGE. Cant it take it from
> there?

Obviously not. If it could, it would.



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


Re: How to exit a cgi file after a download

2013-09-05 Thread inq1ltd


There is no such thing as a "cgi form" or "cgi window". Your cgi script runs 
when the user requests a Web page, generates a page, and then ends. At that 
point, python has stopped running. If your want the client's browser window to 
close, that's not a python problem. If you want to invalidate the download link 
after one successful download, you'll have to add a unique identifier to the 
url and keep track of which identifiers are still valid.




Thanks for responding,

Technically cgi is a script.  But a form is what a cgi script file can create.

The form I asked about is html, it was generated by a cgi script file. So I 
should have written; a cgi script file generated html form, or a cgi script 
file generated html window. Lazy writing.
My mistake.

However I asked a question which now is mute. Once the user downloads the data 
the user can copy it, so why limit the download?.  

I appreciate the response,

jd
inqvista.com






 








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


Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread Terry Reedy

On 9/5/2013 12:37 PM, [email protected] wrote:

I am going through the tutorials on docs.python.org, and I came across this 
excerpt from http://docs.python.org/3/tutorial/controlflow.html:

"The execution of a function introduces a new symbol table used for the local 
variables of the function. More precisely, all variable assignments in a function 
store the value in the local symbol table; whereas variable references first look in 
the local symbol table, then in the local symbol tables of enclosing functions, then 
in the global symbol table, and finally in the table of built-in names. Thus, global 
variables cannot be directly assigned a value within a function (unless named in a 
global statement), although they may be referenced.

"The actual parameters (arguments) to a function call are introduced in the 
local
symbol table of the called function when it is called; thus, arguments are 
passed
using call by value (where the value is always an object reference, not the 
value
of the object). [1] When a function calls another function, a new local symbol
table is created for that call."

Even as a professional programmer, I'm not really able to follow this.  It 
seems self-contradictory, amgiguous, and incomplete.  The problem with looking 
for this information elsewhere is that it's not going to be all in one spot 
like this half the time, and it's not going to be readily searchable on Google 
without more knowledge of what it's referring to.  However this looks like 
something that's too important to overlook.


The only incompleteness is that 'global statememt' should be 'global or 
nonlocal statement'.



I can tell it's referring to things like scope, pass-by-value, references, 
probably the call stack, etc., but it is written extremely poorly.  Translation 
please?  Thanks!


Without knowing your personal language, translating into a language you 
would understand is an impossible task. I would replace 'variable' with 
'name', 'symbol table' with 'nmespace', 'call by object reference value' 
with 'call by object', and 'global' with 'modular'. Maybe that helps 
you, maybe it confuses you more.


The importance thing you must understand is that Python is an 
object-based language and that calling a function (like assignment 
statement in general) does not copy the argument objects.


I suggest that you study the behavior of actual examples both in the 
tutorial and ones you make up. If you are actually baffled by some 
behavior, ask a spedific question.


PS. Try not to double post.

--
Terry Jan Reedy

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


Re: Could someone please paraphrase this statement about variables and functions in Python?

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 09:37:57 -0700, jsrig88 wrote:

> I am going through the tutorials on docs.python.org, and I came across
> this excerpt from http://docs.python.org/3/tutorial/controlflow.html:
> 
> "The execution of a function introduces a new symbol table used for the
> local variables of the function. More precisely, all variable
> assignments in a function store the value in the local symbol table;
> whereas variable references first look in the local symbol table, then
> in the local symbol tables of enclosing functions, then in the global
> symbol table, and finally in the table of built-in names. Thus, global
> variables cannot be directly assigned a value within a function (unless
> named in a global statement), although they may be referenced.

The above sounds like it was written by an assembly language programmer, 
rather than a Python coder.

Anyway, here's a translation:

When you call a function, the function creates an internal table of 
variable names. (Each name is a symbol. Hence a table of names is a 
symbol table.) Assignments inside the function (e.g. "x = 1") creates an 
entry in that function's table of variable names.

On the other hand, merely referring to a variable name *without* 
assigning to it (e.g. "print x", or "x.attribute") searches for that 
variable by checking the local table of local variables, then the local 
variables of any enclosing functions, then the global variables, and 
finally the built-ins.

The consequence of this is that all assignments like:

x = 1

automatically force "x" to be a local variable. To make "x" a global 
variable, and hence assign to the global table of variables instead of 
the local table, you need to declare it as a global first using "global 
x" somewhere in the body of the function (conventionally at the top of 
the function, although anywhere will do).


> "The actual parameters (arguments) to a function call are introduced in
> the local symbol table of the called function when it is called; thus,
> arguments are passed using call by value (where the value is always an
> object reference, not the value of the object).

Every time somebody uses "call by value" in that way, God kills a kitten.

Translation:

Arguments to the function are treated as local variables. Arguments are 
not passed using call by value, although Java programmers will describe 
it that way. Nor are they passed as call by reference, although Ruby 
programmers will describe it that way. Both are guilty of misusing a 
simple term in a very unhelpful way, since call by value and call by 
reference have long standing meanings that are nothing like what Python 
(or Java, or Ruby) do.

See here for further explanation:

http://mail.python.org/pipermail/tutor/2010-December/080505.html

The site appears to be down at the moment, but you can try the google 
cache instead:


http://webcache.googleusercontent.com/search?q=cache:tuQDYATR8HAJ:http://mail.python.org/pipermail/tutor/2010-December/080505.html



> [1] When a function
> calls another function, a new local symbol table is created for that
> call."

Every call to a function has its own independent set of local variables.


> Even as a professional programmer, I'm not really able to follow this. 
> It seems self-contradictory, amgiguous, and incomplete.

It's not really any of those things. I'd call it pretentious, 
unnecessarily jargon-filled for a tutorial, and (in the case of the call-
by-value comment) not just unhelpful but actively harmful.



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


Re: Importing Definitions

2013-09-05 Thread Skip Montanaro
>> You can! Any name will work, functions aren't special.
>>
>> from module1 import method1, A, B, C, D, E
>
> Better practice is to use:
>
> import module1
> print module1.A
> print module2.B
>
> and so forth since that makes it far more clear what you are doing and
> where they come from. But it's not compulsory.

Maybe I'm imagining things, but I think it's pretty common to see some
big-ass modules imported using "from module import *".  While people
may think that's expedient, I think it can often be the source of
subtle bugs.

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


Bundle pip with Python for Windows users

2013-09-05 Thread Andrew Pennebaker
In the future, could Python for Windows come with pip? It would simplify 
package installation for users and developers, often a quite involved and 
tricky process.

http://www.pip-installer.org/en/latest/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 18:59:42 +0300, Ferrous Cranus wrote:

> but tell me please mailx and senmail are 2 differnt MTAs or mailx makes
> use of sendmail MTA?

Nikos, I know you can write English better than that. Are you 
deliberately trying to look less intelligent?


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


Multiprocessing / threading confusion

2013-09-05 Thread Paul Pittlerson
I'm trying to understand data handling using multiprocessing and threading, 
haven't gotten very far without running into problems. This is my code:

#!/usr/bin/python

from multiprocessing import Process
from multiprocessing import Queue
from multiprocessing import current_process

from threading import Thread

import time

def gogo(qu):
w = Worker(qu)
w.start()

class Worker(Thread):
def __init__(self, Que):
super (Worker, self).__init__()

self._pid = current_process().pid  

self.que = Que
self.que.put('started worker %s' % self._pid)

def run(self):
self.que.put('%s ticked' % self._pid)

def __del__(self):
self.que.put('%s has exited' % self._pid)

class Debugger(Thread):
def __init__(self, q):
super(Debugger, self).__init__()

self.q = q

def run(self):
while True:
time.sleep(1)

if not self.q.empty():
print self.q.get()

else: break;

if __name__ == '__main__':

debug_q = Queue()

debug = Debugger(debug_q)
debug.start()

for i in range(5):
d = Process(target=gogo, args=(debug_q,))
d.start()

What I expect to happen is the Debugger object will receive one string at a 
time, and read it from the queue. But that's not what I see the the output, the 
"started worker" stuff seems to print for every process, but "ticked" and 
"exited" will show up in unpredictable ways, I'm guessing they overwrite each 
other and therefore will not always appear in the output.

So I'm looking for help in trying to make sense of this kind of stuff, I 
thought this was the basic functionality that Queue() would take care of unless 
there is some other problem in my code.
-- 
https://mail.python.org/mailman/listinfo/python-list


Newbie question related to Boolean in Python

2013-09-05 Thread skwyang93
1.  bear_moved = False
2. 
3.  while True:
4.next = raw_input("> ")
5.
6.if next == "take honey":
7.dead("The bear looks at you then slaps your face off.")
8.elif next == "taunt bear" and not bear_moved:
9.print "The bear has moved from the door. You can go through."
10. 
11.bear_moved = True
12.  elif next == "taunt bear" and bear_moved:
13.  dead("The bear gets pissed off and chews your leg off.")
14.  elif next == "open door" and bear_moved:
15. gold_room()
16.  else:
17.  print "I got no idea what that means.

# This is just to show my understanding of Boolean. In line 8-9, if my input is 
"taunt bear", the result is true and true, which will continue the loop.

# So what confused me is line 12-13. if my input is taunt bear, is it suppose 
to be taunt bear == "taunt bear" and bear_moved which is true and true? which 
means the loop will continue instead of cancelling it.

Thanks in advance for spending your time to answer my question. 
Source: Learnpythonthehardway
-- 
https://mail.python.org/mailman/listinfo/python-list


THE POPULATION OF MUSLIMS

2013-09-05 Thread bv4bv4bv4
THE POPULATION OF MUSLIMS

 

Islam today is a global religion.  It is no longer confined to Muslim majority 
countries such as Egypt, Saudi Arabia or Indonesia.  Small but significant 
communities exist across Europe, the Americas and Australasia.  For some time 
Muslims have been an invisible presence in the western world but one decade 
into the 21st century Muslims are no longer curiosities.  They are as much at 
home in London Paris or Chicago as they are in Istanbul, Damascus and Jakarta. 

In 2011 Muslims in the West also no longer exist in immigrant communities but 
are second, third and fourth generation citizens participating in professional 
and civic life.  Islam is said to be the fastest growing religion in the United 
States.  It is estimated that more than 1 million Americans have converted to 
Islam.  In recent years due to an Islamic revival, believing and practicing 
Muslims have established a visible presence not only in Islamic societies but 
also in the West. 

What do the latest data and statistics tell us about the number of Muslims in 
the world.  Where do they live? How many are born into the Muslim faith and how 
many choose to convert to Islam? The majority of the following statistics and 
data come from the Pew Research Centre.

According to the Pew[1]  Islam is growing about 2.9% per year.  This is faster 
than the total world population which increases about 2.3% annually.  The 
world’s Muslim population is expected to increase by about 35% in the next 20 
years.  In mid 2010 the Pew forum estimated that there were 1.57 billion 
Muslims in the world.  This represents 22% of the world’s population.  Islam is 
the second largest religion in the world, beaten only by Christianity which 
represents 33% of the world’s population with a little over 2 billion 
adherents. 

The Pew Forum on Religion & Public Life stated that Islam is the 
fastest-growing religion in Europe.  Driven by immigration and high birth 
rates, the number of Muslims on the continent has tripled in the last 30 years. 
 Most demographers forecast a similar or even higher rate of growth in the 
coming decades. 

If current trends continue 79 countries will have a million or more Muslim 
inhabitants in 2030, up from 72 countries in 2011.  The seven new countries are 
expected to be Belgium, Canada, Congo, Djibouti, Guinea Bissau, Netherlands and 
Togo.  About 60% of the world’s Muslims will continue to live in the 
Asia-Pacific region, while about 20% will live in the Middle East and North 
Africa, as is the case in 2010.  One of the biggest changes expected is that 
Pakistan will almost certainly surpass Indonesia as the country with the single 
largest Muslim population. [2]

In 2011 statistics tell us that 74.1% of the world’s Muslims live in the 49 
countries in which Muslims make up a majority of the population.  More than a 
fifth of all Muslims (23.3%) live in non-Muslim-majority countries in the 
developing world.  These minority Muslim populations are often quite large.  
India, for example, has the third-largest population of Muslims worldwide.  
China has more Muslims than Syria, while Russia is home to more Muslims than 
Jordan and Libya combined. [3]  About 3% of the world’s Muslims live in 
more-developed regions, such as Europe, North America, Australia, New Zealand 
and Japan. [4]

In the United States, the population projections show the number of Muslims 
more than doubling over the next two decades, rising from 2.6 million in 2010 
to 6.2 million in 2030.  The number of Muslims in Canada is expected to nearly 
triple in the next 20 years, from about 940,000 in 2010 to nearly 2.7 million 
in 2030.  Muslims are expected to make up 6.6% of Canada’s total population in 
2030, up from 2.8% today.  Argentina is expected to have the third-largest 
Muslim population in the Americas, after the U.S.  and Canada.  Argentina, with 
about 1 million Muslims in 2010, is now in second place, behind the U.S.

 In Europe as a whole, the Muslim share of the population is expected to grow 
by nearly one-third over the next 20 years, rising from 6% of the region’s 
inhabitants in 2010 to 8% in 2030.  In absolute numbers, Europe’s Muslim 
population is projected to grow from 44.1 million in 2010 to 58.2 million in 
2030.  Nearly three-in-ten people living in the Asia-Pacific region in 2030 
(27.3%) will be Muslim, up from about a quarter in 2010 (24.8%) and roughly a 
fifth in 1990 (21.6%).  Muslims make up only about 2% of the population in 
China, but because the country is so populous, its Muslim population is 
expected to be the 19th largest in the world in 2030.

The growth rates of religions are usually due to conversions, higher birth and 
fertility rates and in many countries religions grow because of immigration.  
While the global Muslim population is expected to grow at a faster rate than 
the non-Muslim population, the Muslim population nevertheless is expected to 
grow at a slower pace in the next two de

Re: Moving to Python for web

2013-09-05 Thread Wayne Werner


On Thu, 29 Aug 2013, Andreas Ecaz wrote:


I've decided to go with Flask! It's now running on UWSGI with NGINX. Hopefully 
I can get some stuff done :)


@Chris “Kwpolska” Warrick

I just don't like the big frameworks, for me there is too much magic going on.


I'm a huge fan of Flask - I also find that when you start to learn more 
and more about Flask you can see how Django would be super useful, if you 
need all the bells and whistles.


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


Re: Bundle pip with Python for Windows users

2013-09-05 Thread Terry Reedy

On 9/5/2013 2:19 PM, Andrew Pennebaker wrote:

In the future, could Python for Windows come with pip? It would simplify 
package installation for users and developers, often a quite involved and 
tricky process.


http://python.org/dev/peps/pep-0453/
"Explicit bootstrapping of pip in Python installations"

The proposal is to use a version of pip to install the latest version of 
pip with future releases of all versions, with all PSF distributions.

.

--
Terry Jan Reedy

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


Re: Newbie question related to Boolean in Python

2013-09-05 Thread Neil Cerutti
On 2013-09-05, [email protected]  wrote:
> 1.  bear_moved = False
> 2. 
> 3.  while True:
> 4.next = raw_input("> ")
> 5.
> 6.if next == "take honey":
> 7.dead("The bear looks at you then slaps your face off.")
> 8.elif next == "taunt bear" and not bear_moved:
> 9.print "The bear has moved from the door. You can go through."
> 10.   
> 11.bear_moved = True
> 12.elif next == "taunt bear" and bear_moved:
> 13.dead("The bear gets pissed off and chews your leg off.")
> 14.elif next == "open door" and bear_moved:
> 15.   gold_room()
> 16.else:
> 17.print "I got no idea what that means.
>
> # This is just to show my understanding of Boolean. In line 8-9, if my input 
> is "taunt bear", the result is true and true, which will continue the loop.
>
> # So what confused me is line 12-13. if my input is taunt bear, is it suppose 
> to be taunt bear == "taunt bear" and bear_moved which is true and true? which 
> means the loop will continue instead of cancelling it.
>
> Thanks in advance for spending your time to answer my question. 

Your logic looks OK, but the indentation on your code is screwy.
It should not compile like that. There may be indentation errors,
but I don't want to make assumptions when the indentation is
definitely not what your real code says. Can you cut and paste
your code directly instead of retyping it?


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


Re: Newbie question related to Boolean in Python

2013-09-05 Thread Dave Angel
On 5/9/2013 16:08, [email protected] wrote:

> 1.  bear_moved = False
> 2. 
> 3.  while True:
> 4.next = raw_input("> ")
> 5.
> 6.if next == "take honey":
> 7.dead("The bear looks at you then slaps your face off.")
> 8.elif next == "taunt bear" and not bear_moved:
> 9.print "The bear has moved from the door. You can go through."
> 10.   
> 11.bear_moved = True
> 12.elif next == "taunt bear" and bear_moved:
> 13.dead("The bear gets pissed off and chews your leg off.")
> 14.elif next == "open door" and bear_moved:
> 15.   gold_room()
> 16.else:
> 17.print "I got no idea what that means.
>

Please indent by 4, not 2 characters.  It's very hard to see what's
lined up with what.  And that's compounded by having the line numbers
there so that the first 9 lines are shifted left.

> # This is just to show my understanding of Boolean. In line 8-9, if my input 
> is "taunt bear", the result is true and true, which will continue the loop.

Those lines have compound if conditions.  Line 8 will be true/true
only the first time you type "taunt bear".  Notice the operator "not" in
front of bear_moved.

>
> # So what confused me is line 12-13. if my input is taunt bear, is it suppose 
> to be taunt bear == "taunt bear" and bear_moved which is true and true? which 
> means the loop will continue instead of cancelling it.

Line 12 will be true/true only if you've already run line 11.  Since
bear_moved = False initially, the only way you get true /true here is by
answering "taunt bear" twice.

>
> Thanks in advance for spending your time to answer my question. 
> Source: Learnpythonthehardway

-- 
DaveA


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


Re: PEP8 79 char max

2013-09-05 Thread Metallicow
Well as for my opinion, it is more closer to the truth than others because...
Experience:
1. I know Python and have read the PEP8.
2. I have knowledge of/worked with the Printing Trades.
3. Grandfather owned/operated own Printshop for 40+yrs. Which I also worked in 
at one point.

If you are still using equipment that requires 79, then chances are you 
have/will already gone out of business or are keeping/using said equipment for 
nostalgic purposes.

As far as math goes. 10 is a nice round number. So multiples of 10 are prefer. 
80 being my personal choice for editing.

Zen says: Simple is better than complex.
Use a round number. Integer math is easier than float math for the majority of 
the population.
Time yourself, not the interpreter with these three questions:
In the face of ambiguity, refuse the temptation to guess. If it helps get out 
the old school pen and paper.
Question1: 80/8
Question2: 79/8
Question3: How many chars does you calculator(real or virtual) support?


Zen says: Special cases aren't special enough to break the rules.
PEP8 isn't a rule. Rules are defined by the equipment/device developers.

Ask yourself... How often do you actually use these 79char devices?
Of course it is understandable for something small that can fit in your pocket 
might have less. For Example a smartphone.

Zen says:
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.

PEP8 would have been better to define various numbers for realworld types of 
equipment/devices based on average general type of equipment/device specs.

Closing Zen:
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.

Yep, that's my nuts and bolts on the issue.
Walk into you local Printshop and ask them about this stuff. Then on your way 
out the door, ask for a business card and see how many chars are on that also. 
Beware: You might actually learn something about advertising while you are 
there also.
:) 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing / threading confusion

2013-09-05 Thread [email protected]


On Thu, Sep 5, 2013, at 03:27 PM, Paul Pittlerson wrote:
> I'm trying to understand data handling using multiprocessing and
> threading, haven't gotten very far without running into problems. This is
> my code:

[snip (not sure why you are using multiprocessing and threading at the
same time]


> What I expect to happen is the Debugger object will receive one string at
> a time, and read it from the queue. But that's not what I see the the
> output, the "started worker" stuff seems to print for every process, but
> "ticked" and "exited" will show up in unpredictable ways, I'm guessing
> they overwrite each other and therefore will not always appear in the
> output.
> 
> So I'm looking for help in trying to make sense of this kind of stuff, I
> thought this was the basic functionality that Queue() would take care of
> unless there is some other problem in my code.

My output is probably totally different than your output.  I only get
the processes starting.  Here's why:  This stuff all runs
asynchronously.  When you start the "Debugger" thread.. I see you put a
sleep() in it, but that guarantees nothing.  At least on my machine
which is somewhat loaded ATM, by the time the Processes are started, the
Debugger thread has already finished (because of the check to see if the
queue was empty).  Apparently it is took longer than 1 second from the
time the Debugger was started and the first Process was started.
Likewise, what you are getting is probably a case where the queue is
momentarily empty by the time the debugger loop gets ahold of the queue
lock and checks to see if it's empty.  Therefore the Debugger quits. 
Also because of the asynchronicity of processes, threads, you can not
guarantee the order that the processes will get the opportunity to put()
into the queue. 

Also you can't (and shouldn't) depend on the time that __del__ gets
called.  It can get called at any time, in any order and sometimes not
at all.*

Hope this helps.

*
http://docs.python.org/3/reference/datamodel.html?highlight=__del__#object.__del__
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing / threading confusion

2013-09-05 Thread Chris Angelico
On Fri, Sep 6, 2013 at 5:27 AM, Paul Pittlerson  wrote:
> I'm trying to understand data handling using multiprocessing and threading, 
> haven't gotten very far without running into problems. This is my code:
>
>
> What I expect to happen is the Debugger object will receive one string at a 
> time, and read it from the queue. But that's not what I see the the output, 
> the "started worker" stuff seems to print for every process, but "ticked" and 
> "exited" will show up in unpredictable ways, I'm guessing they overwrite each 
> other and therefore will not always appear in the output.
>
> So I'm looking for help in trying to make sense of this kind of stuff, I 
> thought this was the basic functionality that Queue() would take care of 
> unless there is some other problem in my code.

The first thing I notice is that your Debugger will quit as soon as
its one-secondly poll results in no data. This may or may not be a
problem for your code, but I'd classify it as code smell at best. Is
your goal here to make sure Debugger doesn't stop your process from
exiting? If so, a simpler and safer solution is to make it a daemon
thread.

The other thing I see here is your use of __del__ to print your exit
message. I don't know if Thread objects are involved in reference
loops, but if they are, __del__ (probably) won't be called immediately
on thread termination.

Your subprocesses are a little odd; they spin off another thread, then
halt the first thread. Why not simply do the work in the first thread?
You then treat the thread's __del__ method as the process's death,
which isn't strictly true, but probably close enough.

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


Re: Multiprocessing / threading confusion

2013-09-05 Thread Paul Pittlerson
On Friday, September 6, 2013 1:28:39 AM UTC+3, [email protected] wrote:

> Also you can't (and shouldn't) depend on the time that __del__ gets
> called.  It can get called at any time, in any order and sometimes not
> at all.*

Wow I did not know that! I was counting on that it reliably gets called when 
the object is destroyed.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie question related to Boolean in Python

2013-09-05 Thread Thomas Yang
 bear_moved = False

while True:
next = raw_input("> ")

if next == "take honey":
dead("The bear looks at you then slaps your face off.")
elif next == "taunt bear" and not bear_moved:
print "The bear has moved from the door. You can go through."
bear_moved = True
elif next == "taunt bear" and bear_moved:
dead("The bear gets pissed off and chews your leg off.")
elif next == "open door" and bear_moved:
gold_room()
else:
 print "I got no idea what that means."

# sorry if it looks confusing, this is the real code
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing / threading confusion

2013-09-05 Thread Paul Pittlerson
On Friday, September 6, 2013 1:46:40 AM UTC+3, Chris Angelico wrote:

> The first thing I notice is that your Debugger will quit as soon as
> its one-secondly poll results in no data. This may or may not be a
> problem for your code, but I'd classify it as code smell at best. Is
> your goal here to make sure Debugger doesn't stop your process from
> exiting? If so, a simpler and safer solution is to make it a daemon
> thread.

I didn't think it would be a problem, because unless the system is very
slow, the functions will finish in a fraction of a second, on my machine
it does not matter whether I have it set as 0.1 second or several seconds,
the output is still the same. It's not eloquent, but the point was just to
exit the test when no more prints are to be made.

But how can I fix the actual bug I was asking about though? I want to 
print ticked and exited for all the processes, just to acknowledge to
myself that the code is working.. so I can proceed to experiment with
more complexity! :D
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 79 char max

2013-09-05 Thread Terry Reedy

On 9/5/2013 6:21 PM, Metallicow wrote:


If you are still using equipment that requires 79, then chances are you 
have/will already gone out of business or are keeping/using said equipment for 
nostalgic purposes.

As far as math goes. 10 is a nice round number.


79 chars + 1 cursor (or \n) == 80, the nice round number.

Anyway, it is just a guideline. Ignore it if you wish.

--
Terry Jan Reedy

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


Re: NameError: global name '' is not defined , but a bit differences

2013-09-05 Thread Mohsen Pahlevanzadeh
On Wed, 2013-09-04 at 22:38 -0700, Benjamin Kaplan wrote:
> On Wed, Sep 4, 2013 at 9:17 PM, Mohsen Pahlevanzadeh
>  wrote:
> > Dear all ,
> >
> > i get the error :
> >
> > NameError: global name 'ui' is not defined
> >
> > Complete question is at :
> > http://stackoverflow.com/questions/18627608/nameerror-global-name-is-not-defined-but-differences
> >
> > Before answering, Thank you for your attention...!
> >
> >
> > Yours,
> > Mohsen
> >
> >
> 
> Please don't just post a link to Stack Overflow for your questions. It
> means that if Stack Overflow ever shuts down, this question is useless
> to anyone else looking at this post and also adds an extra step to
> anyone on this list wanting to answer your question- we're helping you
> in our spare time because we want to help people with these things.
> Please don't make us do extra work to help you.
> 
> Just a note- doing a "from module import *" is considered poor coding
> style because it makes it difficult to figure out where all the names
> are coming from, especially if you start doing multiple import *s in a
> single code file. Either explicitly import the names you need ("from
> ui.interface.interface import InterfaceCodes") or import the module
> without adding the names to the local namespace ("import
> ui.interface.interface")
Sorry for my behaviour But dear Benjamin, i want to start a
disscussion about migrating to C++ to python , Specially in OOD/P , and
i want to start at stackoverflow and let post to python ML about 1
mounth later.
(NOT Question)

--mohsen

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


Re: Newbie question related to Boolean in Python

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 16:36:55 -0700, Thomas Yang wrote:

> bear_moved = False
> 
> while True:
> next = raw_input("> ")
> 
> if next == "take honey":
> dead("The bear looks at you then slaps your face off.")
> elif next == "taunt bear" and not bear_moved:
> print "The bear has moved from the door. You can go
> through."
>   bear_moved = True
>   elif next == "taunt bear" and bear_moved:
>   dead("The bear gets pissed off and chews your leg off.")
>   elif next == "open door" and bear_moved:
>   gold_room()
>   else:
>print "I got no idea what that means."
> 
> # sorry if it looks confusing, this is the real code

No it isn't, because it gives an indent error. The first line is 
unindented, the second line is indented. One of those must be wrong.

py> bear_moved = False
py> while True:
  File "", line 1
while True:
^
IndentationError: unexpected indent


Please be careful of indentation. Python's indentation rules are great 
for code, but not so great for copying and pasting into emails and 
websites. So beware, and take extra care with indentation.

Copied from your previous message, your question was:

> # So what confused me is line 12-13. if my input is taunt bear, is it
> suppose to be taunt bear == "taunt bear" and bear_moved which is true
> and true? which means the loop will continue instead of cancelling it.

The relevant two lines are:

>   elif next == "taunt bear" and bear_moved:
>   dead("The bear gets pissed off and chews your leg off.")


I don't understand your question. Nothing cancels the loop anywhere. 
Presumably the loop repeats forever, unless the function dead() contains 
a sys.exit or similar.

The first time around the loop, the bear has not moved, and presumably is 
blocking the door. So the variable `bear_moved` is false. If the user's 
command is "taunt bear" (the poorly named variable `next`) then the first 
time around the loop this if statement will trigger:

if next == "taunt bear" and not bear_moved:

a message will print stating that the bear moves away from the door, and 
`bear_moved` will be set to True. At that point, the *entire* 
if...elif...else block is finished, execution will jump to the end of the 
loop, and the next loop will begin.

The second time through the loop, the user is prompted for a command 
again. If the user enters "taunt bear" a second time, then 

if next == "taunt bear" and bear_moved:

is triggered, since this time `bear_moved` is True, and the bear eats the 
character.


Does this answer your question?



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


Re: PEP8 79 char max

2013-09-05 Thread Metallicow
On Thursday, September 5, 2013 8:47:01 PM UTC-5, Terry Reedy wrote:
> On 9/5/2013 6:21 PM, Metallicow wrote:
> 
> >
> 
> > If you are still using equipment that requires 79, then chances are you 
> > have/will already gone out of business or are keeping/using said equipment 
> > for nostalgic purposes.
> 
> >
> 
> > As far as math goes. 10 is a nice round number.
> 
> 
> 
> 79 chars + 1 cursor (or \n) == 80, the nice round number.
> 
> 
> 
> Anyway, it is just a guideline. Ignore it if you wish.
> 
> 
> 
> -- 
> 
> Terry Jan Reedy

Well, what I interpret as the PEP8 79 is chars visible minus the '\n' or 
'\r\n'(which would be 2; 81) line enders.
This is not stated in PEP8. PEP8 needs a bit of revision anyway, In my 
opinion... According to real-world standards for equipment/devices.
linking to a table/list of affected devices/minNumbers should be the norm.
or

...

from codingguidelines import PEPStandards

... or something similar(Official PEP Zen Guidelines)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing / threading confusion

2013-09-05 Thread Chris Angelico
On Fri, Sep 6, 2013 at 9:34 AM, Paul Pittlerson  wrote:
> On Friday, September 6, 2013 1:28:39 AM UTC+3, [email protected] wrote:
>
>> Also you can't (and shouldn't) depend on the time that __del__ gets
>> called.  It can get called at any time, in any order and sometimes not
>> at all.*
>
> Wow I did not know that! I was counting on that it reliably gets called when 
> the object is destroyed.

Even that isn't technically reliable, though in CPython, objects will
usually be __del__'d promptly as long as they're not in reference
cycles.  But the main problem here is that the destruction of the
object has nothing to do with the ending of the thread or process; the
object will hang around for as long as the caller might want it.
You'll want to put your "end of process" code at the bottom of run(),
I think, unless there's some other place for it.

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


Re: How to split with "\" character, and licence copyleft mirror of �

2013-09-05 Thread Tim Roberts
[email protected] wrote:
>
>Of course, in 99% of situations where you can use a windows pathname in
>Python, you are free to use it with a forward slash instead of a
>backslash.

This is actually worth repeating, because it's not well known.

ALL Windows APIs handle forward and backward slashes interchangably.  It is
only the command interpreter that requires the backslash.
-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bundle pip with Python for Windows users

2013-09-05 Thread alex23

On 6/09/2013 4:19 AM, Andrew Pennebaker wrote:

In the future, could Python for Windows come with pip?


The ActiveState Windows installers for Python include pip, along with a 
bunch of other niceties and conveniences.


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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread alex23

On 6/09/2013 12:01 AM, Ferrous Cranus wrote:

Any ideas please why this fails to work?

Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.
Missing "nss-config-dir" variable.
. . . message not sent.

is what iam receivign  as error output


You haven't set the configuration value 'nss-config-dir'.

You're welcome.

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


Re: PEP8 79 char max

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 15:21:28 -0700, Metallicow wrote:

> Well as for my opinion, it is more closer to the truth than others
> because... Experience:
> 1. I know Python and have read the PEP8. 2. I have knowledge of/worked
> with the Printing Trades. 3. Grandfather owned/operated own Printshop
> for 40+yrs. Which I also worked in at one point.

Thanks for the comments, and welcome, but I really don't have a clue what 
the relevance of most of them are.


> If you are still using equipment that requires 79, then chances are you
> have/will already gone out of business or are keeping/using said
> equipment for nostalgic purposes.

The point is not that there is *equipment* that requires 79 characters 
per line, but that *reading text* is better with a maximum line length 
closer to 79 characters than (say) 140 characters. I've just randomly 
picked up a magazine (less than 50 characters per line) and two books (60 
and 82 characters per line respectively).

The exact max line length picked is not, in and of itself, critical. PEP 
8 could have picked 60 characters, or 72, or 77, or 82. 79 characters 
(plus newline) happens to be a better choice than (say) 77 or 82 for 
historical reasons: some *old* computer equipment was limited to 79 
characters (plus newline), and consequently some *new* computer software 
expects the same convention to be held.

In a sense, it's a bit like the old urban legend about the width of the 
Space Shuttle booster rockets being determined by the width of ancient 
Roman chariots.

http://www.snopes.com/history/american/gauge.asp

While the precise details are wrong, the general claim is more or less 
true for boring and unremarkable reasons.


> As far as math goes. 10 is a nice round number. So multiples of 10 are
> prefer. 80 being my personal choice for editing.

That gives you 80 visible characters plus newline = 81 characters in 
total. Quick, what's 81/7?

> Zen says: Simple is better than complex. Use a round number. Integer
> math is easier than float math for the majority of the population. Time
> yourself, not the interpreter with these three questions: In the face of
> ambiguity, refuse the temptation to guess. If it helps get out the old
> school pen and paper. Question1: 80/8
> Question2: 79/8

I don't see the point of this. Why divide by 8? What is this supposed to 
demonstrate?

Also, you're tossing around koans from a Zen that are irrelevant. 79 or 
80, both are equally simple. Where is the ambiguity? The reader might be 
forgiven for thinking you're trying to dazzle them and pull the wool over 
their eyes by tossing out references to the Zen that sound good but have 
no relevance to the question being discussed.


> Question3: How many chars does you calculator(real or virtual) support?

Seven. Are you suggesting that we should limit our code to a maximum of 
seven characters per line? If not, I don't see the point of your question.


> Zen says: Special cases aren't special enough to break the rules. PEP8
> isn't a rule. Rules are defined by the equipment/device developers.

PEP 8 certainly is a collection of rules. They are mandatory for new code 
added to the standard library, and optional but recommended for third 
party libraries.


> Ask yourself... How often do you actually use these 79char devices?

My brain is better at reading lines with maximum line length of 79 
characters than 140 characters. How often do I use my brain? At least 
once a day.


[...]
> Zen says:
> Although practicality beats purity.
> Errors should never pass silently.
> Unless explicitly silenced.

And yet, a bird in the hand saves nine, and the early bird bells the cat.


> PEP8 would have been better to define various numbers for realworld
> types of equipment/devices based on average general type of
> equipment/device specs.

No it would not. That would be silly.


> Closing Zen:
> If the implementation is hard to explain, it's a bad idea. If the
> implementation is easy to explain, it may be a good idea.

The implementation is easy to explain: stop typing before you reach 79 
characters, and start a new line of code.


> Yep, that's my nuts and bolts on the issue. Walk into you local
> Printshop and ask them about this stuff. Then on your way out the door,
> ask for a business card and see how many chars are on that also. Beware:
> You might actually learn something about advertising while you are there
> also. :)

I don't need to ask them for a business card, since I have a nice 
collection of them. Most of them have < 40 characters per line. A few 
have < 60 characters on the longest line. None of them come even close to 
79 characters per line.

What's your point? That we should limit ourselves to code that fits on a 
business card?



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


Re: Multiprocessing / threading confusion

2013-09-05 Thread Piet van Oostrum
Paul Pittlerson  writes:

> On Friday, September 6, 2013 1:46:40 AM UTC+3, Chris Angelico wrote:
>
>> The first thing I notice is that your Debugger will quit as soon as
>> its one-secondly poll results in no data. This may or may not be a
>> problem for your code, but I'd classify it as code smell at best. Is
>> your goal here to make sure Debugger doesn't stop your process from
>> exiting? If so, a simpler and safer solution is to make it a daemon
>> thread.
>
> I didn't think it would be a problem, because unless the system is very
> slow, the functions will finish in a fraction of a second, on my machine
> it does not matter whether I have it set as 0.1 second or several seconds,
> the output is still the same. It's not eloquent, but the point was just to
> exit the test when no more prints are to be made.
>
> But how can I fix the actual bug I was asking about though? I want to 
> print ticked and exited for all the processes, just to acknowledge to
> myself that the code is working.. so I can proceed to experiment with
> more complexity! :D

On my system I get the output:

started worker 75501
75501 ticked
75501 has exited
started worker 75505
75505 ticked
75505 has exited
started worker 75504
started worker 75502
started worker 75503
75502 ticked
75502 has exited
75504 ticked
75504 has exited
75503 ticked
75503 has exited

So all the provesses have their 'started' 'ticked' and 'exited' message.
But as others have indicated, because your code is timing dependent,
that is just coincidental. Because multiprocessing/multithreading is
inherently non-deterministic, the order of the messages will be
unpredictable. But you should not make the exiting of the Debugger non
deterministic, as you have it now. One way to do this is to count the
number of processes that have exited, and wait until all are done. In
this case you could count the number of 'exited' messages that have
arrived.

def run(self):
nbr_process = 5
while True:
time.sleep(1)

msg = self.q.get()
print msg
if 'exited' in msg:
nbr_process -= 1
if nbr_process == 0:
break
 
Of course the 5 should be given as a parameter.

This still leaves you with the uncertainty of the __del__ being called.
Why not just put the message at the end of the Worker run code?

def run(self):
self.que.put('%s ticked' % self._pid)
# do some work
time.sleep(1)
self.que.put('%s has exited' % self._pid)

However, in my experiments (bot Python 2.7.5 and 3.3.2 on Mac OS X
10.6.8) it seems that there is a problem with a Thread inside a Process:
When the main thread of the Process is finished, the other Thread is
also terminated, as if it is a daemon thread. Although self.daemon ==
False!!

You can check this with the following Worker code:

def run(self):
for n in range(5):
self.que.put('%s tick %d' % (self._pid, n))
# do some work
time.sleep(1)
self.que.put('%s has exited' % self._pid)

It appears that not all ticks are deliverd. In my system, only one tick
per thread, and then it disappears. I have no idea if this is a bug. I
certainly couldn't find it documented.

The solution to this is to put a join statement in gogo:

def gogo(qu):
w = Worker(qu)
w.start()
w.join()

-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 79 char max

2013-09-05 Thread Steven D'Aprano
On Thu, 05 Sep 2013 19:59:34 -0700, Metallicow wrote:

> PEP8 needs a bit of revision anyway, In my opinion... According to
> real-world standards for equipment/devices. linking to a table/list of
> affected devices/minNumbers should be the norm. or

I don't believe you have thought this through, or in any detail. The 
first problem is, what "real-world standards" are you talking about? What 
sort of devices are you referring to? How is this supposed to work in 
practice? If I write a Python module, which device am I supposed to pick?

It's a particularly ill-thought-out suggestion when you consider than PEP 
8 is for the Python standard library, and any document in the std lib 
will be read on a vast number of different devices, using different 
monitors with different screen resolutions and different widths, in 
different editors using different typefaces on different operating 
systems by people of different visual acuity.

The point of a coding standard for maximum line width is to average out 
all those myriad differences and give something which works pretty well 
overall regardless of the device. In other words, the coding standard 
defines a minimum capability (in this case, "you can display at least 79 
characters per line") and recommends you write to that standard.


> from codingguidelines import PEPStandards
> 
> ... or something similar(Official PEP Zen Guidelines)

And that's especially badly thought out. How is an import that occurs 
when the code is *run* supposed to make a difference to the way the code 
is *written*?


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


Re: Newbie question related to Boolean in Python

2013-09-05 Thread Tim Roberts
[email protected] wrote:
>
># This is just to show my understanding of Boolean. In line 8-9, if 
>my input is "taunt bear", the result is true and true, which will 
>continue the loop.
>
> So what confused me is line 12-13. if my input is taunt bear, is it
>suppose to be taunt bear == "taunt bear" and bear_moved which is 
>true and true? which means the loop will continue instead of cancelling it.

I'm not quite sure what you're expecting.  There is nothing in any of the
cases that will exit the loop.  The loop is infinite.  I assume (with no
evidence) that the "dead" function calls sys.exit, which kills the program.
In that case, this makes a little bit of sense.  The first time you type
"taunt bear", bear_moved is set True and the loop runs again.  If you type
"taunt bear" a second time, then the bear is pissed off and you call
dead().
-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP8 79 char max

2013-09-05 Thread Metallicow
On Thursday, September 5, 2013 10:40:46 PM UTC-5, Steven D'Aprano wrote:
> Thanks for the comments, and welcome, but I really don't have a clue what 
> the relevance of most of them are.
Real-world Experience.
> > If you are still using equipment that requires 79, then chances are you
> > have/will already gone out of business or are keeping/using said
> > equipment for nostalgic purposes.
> 
> The point is not that there is *equipment* that requires 79 characters 
> per line, but that *reading text* is better with a maximum line length 
> closer to 79 characters than (say) 140 characters. I've just randomly 
> picked up a magazine (less than 50 characters per line) and two books (60 
> and 82 characters per line respectively).
The argument I am suggesting is 79 vs 80.
> The exact max line length picked is not, in and of itself, critical. PEP 
> 
> 8 could have picked 60 characters, or 72, or 77, or 82. 79 characters 
> (plus newline) happens to be a better choice than (say) 77 or 82 for 
> historical reasons: some *old* computer equipment was limited to 79 
> characters (plus newline), and consequently some *new* computer software 
> expects the same convention to be held.
I propose 80 for Zen: Simplicity.
> In a sense, it's a bit like the old urban legend about the width of the 
> Space Shuttle booster rockets being determined by the width of ancient 
> Roman chariots.
Haha. *Gets a Laugh*
> http://www.snopes.com/history/american/gauge.asp
> 
> While the precise details are wrong, the general claim is more or less 
> true for boring and unremarkable reasons.
Ok.
> > As far as math goes. 10 is a nice round number. So multiples of 10 are
> > prefer. 80 being my personal choice for editing.
> That gives you 80 visible characters plus newline = 81 characters in 
> total. Quick, what's 81/7?
We are focusing on end-users, which might be simple minded. Simple is better 
than complex.
> > Zen says: Simple is better than complex. Use a round number. Integer
> > math is easier than float math for the majority of the population. Time
> > yourself, not the interpreter with these three questions: In the face of
> > ambiguity, refuse the temptation to guess. If it helps get out the old
> > school pen and paper. Question1: 80/8
> > Question2: 79/8
> I don't see the point of this. Why divide by 8? What is this supposed to 
> demonstrate?
Divide by any simple number is 0 simple enouch...?
> Also, you're tossing around koans from a Zen that are irrelevant. 79 or 
> 80, both are equally simple. Where is the ambiguity? The reader might be 
> forgiven for thinking you're trying to dazzle them and pull the wool over 
> their eyes by tossing out references to the Zen that sound good but have 
> no relevance to the question being discussed.
No., 79 and 80 are not equally simple. 79 is odd, and 80 is even.
> 
> > Question3: How many chars does you calculator(real or virtual) support?
> Seven. Are you suggesting that we should limit our code to a maximum of 
Ok. Mine displays ten. This question was to get most people off their duff and 
grab a piece of old-school tech. Might be solar in nature.
> seven characters per line? If not, I don't see the point of your question.
See above answer.
> > Zen says: Special cases aren't special enough to break the rules. PEP8
> > isn't a rule. Rules are defined by the equipment/device developers.
> PEP 8 certainly is a collection of rules. They are mandatory for new code 
> added to the standard library, and optional but recommended for third 
> party libraries.
What are the official rules, then... None...?
> > Ask yourself... How often do you actually use these 79char devices?
> My brain is better at reading lines with maximum line length of 79 
> characters than 140 characters. How often do I use my brain? At least 
> once a day.
> [...]
Ok. I prefer 80 remember. Simple. base 10.
> > Zen says:
> > Although practicality beats purity.
> > Errors should never pass silently.
> > Unless explicitly silenced.
> And yet, a bird in the hand saves nine, and the early bird bells the cat.
if python.notDefined():
cats != birds != cats 
> > PEP8 would have been better to define various numbers for realworld
> > types of equipment/devices based on average general type of
> > equipment/device specs.
> No it would not. That would be silly.
Well... Why Not? What do you use?
> > Closing Zen:
> > If the implementation is hard to explain, it's a bad idea. If the
> > implementation is easy to explain, it may be a good idea.
> The implementation is easy to explain: stop typing before you reach 79 
> characters, and start a new line of code.
I believe Guido once worked for google, why doesn't the software reflect your 
preferences. Ask google, or him, not me.
> > Yep, that's my nuts and bolts on the issue. Walk into you local
> > Printshop and ask them about this stuff. Then on your way out the door,
> > ask for a business card and see how many chars are on that also. Beware:
> > You might actually learn somethi

Re: PEP8 79 char max

2013-09-05 Thread Metallicow
On Thursday, September 5, 2013 11:01:31 PM UTC-5, Steven D'Aprano wrote:
> And that's especially badly thought out. How is an import that occurs 
> when the code is *run* supposed to make a difference to the way the code 
> is *written*?

Proofreading.
Or maybe call it pre typesetting.
-- 
https://mail.python.org/mailman/listinfo/python-list


"Python for Delphi' Assistance

2013-09-05 Thread Errol Anderson
The Delphi program I maintain uses 'Python for Delphi' to run Python scripts
within the program.  The latest version of 'Python for Delphi' appears to
stop at Delphi 2006 with Python 2.5, while I would like to run Delphi 2007
with Python 2.7.   Are there any 'Python for Delphi' users out there who
could help me.

 

Best regards

 

Errol Anderson

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


Re: Multiprocessing / threading confusion

2013-09-05 Thread Piet van Oostrum
Piet van Oostrum  writes:


> def run(self):
> for n in range(5):
> self.que.put('%s tick %d' % (self._pid, n))
> # do some work
> time.sleep(1)
> self.que.put('%s has exited' % self._pid)

To prevent the 'exited' message to disappear if there is an exception in
the thread you should protect it with try -- finally:

def run(self):
try:
for n in range(5):
self.que.put('%s tick %d' % (self._pid, n))
# do some work
time.sleep(1)
finally:
self.que.put('%s has exited' % self._pid)

This doesn't help for the premature termination of the thread, as that
isn't an exception. But use the w.join() for that. Or you could put the
'exited' message after the w.join() command.
-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Piet van Oostrum
Nikos, if you can't use the smtp server at mail.superhost.gr, or if that
has the same restrictions I may have a solution for you. This is a bit
off-topic on the Python list/group, s I will throw in a line of Python
code to make it on-topic :)

I suppose you have the following reasons to want to have the original
email address in the message: (1) so that you can see who sent the
message, (2) so that you can reply to the original sender.
Let's say that the from address was [email protected]

Problem 1 can be solved in two ways:
(a) Just put the email address in front of the subject line, like:

Subject: (From [email protected]) Original subject line

(b) This solution is a bit more tricky.
- Get a separate email address that you use for these messages, like
  [email protected]. Register this as one of your email addresses in
  gmail. For this it must be a real email address that belongs to you,
  not a fake address. When it is registered with gmail, gmail will not
  change it if found in a From header. Make sure that Thunderbird DOES
  NOT KNOW that this email address belongs to you (i.e. don't use this
  email address for normal work). Gmail will send you a message to this
  address to verify that it belongs to you so you must access it through
  some other means, like a web interface.

- Now in the generated email you put the original sender in the comment
  and your new email address as the real address like:

  From: "[email protected]" 

Because Thunderbird doesn't know [email protected] it will display the
other one, [email protected]. Make sure that the email address doesn't
contain a quote character. Better still check that only legal characters
are used.

Problem 2 can easily be solved by adding a Reply-To header with the
original from address. Gmail will not change this.

So the code becomes something like:

MESSAGE = "From: \"{0}\" \r\n" "Reply-To: {0}\r\n" "To: 
{1}\r\n" "Subject: (From {0}) {2}\r\n\r\n{3}\r\n".format(FROM, TO, SUBJECT, 
MESSAGE)

In my opinion a better solution would be to filter your mesaage through
procmail or similar on your receiving computer. For example put the from
address in an X-From header and let the filter replace the From header
with the address from the X-From.
-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


OT spam (was Re: THE POPULATION OF MUSLIMS)

2013-09-05 Thread Terry Reedy

On 9/5/2013 3:58 PM, [email protected] wrote:
Religious rant that passed the spam filter and moderation mechanism. I 
am a new moderator and have asked the others if we can block this 
address. Please do not add to the spam posts that do appear by 
commenting on them. We do the best be can with the software we have and 
do discard a couple of posts a day.


--
Terry Jan Reedy

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


Python Debugger tool

2013-09-05 Thread chandan kumar
Hi 

Is any one aware of  free ipython debugger tool.How good is this tool for a 
beginner to use like ,placing breakpoints,checking variables ,call stack 
(function flow) etc.I don't like to use python PDB .
 I have heard about wingware ,pycharm  which are licensed versions.Used 
wingware trail version and felt pretty good tool for beginners.

Please let know your views on ipython.Let me know about any python free 
debugger tools


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


Re: How to split with "\" character, and licence copyleft mirror of �

2013-09-05 Thread Terry Reedy

On 9/5/2013 11:33 PM, Tim Roberts wrote:

[email protected] wrote:


Of course, in 99% of situations where you can use a windows pathname in
Python, you are free to use it with a forward slash instead of a
backslash.


This is actually worth repeating, because it's not well known.

ALL Windows APIs handle forward and backward slashes interchangably.  It is
only the command interpreter that requires the backslash.


and only for the path the the command, when needed, and not for the 
arguments of the command. Example, in a python development directory


> pcbuild\python_d tools/scripts/patchcheck.py

--
Terry Jan Reedy

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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-05 Thread Ferrous Cranus

Στις 6/9/2013 7:48 πμ, ο/η Piet van Oostrum έγραψε:

hotmail.com. Register this as one of your email addresses in
   gmail. For this it must be a real email address that belongs to you,
   not a fake address. When it is registered with gmail, gmail will not
   change it if found in a From header.


Hello Piet,

I'am not sure what you mean by registering a mail address with GMail.
Do you mean to add more that one mail account addresses within my GMail 
account?


If you mean that i must tell you that in the pop settinsg inside my 
gmail.com account i use [email protected] and [email protected] as 
other sending nad retrival mail accounts.


Is this what you mean?



So the code becomes something like:
MESSAGE = "From: \"{0}\" \r\n" "Reply-To: {0}\r\n" "To: {1}\r\n" 
"Subject: (From {0}) {2}\r\n\r\n{3}\r\n".format(FROM, TO, SUBJECT, MESSAGE)


If you mean the above then i just have tried, but still not mail gets send.


MESSAGE = "From: \"{0}\" \r\n" "Reply-To: 
{0}\r\n" "To: {1}\r\n" "Subject: (From {0}) {2}\r\n\r\n{3}\r\n".format( 
FROM, TO, SUBJECT, MESSAGE )

MESSAGE = MESSAGE.encode('utf-8')

# open Gmail's SMTP server
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()
server.starttls()

# next, log in to the server
server.login("[email protected]", "my_password")


Please elaborate further, thank you.

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


Re: Python Debugger tool

2013-09-05 Thread Rafael Durán Castañeda

El 06/09/2013, a las 08:14, chandan kumar  escribió:

> Hi 
> 
> Is any one aware of  free ipython debugger tool.How good is this tool for a 
> beginner to use like ,placing breakpoints,checking variables ,call stack 
> (function flow) etc.I don't like to use python PDB .
> I have heard about wingware ,pycharm  which are licensed versions.Used 
> wingware trail version and felt pretty good tool for beginners.
> 
> Please let know your views on ipython.Let me know about any python free 
> debugger tools
> 
> 
> Best Regards,
> Chandan
> -- 
> https://mail.python.org/mailman/listinfo/python-list
Ipdb works fine for me.

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