Re: Calendar module question

2013-02-17 Thread Andrew Berg
On 2013.02.17 01:47, Phil wrote:
> Why would this code work under the Wing IDE and nowhere else? Could 
> there be a different calendar module included with Wing?
> 
> import calendar
> 
> cal = calendar.prcal(2013)
> print cal
> 
> Traceback (most recent call last):
>File "calendar.py", line 1, in 
>  import calendar
>File "/home/phil/calendar.py", line 3, in 
>  cal = calendar.prcal(2013)
> AttributeError: 'module' object has no attribute 'prcal'
> 

If you look at the traceback, you'll see you have a calendar.py in your
home directory that is being imported instead of the one from the stdlib.
-- 
CPython 3.3.0 | Windows NT 6.2.9200.16496 / FreeBSD 9.1-RELEASE
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calendar module question

2013-02-17 Thread Chris Rebert
On Saturday, February 16, 2013, Phil wrote:

> Thank you for reading this.
>
> My adventures with Python have just begun and during the few weeks I have
> tried many IDEs. The following piece of code fails under all IDEs, and the
> interpreter, except under the Wing IDE.
>
> Why would this code work under the Wing IDE and nowhere else? Could there
> be a different calendar module included with Wing?
>
> import calendar
>
> cal = calendar.prcal(2013)
> print cal
>
> Traceback (most recent call last):
>   File "calendar.py", line 1, in 
> import calendar
>   File "/home/phil/calendar.py", line 3, in 
> cal = calendar.prcal(2013)
> AttributeError: 'module' object has no attribute 'prcal'
>

You named your own script file "calendar.py". As a result, when you
did `import calendar`, due to the way Python 2.x searches for modules, it
imports your file instead of the `calendar` module in the standard library,
thus leading to the above exception. Because of this sort of problem, it
is/was considered bad practice to give a module/package the same name as
any std lib module.

However, if you are running a recent-ish version of Python, adding `from
__future__ import absolute_import` may resolve the problem. See PEP 328 for
details. Absolute imports were thankfully made the default in Python 3.


-- 
Cheers,
Chris
--
http://rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Comparing types

2013-02-17 Thread Steven D'Aprano
Jason Friedman wrote:

> I want to tell whether an object is a regular expression pattern.
> 
> Python 3.2.3 (default, Oct 19 2012, 20:10:41)
> [GCC 4.6.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 import re
 s = "hello"
 type(s)
> 
 isinstance(s, str)
> True
 my_pattern = re.compile(s)
 type(my_pattern)
> 
 isinstance(my_pattern, _sre.SRE_Pattern)
> Traceback (most recent call last):
>   File "", line 1, in 
> NameError: name '_sre' is not defined


Here are two ways to do this. The first is not portable, and is not
guaranteed to work, since the _sre module is private.


# Risky but obvious.
import _sre
isinstance(my_pattern, _sre.SRE_Pattern)


The second is guaranteed to work even if the _sre module disappears, is
renamed, or otherwise changes in any way.


# Safe.
PatternType = type(re.compile("."))
isinstance(my_pattern, PatternType)




-- 
Steven

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


Re: Calendar module question

2013-02-17 Thread Phil

On 17/02/13 18:01, Andrew Berg wrote:

On 2013.02.17 01:47, Phil wrote:

Why would this code work under the Wing IDE and nowhere else? Could
there be a different calendar module included with Wing?

import calendar

cal = calendar.prcal(2013)
print cal

Traceback (most recent call last):
File "calendar.py", line 1, in 
  import calendar
File "/home/phil/calendar.py", line 3, in 
  cal = calendar.prcal(2013)
AttributeError: 'module' object has no attribute 'prcal'



If you look at the traceback, you'll see you have a calendar.py in your
home directory that is being imported instead of the one from the stdlib.



Thank you for your quick response Andrew. Of course, I now have another 
question; how do I use the correct calendar module? The Wing IDE 
apparently uses the correct module.


--
Regards,
Phil
--
http://mail.python.org/mailman/listinfo/python-list


Re: Calendar module question

2013-02-17 Thread James Griffin
- Phil  [2013-02-17 17:47:15 +1000] - :

> Thank you for reading this.
> 
> My adventures with Python have just begun and during the few weeks I
> have tried many IDEs. The following piece of code fails under all
> IDEs, and the interpreter, except under the Wing IDE.
> 
> Why would this code work under the Wing IDE and nowhere else? Could
> there be a different calendar module included with Wing?
> 
> import calendar
> 
> cal = calendar.prcal(2013)
> print cal
> 
> Traceback (most recent call last):
>   File "calendar.py", line 1, in 
> import calendar
>   File "/home/phil/calendar.py", line 3, in 
^^^

There is your problem.

Parsedatetime is a good calendar module. I've been using it recently for
an email related script.


-- 
Primary Key: 4096R/1D31DC38 2011-12-03
Key Fingerprint: A4B9 E875 A18C 6E11 F46D  B788 BEE6 1251 1D31 DC38
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calendar module question

2013-02-17 Thread Phil

On 17/02/13 18:40, James Griffin wrote:

- Phil  [2013-02-17 17:47:15 +1000] - :


Thank you for reading this.

My adventures with Python have just begun and during the few weeks I
have tried many IDEs. The following piece of code fails under all
IDEs, and the interpreter, except under the Wing IDE.

Why would this code work under the Wing IDE and nowhere else? Could
there be a different calendar module included with Wing?

import calendar

cal = calendar.prcal(2013)
print cal

Traceback (most recent call last):
   File "calendar.py", line 1, in 
 import calendar
   File "/home/phil/calendar.py", line 3, in 

 ^^^

There is your problem.

Parsedatetime is a good calendar module. I've been using it recently for
an email related script.



Thanks James - a trap for the uninitiated.

--
Regards,
Phil
--
http://mail.python.org/mailman/listinfo/python-list


Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Claira
Can someone tell me what kinds of questions should be asked in this list
and what kinds in the tutor section?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Comparing types

2013-02-17 Thread Terry Reedy

On 2/17/2013 1:34 AM, Jason Friedman wrote:

I want to tell whether an object is a regular expression pattern.

Python 3.2.3 (default, Oct 19 2012, 20:10:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import re
s = "hello"
type(s)



isinstance(s, str)

True

my_pattern = re.compile(s)
type(my_pattern)




The .__name__ attribute of the class is '_sre.SRE_Pattern'


isinstance(my_pattern, _sre.SRE_Pattern)

Traceback (most recent call last):
   File "", line 1, in 
NameError: name '_sre' is not defined


but the class is not bound to a (builtin) name, including not to 
_sre.SRE_Pattern




--
Terry Jan Reedy

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


Re: Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Tim Golden

On 17/02/2013 00:19, Claira wrote:

Can someone tell me what kinds of questions should be asked in this
list and what kinds in the tutor section?


There's no clear-cut distinction. The rule of thumb I usually
apply is that questions about the *language* (its syntax, its
usage, its idioms etc.) and about the core parts of the standard
library -- the modules which come with Python -- can usefully
be asked on the Tutor list by newcomers. Questions which are
about 3rd-party modules (for example, numpy or requests) or
which about more specialised standard library modules (such
as the Windows-specific modules) are probably better asked
here on python-list or on a module-specific forum for
external modules.

Again, though, there's no hard-and-fast rule: if you're not
sure, ask on the Tutor list and we'll tell you there if
you're better off asking somewhere else. It's quite a
friendly environment :)

TJG
--
http://mail.python.org/mailman/listinfo/python-list


Eric - "No module named MainWindow"

2013-02-17 Thread Phil

Thank you for reading this.

I've been playing with Eric all day and I almost have a working GUI 
application, but not quite. I have followed the two tutorials on the 
Eric site and I'm sure that I haven't miss entered anything and so I 
think the error is the result of something missing from my system or 
perhaps a path error.


This is the error message:

The debugged program raised the exception unhandled ImportError
"No module named MainWindow"
File: /home/phil/main.py, Line: 4

And this is the code:

!/usr/bin/python

from PyQt4.QtGui import QApplication
from ui.MainWindow import MainWindow

def main():
import sys
app = QApplication(sys.argv)
wnd = MainWindow()
wnd.show()
sys.exit(app.exec_())

if __name__ == '__main__':
main()

I have tried mainWindow and mainwindow as well so it appears not to be a 
case error.


--
Regards,
Phil
--
http://mail.python.org/mailman/listinfo/python-list


Re: Eric - "No module named MainWindow"

2013-02-17 Thread Vincent Vande Vyvre
Le 17/02/13 10:08, Phil a écrit :
> Thank you for reading this.
>
> I've been playing with Eric all day and I almost have a working GUI
> application, but not quite. I have followed the two tutorials on the
> Eric site and I'm sure that I haven't miss entered anything and so I
> think the error is the result of something missing from my system or
> perhaps a path error.
>
> This is the error message:
>
> The debugged program raised the exception unhandled ImportError
> "No module named MainWindow"
> File: /home/phil/main.py, Line: 4
>
> And this is the code:
>
> !/usr/bin/python
>
> from PyQt4.QtGui import QApplication
> from ui.MainWindow import MainWindow
>
> def main():
> import sys
> app = QApplication(sys.argv)
> wnd = MainWindow()
> wnd.show()
> sys.exit(app.exec_())
>
> if __name__ == '__main__':
> main()
>
> I have tried mainWindow and mainwindow as well so it appears not to be
> a case error.
>
Are you sure you have a class MainWindow in your ui.MainWindow.py ?

Can you show us the code of this MainWindow ?

-- 
Vincent V.V.
Oqapy  . Qarte
 . PaQager 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Recording live video stream from IP camera issue

2013-02-17 Thread Sam Berry
Hi Xav,

Iv been looking into OpenCV, i can easily stream my laptops webcam using this 
code.

import cv2

cv2.namedWindow("preview")

vc = cv2.VideoCapture(0)

if vc.isOpened(): # try to get the first frame
rval, frame = vc.read()
else:
rval = False

while rval:
cv2.imshow("preview", frame)
rval, frame = vc.read()
key = cv2.waitKey(20)
if key == 27: # exit on ESC
break

However using the cv2.Videocapture(ip_address) method will not load my IP 
camera video feed into the new window. I can view the stream in any web browser 
or VLC using the IP address
http://192.168.1.72:1025/videostream.cgi?user=&pwd=&resolution=8.

Did you have this issue? Is there some lines of code i may need to add?

Any help would be appreciated!

Thanks, Sam
-- 
http://mail.python.org/mailman/listinfo/python-list


ezmlm warning

2013-02-17 Thread g09-help
Bonjour ! Je suis le programme ezmlm. Je m'occupe de la liste
de diffusion g...@09balance.com.


Un certain nombre de messages provenant de la liste de diffusion
<#l> n'ont pas pu vous etre remis correctement. En attachement, vous trouverez
une copie du premier message de retour a l'envoyeur que j'ai recu.

Si le message que vous lisez actuellement ne parvient pas non plus a
destination, un dernier message vous sera envoye. Si celui-ci echoue aussi,
votre adresse sera malheureusement retiree de la liste g09.



J'ai conserve une liste des messages de la liste de diffusion g09 qui
n'ont temporairement pas pu etre delivres a votre adresse.

Voici les numeros des messages en question :

   1

--- Ci-dessous se trouve une copie du message problematique qui m'est revenu :

Return-Path: 
Received: from b0.ovh.net (HELO queue) (213.186.33.50)
by b0.ovh.net with SMTP; 29 Sep 2012 17:42:15 +0200
Received: from mo33.mail-out.ovh.net (178.32.228.33)
  by mx1.ovh.net with SMTP; 29 Sep 2012 17:42:13 +0200
Received: by mo33.mail-out.ovh.net (Postfix)
id B6200FF8189; Sat, 29 Sep 2012 17:51:20 +0200 (CEST)
Date: Sat, 29 Sep 2012 17:51:20 +0200 (CEST)
From: mailer-dae...@mo33.mail-out.ovh.net (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: g09-return-1-python-list=python@09balance.com
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="86865FF80A1.1348933880/mo33.mail-out.ovh.net"
Message-Id: <20120929155120.b6200ff8...@mo33.mail-out.ovh.net>
X-Ovh-Tracer-Id: 1645221239235215619
X-Ovh-Remote: 178.32.228.33 (mo33.mail-out.ovh.net)
X-Ovh-Local: 213.186.33.29 (mx1.ovh.net)
X-OVH-SPAMSTATE: OK
X-OVH-SPAMSCORE: 10
X-OVH-SPAMCAUSE: 
gggruggvucftvghtrhhoucdtuddrfeehtddrleekucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecuufhprghmjfgvrgguvghrhfhivghlugcujfgvrgguvghrucfutghorhhinhhgucdluddtmdenucfhrhhomhepofetkffngfftqdfftefgoffqpfesmhhofeefrdhmrghilhdqohhuthdrohhvhhdrnhgvthculdforghilhcuffgvlhhivhgvrhihucfuhihsthgvmhdmnecuffhomhgrihhnpehovhhhrdhnvghtpdhphihthhhonhdrohhrghenucfjughrpeffhffuvfggtgesphdttdertddtvd
X-Spam-Check: DONE|U 0.5/N

This is a MIME-encapsulated message.

--86865FF80A1.1348933880/mo33.mail-out.ovh.net
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host mo33.mail-out.ovh.net.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

   The mail system

: host mail.python.org[82.94.164.166] said:
553-rejected, message looks like spam. 553 Contact your postmaster/admin
for assistance. Please provide the following information in your problem
report: time (Sep 29 17:41:55) and client (178.32.228.33). (in reply to end
of DATA command)

--86865FF80A1.1348933880/mo33.mail-out.ovh.net
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; mo33.mail-out.ovh.net
X-Postfix-Queue-ID: 86865FF80A1
X-Postfix-Sender: rfc822; g09-return-1-python-list=python@09balance.com
Arrival-Date: Sat, 29 Sep 2012 17:42:24 +0200 (CEST)

Final-Recipient: rfc822; python-list@python.org
Original-Recipient: rfc822;python-list@python.org
Action: failed
Status: 5.0.0
Remote-MTA: dns; mail.python.org
Diagnostic-Code: smtp; 553-rejected, message looks like spam. 553 Contact your
postmaster/admin for assistance. Please provide the following information
in your problem report: time (Sep 29 17:41:55) and client (178.32.228.33).

--86865FF80A1.1348933880/mo33.mail-out.ovh.net
Content-Description: Undelivered Message Headers
Content-Type: text/rfc822-headers

Return-Path: 
Received: from mail611.ha.ovh.net (b3.ovh.net [213.186.33.53])
by mo33.mail-out.ovh.net (Postfix) with SMTP id 86865FF80A1
for ; Sat, 29 Sep 2012 17:42:24 +0200 (CEST)
Received: from b0.ovh.net (HELO queueml) (213.186.33.50)
by b0.ovh.net with SMTP; 29 Sep 2012 17:26:37 +0200
Mailing-List: Pour toute requete administrative, contactez 
g09-h...@09balance.com; Liste geree par ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: 
List-Help: 
List-Unsubscribe: 
List-Subscribe: 
Reply-To: marot.oliv...@hotmail.fr
Delivered-To: mailing list g...@09balance.com
Delivered-To: moderator for g...@09balance.com
Received: from b0.ovh.net (HELO queue) (213.186.33.50)
by b0.ovh.net with SMTP; 29 Sep 2012 17:25:16 +0200
Received: from localhost (HELO mail611.ha.ovh.net) (127.0.0.1)
  by localhost with SMTP; 29 Sep 2012 17:25:16 +0200
Received: from b0.ovh.net (HELO queueout) (213.186.33.50)
by b0.ovh.net with SMTP; 2

Re: Eric - "No module named MainWindow"

2013-02-17 Thread Joel Goldstick
On Sun, Feb 17, 2013 at 6:35 AM, Vincent Vande Vyvre <
vincent.vandevy...@swing.be> wrote:

> Le 17/02/13 10:08, Phil a écrit :
> > Thank you for reading this.
> >
> > I've been playing with Eric all day and I almost have a working GUI
> > application, but not quite. I have followed the two tutorials on the
> > Eric site and I'm sure that I haven't miss entered anything and so I
> > think the error is the result of something missing from my system or
> > perhaps a path error.
> >
> > This is the error message:
> >
> > The debugged program raised the exception unhandled ImportError
> > "No module named MainWindow"
> > File: /home/phil/main.py, Line: 4
> >
> > And this is the code:
> >
> > !/usr/bin/python
> >
> > from PyQt4.QtGui import QApplication
> > from ui.MainWindow import MainWindow
> >
> > def main():
> > import sys
> > app = QApplication(sys.argv)
> > wnd = MainWindow()
> > wnd.show()
> > sys.exit(app.exec_())
> >
> > if __name__ == '__main__':
> > main()
> >
> > I have tried mainWindow and mainwindow as well so it appears not to be
> > a case error.
> >
> Are you sure you have a class MainWindow in your ui.MainWindow.py ?
>

I just looked at the tutorial that you might be experimenting with on this
page: http://eric-ide.python-projects.org/tutorials/MiniBrowser/index.html

The class MainWindow is in mainwindow.py in the ui folder.  I would try
this:

from ui.mainwindow import MainWindow





> --
> Vincent V.V.
> Oqapy  . Qarte
>  . PaQager 
> --
> http://mail.python.org/mailman/listinfo/python-list
>



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


Re: Eric - "No module named MainWindow"

2013-02-17 Thread Vincent Vande Vyvre
Le 17/02/13 16:13, Joel Goldstick a écrit :
>
>
>
> On Sun, Feb 17, 2013 at 6:35 AM, Vincent Vande Vyvre
> mailto:vincent.vandevy...@swing.be>> wrote:
>
> Le 17/02/13 10:08, Phil a écrit :
> > Thank you for reading this.
> >
> > I've been playing with Eric all day and I almost have a working GUI
> > application, but not quite. I have followed the two tutorials on the
> > Eric site and I'm sure that I haven't miss entered anything and so I
> > think the error is the result of something missing from my system or
> > perhaps a path error.
> >
> > This is the error message:
> >
> > The debugged program raised the exception unhandled ImportError
> > "No module named MainWindow"
> > File: /home/phil/main.py, Line: 4
> >
> > And this is the code:
> >
> > !/usr/bin/python
> >
> > from PyQt4.QtGui import QApplication
> > from ui.MainWindow import MainWindow
>

> (strip)
>
>
> I just looked at the tutorial that you might be experimenting with on
> this page:
> http://eric-ide.python-projects.org/tutorials/MiniBrowser/index.html
>
> The class MainWindow is in mainwindow.py in the ui folder.  I would
> try this:
>
> from ui.mainwindow import MainWindow

In your initial code, thi's  "ui.MainWindow" not "ui.mainwindow"


-- 
Vincent V.V.
Oqapy  . Qarte
 . PaQager 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A new webpage promoting Compiler technology for CPython

2013-02-17 Thread Thomas Heller

Am 15.02.2013 08:11, schrieb Travis Oliphant:

Hey all,

With Numba and Blaze we have been doing a lot of work on what
essentially is compiler technology and realizing more and more that
we are treading on ground that has been plowed before with many other
projects.   So, we wanted to create a web-site and perhaps even a
mailing list or forum where people could coordinate and communicate
about compiler projects, compiler tools, and ways to share efforts
and ideas.

The website is:  http://compilers.pydata.org/


Travis,

I think that the pycparser project should be mentioned too on this page:

http://pypi.python.org/pypi/pycparser

Thomas

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


request of information

2013-02-17 Thread leonardo selmi

> 
> 
> 
> 
>> gentlemen:
>> 
>> i am reading a book about python and now i am blocked, i can't store 
>> functions in modules: i have a mac and am using version 2.7.3, i have 
>> created a function and want to save it as a file using "idle", i have saved  
>> it with .py , when i try to import the module i get an error: traceback(most 
>> recent call last) file  
>> "", line 1, in  
>> import circle
>> file "circle.py", line 1
>> syntax error: invalid syntax
>> 
>> can you kindly help me?
>> thanks!
>> 
>> best regards
> 

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


Re: Recording live video stream from IP camera issue

2013-02-17 Thread Xavier Ho
Hi Sam,

Did you compile your OpenCV with gstreamer?  That's where I'd look first.

Cheers,
Xav


On 18 February 2013 01:15, Sam Berry  wrote:

> Hi Xav,
>
> Iv been looking into OpenCV, i can easily stream my laptops webcam using
> this code.
>
> import cv2
>
> cv2.namedWindow("preview")
>
> vc = cv2.VideoCapture(0)
>
> if vc.isOpened(): # try to get the first frame
> rval, frame = vc.read()
> else:
> rval = False
>
> while rval:
> cv2.imshow("preview", frame)
> rval, frame = vc.read()
> key = cv2.waitKey(20)
> if key == 27: # exit on ESC
> break
>
> However using the cv2.Videocapture(ip_address) method will not load my IP
> camera video feed into the new window. I can view the stream in any web
> browser or VLC using the IP address
> http://192.168.1.72:1025/videostream.cgi?user=&pwd=&resolution=8.
>
> Did you have this issue? Is there some lines of code i may need to add?
>
> Any help would be appreciated!
>
> Thanks, Sam
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: request of information

2013-02-17 Thread Jason Swails
On Sun, Feb 17, 2013 at 1:47 PM, leonardo selmi  wrote:

>
> >
> >
> >
> >
> >> gentlemen:
> >>
> >> i am reading a book about python and now i am blocked, i can't store
> functions in modules: i have a mac and am using version 2.7.3, i have
> created a function and want to save it as a file using "idle", i have saved
>  it with .py , when i try to import the module i get an error:
> traceback(most recent call last) file
> >> "", line 1, in 
> >> import circle
> >> file "circle.py", line 1
> >> syntax error: invalid syntax
>

Look at the first line of circle.py.  This error says there is a syntax
error there.

If you can't figure out what is wrong with that line, you'll have to post
that to the list in order to get help.

(You'll benefit greatly if you can figure it out yourself -- that's the
best way to learn).

Good luck,
Jason
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: request of information

2013-02-17 Thread Michael Herman
There's a syntax error at line 1 of circle.py. Try running circle.py,
you'll get more information about the error -
http://docs.python.org/2/tutorial/errors.html

If you can't figure it out, post your code for circle.py.

On Sun, Feb 17, 2013 at 10:47 AM, leonardo selmi  wrote:

>
> >
> >
> >
> >
> >> gentlemen:
> >>
> >> i am reading a book about python and now i am blocked, i can't store
> functions in modules: i have a mac and am using version 2.7.3, i have
> created a function and want to save it as a file using "idle", i have saved
>  it with .py , when i try to import the module i get an error:
> traceback(most recent call last) file
> >> "", line 1, in 
> >> import circle
> >> file "circle.py", line 1
> >> syntax error: invalid syntax
> >>
> >> can you kindly help me?
> >> thanks!
> >>
> >> best regards
> >
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Rick Johnson
On Sunday, February 17, 2013 3:44:29 AM UTC-6, Tim Golden wrote:
> On 17/02/2013 00:19, Claira wrote:
> > Can someone tell me what kinds of questions should be asked in this
> > list and what kinds in the tutor section?
> 
> There's no clear-cut distinction. The rule of thumb I usually
> apply is that questions about the *language* (its syntax, its
> usage, its idioms etc.) and about the core parts of the standard
> library -- the modules which come with Python -- can usefully
> be asked on the Tutor list by newcomers. Questions which are
> about 3rd-party modules (for example, numpy or requests) or
> which about more specialised standard library modules (such
> as the Windows-specific modules) are probably better asked
> here on python-list or on a module-specific forum for
> external modules.

I don't agree with that assesment at all. 

I would say you could ask your question on either list and get an equal quality 
of answer(s). Both lists contain very knowledgable folks who are willing to 
help. 

The python tutor list is mainly for folks who might be new to programming OR 
folks who have a thinner skin than your average grape and thus need to be 
spoken to in an /overly/ kind manner. This list is for real world 
communications and some replies can be acerbic (especially if you want someone 
to do your homework for you!).

So the moral is:

 * If you want good answers that are not likely to offend 
   your delicate sensibilities, then ask on PyTutor.

 * If you want good answers to your questions in a strait-
   forward-and-to-the-point-manner (which may include the
   occasional "RTFM you idiot!", or "Here, LMGTFY; you lazy
   bassturd!") then ask here.



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


Tkinter, IDLE keeps crashing

2013-02-17 Thread Ash Courchene
Hey,

So I've actually had this problem for awhile, and I cant seem to get anything 
to work. I've followed all the steps & procedures that my google searches have 
provide me, but I can't seem to get the Tkinter module or the Python IDLE IDE 
to work.

For instance, if I click IDLE on my mac, it'll open up for a quick sec & 
produce an error.
Or if I go into the Python interpreter, I import Tkinter, call Tk()
Then it says: CGColor 1 components Abort Trap: 6, then get an error. I'll post 
this crash report below.

My system is a Mac OS X 10.7 Lion.
I'm running 2.7.3 Python
I've installed the recommended version of ActiveState TCL/TK

I still have problems. Does anyone have this problem, or know how to fix it?

Process: Python [32420]
Path:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:  org.python.python
Version: 2.7.3 (2.7.3)
Code Type:   X86-64 (Native)
Parent Process:  bash [32392]

Date/Time:   2013-02-17 16:37:48.197 -0500
OS Version:  Mac OS X 10.7.5 (11G63)
Report Version:  9

Interval Since Last Report:  259971 sec
Crashes Since Last Report:   14
Per-App Interval Since Last Report:  3 sec
Per-App Crashes Since Last Report:   12
Anonymous UUID:  7007EE86-A10A-47A6-9F6D-76D091A76136

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x

Application Specific Information:
abort() called
objc[32420]: garbage collection is OFF

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib  0x7fff8aea2ce2 __pthread_kill + 10
1   libsystem_c.dylib   0x7fff8af097d2 pthread_kill + 95
2   libsystem_c.dylib   0x7fff8aefaa7a abort + 143
3   Tcl 0x000100623de7 Tcl_PanicVA + 449
4   Tcl 0x000100623e89 Tcl_Panic + 162
5   Tk  0x0001010acd8d TkpGetColor + 383
6   Tk  0x0001010bab1f TkpMenuInit + 156
7   Tk  0x00010103c764 TkMenuInit + 88
8   Tk  0x0001010bd803 
-[TKApplication(TKMenus) _setupMenus] + 53
9   Tk  0x0001010b75da 
-[TKApplication(TKInit) _setup:] + 56
10  Tk  0x0001010b7b13 TkpInit + 545
11  Tk  0x00010102de42 Initialize + 1678
12  _tkinter.so 0x0001005a0d2b Tcl_AppInit + 75
13  _tkinter.so 0x00010059e1b4 Tkinter_Create + 916
14  org.python.python   0x0001000c1e7d PyEval_EvalFrameEx + 
25213
15  org.python.python   0x0001000c4149 PyEval_EvalCodeEx + 
2137
16  org.python.python   0x00010003d910 function_call + 176
17  org.python.python   0x0001c362 PyObject_Call + 98
18  org.python.python   0x00010001e97b instancemethod_call 
+ 363
19  org.python.python   0x0001c362 PyObject_Call + 98
20  org.python.python   0x0001000ba947 
PyEval_CallObjectWithKeywords + 87
21  org.python.python   0x000100021c0e PyInstance_New + 126
22  org.python.python   0x0001c362 PyObject_Call + 98
23  org.python.python   0x0001000bf2c8 PyEval_EvalFrameEx + 
14024
24  org.python.python   0x0001000c286d PyEval_EvalFrameEx + 
27757
25  org.python.python   0x0001000c4149 PyEval_EvalCodeEx + 
2137
26  org.python.python   0x0001000c4266 PyEval_EvalCode + 54
27  org.python.python   0x0001000e8a0c 
PyRun_InteractiveOneFlags + 380
28  org.python.python   0x0001000e8c6e 
PyRun_InteractiveLoopFlags + 78
29  org.python.python   0x0001000e9451 PyRun_AnyFileExFlags 
+ 161
30  org.python.python   0x00010010006d Py_Main + 3085
31  org.python.python   0x00010f14 0x1 + 3860

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib  0x7fff8aea37e6 kevent + 10
1   libdispatch.dylib   0x7fff885e9786 _dispatch_mgr_invoke 
+ 923
2   libdispatch.dylib   0x7fff885e8316 _dispatch_mgr_thread 
+ 54

Thread 2:
0   libsystem_kernel.dylib  0x7fff8aea3192 __workq_kernreturn + 
10
1   libsystem_c.dylib   0x7fff8af09594 _pthread_wqthread + 
758
2   libsystem_c.dylib   0x7fff8af0ab85 start_wqthread + 13

Thread 3:
0   libsystem_kernel.dylib  0x7fff8aea3192 __workq_kernreturn + 
10
1   libsystem_c.dylib   0x7fff8af09594 _pthread_wqthrea

Re: Tkinter, IDLE keeps crashing

2013-02-17 Thread Ned Deily
In article <9d367487-4846-4caa-85e7-08ac570b4...@googlegroups.com>,
 Ash Courchene  wrote:
> So I've actually had this problem for awhile, and I cant seem to get anything 
> to work. I've followed all the steps & procedures that my google searches 
> have provide me, but I can't seem to get the Tkinter module or the Python 
> IDLE IDE to work.
> 
> For instance, if I click IDLE on my mac, it'll open up for a quick sec & 
> produce an error.
> Or if I go into the Python interpreter, I import Tkinter, call Tk()
> Then it says: CGColor 1 components Abort Trap: 6, then get an error. I'll 
> post this crash report below.
> 
> My system is a Mac OS X 10.7 Lion.
> I'm running 2.7.3 Python
> I've installed the recommended version of ActiveState TCL/TK

Most likely you have a non-default preference set (color or font) that 
is causing the problem.  IDLE and especially Tk on OS X has been known 
to be vulnerable to this.  To try working around it, open a terminal 
session and rename the IDLE settings directory:

cd $HOME
mv .idlerc idlerc-disabled

Then try relaunching IDLE.  If that solves it, it would be nice if you 
could open an issue on the Python bug tracker (http://bugs.python.org) 
and attach to it the contents of the config files in the old 
idlerc-disabled directory.  There has been some fixes to IDLE since 
2.7.3 to make it more resilient; those will be in 2.7.4 which should be 
coming along in the near future.

-- 
 Ned Deily,
 n...@acm.org

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


Re: Comparing types

2013-02-17 Thread Rick Johnson
On Sunday, February 17, 2013 12:34:57 AM UTC-6, Jason Friedman wrote:
> [...]
> py> my_pattern = re.compile(s)
> py> type(my_pattern)
> 
> py> isinstance(my_pattern, _sre.SRE_Pattern)
> Traceback (most recent call last):
>   File "", line 1, in 
> NameError: name '_sre' is not defined

Both Steven and Terry provided answers to you question however you not still 
understand why the line "isinstance(my_pattern, _sre.SRE_Pattern)" threw a 
NameError. 

Maybe you expected '_sre.SRE_Pattern' to be imported as a consequence of 
importing the "re" module? Hmm, not so. And you can even check these things 
yourself by using the global function: "dir".

py> dir()
['__builtins__', '__doc__', '__name__', '__package__']
py> import re
py> dir()
['__builtins__', '__doc__', '__name__', '__package__', 're']

As you can see only "re" is available after import, and Python does not look 
/inside/ namespaces (except the __builtin__ namespace) to resolve names without 
a dotted path. But even /if/ Python /did/ look inside the "re" namespace, it 
would not find the a reference to the module named "_sre" anyway! Observe:

py> dir(re)
['DEBUG', 'DOTALL', 'I', 'IGNORECASE', 'L', 'LOCALE', 'M', 'MULTILINE', 'S', 
'Scanner', 'T', 'TEMPLATE', 'U', 'UNICODE', 'VERBOSE', 'X', '_MAXCACHE', 
'__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 
'__version__', '_alphanum', '_cache', '_cache_repl', '_compile', 
'_compile_repl', '_expand', '_pattern_type', '_pickle', '_subx', 'compile', 
'copy_reg', 'error', 'escape', 'findall', 'finditer', 'match', 'purge', 
'search', 'split', 'sre_compile', 'sre_parse', 'sub', 'subn', 'sys', 'template']
py> '_sre' in dir(re)
False

And if you look in the modules "_sre.py", "sre_parse.py", and "sre_constants.py 
you cannot find the symbol "SRE_Pattern" anywhere -- almost seems like magic 
huh? Heck the only "_sre.py" file i could find was wy down here:

 ...\Lib\site-packages\isapi\test\build\bdist.win32\winexe\temp\_sre.py

What were they doing, trying to bury it deeper than Jimmy Hoffa? Maybe one of 
my fellow Pythonistas would like to explain that mess?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter, IDLE keeps crashing

2013-02-17 Thread Ned Deily
In article ,
 Ned Deily  wrote:
> In article <9d367487-4846-4caa-85e7-08ac570b4...@googlegroups.com>,
>  Ash Courchene  wrote:
> > So I've actually had this problem for awhile, and I cant seem to get 
> > anything 
> > to work. I've followed all the steps & procedures that my google searches 
> > have provide me, but I can't seem to get the Tkinter module or the Python 
> > IDLE IDE to work.
> > 
> > For instance, if I click IDLE on my mac, it'll open up for a quick sec & 
> > produce an error.
> > Or if I go into the Python interpreter, I import Tkinter, call Tk()
> > Then it says: CGColor 1 components Abort Trap: 6, then get an error. I'll 
> > post this crash report below.
> > 
> > My system is a Mac OS X 10.7 Lion.
> > I'm running 2.7.3 Python
> > I've installed the recommended version of ActiveState TCL/TK
> 
> Most likely you have a non-default preference set (color or font) that 
> is causing the problem.  IDLE and especially Tk on OS X has been known 
> to be vulnerable to this.  To try working around it, open a terminal 
> session and rename the IDLE settings directory:
> 
> cd $HOME
> mv .idlerc idlerc-disabled
> 
> Then try relaunching IDLE.  If that solves it, it would be nice if you 
> could open an issue on the Python bug tracker (http://bugs.python.org) 
> and attach to it the contents of the config files in the old 
> idlerc-disabled directory.  There has been some fixes to IDLE since 
> 2.7.3 to make it more resilient; those will be in 2.7.4 which should be 
> coming along in the near future.

Following up to myself: I skipped over the second part of your problem. 
Sorry about that!

My suggestion above would apply to IDLE but would not explain why 
calling Tk() directly outside of IDLE would crash, of course.  That 
sounds more like a strictly Tk problem.  I suggest trying to eliminate 
Python from the equation by bringing up the A/S Tk wish shell:

  /usr/local/bin/wish8.5

and then trying to run some of the widget demos from its File menu.  If 
wish also fails, you probably should ask on one of the Tcl/Tk forums, 
like the tcl-mac mailing list:

   tcl-...@lists.sourceforge.net 
or http://dir.gmane.org/gmane.comp.lang.tcl.mac

What kind of Mac are your running on and do you have any unusual color 
settings or third-party extensions installed?

-- 
 Ned Deily,
 n...@acm.org

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


Re: Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Oscar Benjamin
On 17 February 2013 00:19, Claira  wrote:
>
> Can someone tell me what kinds of questions should be asked in this list and 
> what kinds in the tutor section?

If you're unsure just ask on python-tutor. If the question is not
appropriate there, you'll be offered suggestions for where it would be
appropriate. This typically happens when the problem involves specific
knowledge of extra Python software that is not well-known by most
Python programmers.

Occasionally questions are asked on python-tutor that are not
appropriate there and an alternative list/group is suggested. More
often questions are asked on python-list that would be more
appropriate on python-tutor. I've never seen anyone suggest that a
question be asked on python-tutor when this happens, which is a shame
since the same questions typically get more helpful answers there.


Oscar
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter, IDLE keeps crashing

2013-02-17 Thread Ash Courchene
I believe I have a MacBook Pro.2.4 GHz Intel Core i5.
I dont think I have any weird color settings or 3rd party extensions... How can 
I tell exactly??
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Rick Johnson
On Sunday, February 17, 2013 5:10:18 PM UTC-6, Oscar Benjamin wrote:

> More
> often questions are asked on python-list that would be more
> appropriate on python-tutor. I've never seen anyone suggest that a
> question be asked on python-tutor when this happens, which is a shame
> since the same questions typically get more helpful answers there.

I have seen a handful in my years here, but your point is indeed valid. 

However, i believe the whole idea of having more than one mailing list is folly 
anyway. Why? Case in point: this thread! We have a person who is not sure which 
list to post a question, meanwhile the question "in question" remains 
unanswered. 

Many lists employ title tags that help to give a hint of who should answer. 
like:

[newbie] How to assign variables?
[first timer] Why is Python Zen violated by stdlib?

Or even the ever-present "Help: blah blah blah?" 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Eric - "No module named MainWindow"

2013-02-17 Thread Phil

On 17/02/13 21:35, Vincent Vande Vyvre wrote:

Le 17/02/13 10:08, Phil a écrit :

Thank you for reading this.

I've been playing with Eric all day and I almost have a working GUI
application, but not quite. I have followed the two tutorials on the
Eric site and I'm sure that I haven't miss entered anything and so I





Are you sure you have a class MainWindow in your ui.MainWindow.py ?

Can you show us the code of this MainWindow ?


Thank you Vincent and Joel. I think I have already tried every 
conceivable combination but I still cannot get past the error message. 
At the risk of burdening the list with lots of code I have decided to 
show the code as it stands. It's substantially that from the mini 
browser example.


This is the auto generated code for Ui_mainWindow.py:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 
'/home/phil/mainWindow.ui'

#
# Created: Sun Feb 17 15:54:33 2013
#  by: PyQt4 UI code generator 4.9.3
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s

class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(200, 200)
self.centralWidget = QtGui.QWidget(MainWindow)
self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
self.pushButton = QtGui.QPushButton(self.centralWidget)
self.pushButton.setGeometry(QtCore.QRect(40, 120, 91, 24))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
MainWindow.setCentralWidget(self.centralWidget)

self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):

MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", 
"MainWindow", None, QtGui.QApplication.UnicodeUTF8))


self.pushButton.setText(QtGui.QApplication.translate("MainWindow", 
"PushButton", None, QtGui.QApplication.UnicodeUTF8))



if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

This is the code for mainWindow.py"

class MainWindow(QMainWindow, Ui_MainWindow):
"""
Class documentation goes here.
"""
def __init__(self, parent = None):
"""
Constructor
"""
QMainWindow.__init__(self, parent)
self.setupUi(self)

And this is the main script that I had originally used and named new_gui.py:

from PyQt4 import QtCore, QtGui
from ui.MainWindow import MainWindow

if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
ui = MainWindow()
ui.show()
sys.exit(app.exec_())

Finally, for completeness, this is the error message when I attempt to 
execute new_gui.py:


The debugged program raised the exception unhandled ImportError
"No module named mainWindow"
File: /home/phil/new_gui.py, Line: 2

Could it simply be a case of conflict between my file names and the 
module name?


--
Regards,
Phil
--
http://mail.python.org/mailman/listinfo/python-list


Re: Quick IDE Question

2013-02-17 Thread Claira
Ok, thanks brilliant people! I can't really keep up with the
conversation about where I should ask since I check my email once a week,
though the quick question I had was that I heard lighttable.com was an
innovative IDE, and since I'm preparing for the future, I just wanted to
know if light table supports python. Thanks!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Quick IDE Question

2013-02-17 Thread Andrew Berg
On 2013.02.17 18:38, Claira wrote:
> Ok, thanks brilliant people! I can't really keep up with the
> conversation about where I should ask since I check my email once a
> week, though the quick question I had was that I heard lighttable.com
>  was an innovative IDE, and since I'm preparing
> for the future, I just wanted to know if light table supports python.
> Thanks!!
I remember reading on the Kickstarter page that it will since it raised
a certain amount of money.
-- 
CPython 3.3.0 | Windows NT 6.2.9200.16461 / FreeBSD 9.1-RELEASE
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Quick IDE Question

2013-02-17 Thread Michael Herman
Yup - check out this post -
http://www.chris-granger.com/2012/05/21/the-future-is-specific/

There's a Flask example

On Sun, Feb 17, 2013 at 4:56 PM, Andrew Berg wrote:

> On 2013.02.17 18:38, Claira wrote:
> > Ok, thanks brilliant people! I can't really keep up with the
> > conversation about where I should ask since I check my email once a
> > week, though the quick question I had was that I heard lighttable.com
> >  was an innovative IDE, and since I'm preparing
> > for the future, I just wanted to know if light table supports python.
> > Thanks!!
> I remember reading on the Kickstarter page that it will since it raised
> a certain amount of money.
> --
> CPython 3.3.0 | Windows NT 6.2.9200.16461 / FreeBSD 9.1-RELEASE
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


pypi changelog api

2013-02-17 Thread Gregg Caines
Hey all,

I'm trying to write a script that tracks changes on pypi, and I've come across 
the xmlrpc interface, specifically the 'changelog' api.  It's definitely what 
I'm looking for, but I get an absolutely massive xml response from it at once 
and I was hoping there might be either some way to "page" through it with 
mulitple requests, or a different-but-similar API.

Thanks in advance,
Gregg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Chris Angelico
On Mon, Feb 18, 2013 at 11:04 AM, Rick Johnson
 wrote:
> However, i believe the whole idea of having more than one mailing list is 
> folly anyway. Why? Case in point: this thread! We have a person who is not 
> sure which list to post a question, meanwhile the question "in question" 
> remains unanswered.

Great idea! And this isn't Python-specific. Let's merge all the
world's mailing lists into one; you want to ask a question, you just
post it! Doesn't matter what it's about, just ask it and the right
people will see it and respond. This is awesome!

I wonder if Thunderbird 5 was like that.

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


Re: Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Steven D'Aprano
Chris Angelico wrote:

> On Mon, Feb 18, 2013 at 11:04 AM, Rick Johnson
>  wrote:
>> However, i believe the whole idea of having more than one mailing list is
>> folly anyway. Why? Case in point: this thread! We have a person who is
>> not sure which list to post a question, meanwhile the question "in
>> question" remains unanswered.
> 
> Great idea! And this isn't Python-specific. Let's merge all the
> world's mailing lists into one; you want to ask a question, you just
> post it! Doesn't matter what it's about, just ask it and the right
> people will see it and respond. This is awesome!

Are you asking *everyone*? What if the wrong people respond and give you bad
advice? There should be *one* person you can ask, who will answer
everything, with the correct answer to every question.

I suggest the Pope, since we know he's infallible, but if he's too old and
set in his ways for email, perhaps Rick would be almost as good.



-- 
Steven

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


Re: Awsome Python - chained exceptions

2013-02-17 Thread alex23
On Feb 15, 5:51 pm, Rick Johnson  wrote:
[Ranting nonsense that's appearing in duplicate on usenet]

Any chance you can stop sending to both comp.lang.python _and_ the
python-list, given the former is a mirror of the later?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Awsome Python - chained exceptions

2013-02-17 Thread Dave Angel

On 02/17/2013 08:35 PM, alex23 wrote:

On Feb 15, 5:51 pm, Rick Johnson  wrote:
[Ranting nonsense that's appearing in duplicate on usenet]

Any chance you can stop sending to both comp.lang.python _and_ the
python-list, given the former is a mirror of the later?



It might be easier to just tell everyone not to use GoogleGroups.  I 
think it's them that double-up the messages.  The way I control it on my 
end is with a rule that discards all emails addressed to 
comp.lang.pyt...@googlegroups.com


That way I only see the other copy.  There are a few other people who 
double-post, but this gets rid of the vast majority.


--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter, IDLE keeps crashing

2013-02-17 Thread Ned Deily
In article ,
 Ash Courchene  wrote:
> I believe I have a MacBook Pro.2.4 GHz Intel Core i5.
> I dont think I have any weird color settings or 3rd party extensions... How 
> can I tell exactly??

By finding the one that crashes Tk - yeah, I know that's not very 
helpful.  But, more seriously, have you tried running 
/usr/local/bin/wish8.5?  If Tk crashes there when running the widget 
demos, then at least Python is not a factor.

The only vaguely potentially relevant hardware factor I can think of is 
whether or not the MacBook Pro has a Retina display.  The only standard 
settings that might be revlevant are those in System Preferences -> 
Language & Text, prinarily what Input Source is selected.

Another thing you could try is to temporarily disable the ActiveState 
Tcl/Tk and see what happens with calling Tk in python and with IDLE 
then.   They will automatically fall back to using the Apple-supplied 
Tcl/Tk 8.5.x in 10.7 which is older and buggier than A/S 8.5.13 but 
should not crash immediately, either. The easiest way to do that is to 
use sudo from the terminal:

cd /Library/Frameworks/
sudo mv ./Tcl.framework ./Tcl-DISABLED
sudo mv ./Tk.framework ./Tk-DISABLED

When finished testing, you can restore them by:

cd /Library/Frameworks/
sudo mv ./Tcl-DISABLED ./Tcl.framework
sudo mv ./Tk-DISABLED ./Tk.framework

-- 
 Ned Deily,
 n...@acm.org

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


Struggling with program

2013-02-17 Thread maiden129
I'm trying to do this assignment and it not working, I don't understand why...

This is what I have to do:

Write the definition of a class  Player containing: 
An instance variable  name of type  String , initialized to the empty String.
An instance variable  score of type  int , initialized to zero.
A method called  set_name that has one parameter, whose value it assigns to the 
instance variable  name .
A method called  set_score that has one parameter, whose value it assigns to 
the instance variable  score .
A method called  get_name that has no parameters and that returns the value of 
the instance variable  name .
A method called  get_score that has no parameters and that returns the value of 
the instance variable  score .
 No constructor need be defined. 

Here is my code:

class Player:


name = ''

def __init__(self,score = 0)

def set_name (self):
self.name

def set_score (self):
self.score

def get_name
return name

def  get_score
return score

can someone please help me?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Struggling with program

2013-02-17 Thread Dave Angel

On 02/17/2013 09:29 PM, maiden129 wrote:

First question:  What version of Python are you writing this for? 
Version 2.x has slightly different rules than version 3.x




I'm trying to do this assignment and it not working, I don't understand why...



Define "working."  Do you mean you get a syntax error when you try to 
run it?  If so, then post the full traceback, which will point to the 
location of the error, (or sometimes the next line or two).



This is what I have to do:

Write the definition of a class  Player containing:
An instance variable  name of type  String , initialized to the empty String.
An instance variable  score of type  int , initialized to zero.
A method called  set_name that has one parameter, whose value it assigns to the 
instance variable  name .
A method called  set_score that has one parameter, whose value it assigns to 
the instance variable  score .
A method called  get_name that has no parameters and that returns the value of 
the instance variable  name .
A method called  get_score that has no parameters and that returns the value of 
the instance variable  score .
  No constructor need be defined.

Here is my code:

class Player:


If this is Python 2.x, then you want to derive from object, not just 
make a standalone class.





name = ''


Have you read the Python tutorial page at:
 http://docs.python.org/2/tutorial/classes.html
That's assuming you're writing for Python 2.7.

python doesn't have instance variables, they're called instance data 
attributes.  Have you defined name as an instance attribute, or a class 
attribute?





def __init__(self,score = 0)


Without a colon, this is a syntax error.
And without a body, it's another syntax error.


def set_name (self):


Where is the parameter to hold the new name?


self.name


This references the instance attribute, but doesn't modify it.


def set_score (self):
self.score

def get_name



No parens, no parameters, no colon.

return name


def  get_score


ditto


return score

can someone please help me?




--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list


How to go about with PDF regression

2013-02-17 Thread Jon Reyes
Hey there, so I'm trying to create automated regression for PDFs that will use 
Selenium RC for the generation and Python for the comparison of PDFs. I will be 
using pyPdf to rename the files according to their content, ImageMagick to 
convert the PDFs to images and PIL to actually compare the PDFs page by page. 
Here's a big pain in the neck though: not all elements in the PDF will be the 
same. This means that with the dynamic parts of the PDF I should not compare 
them. Right now what I do is find the region that will be removed, paint over a 
white box on the element and then compare. The problem is I have to do this for 
any PDF that will deviate with some of the coordinates I've already gotten and 
this will probably take lots of time. Worse, I will have to setup a config 
file, xml or probably overload a class with variables as constants and bunch up 
a lot of ifs so that I could remove the proper elements in a PDF. 

Has anyone done PDF regression for Python like this before and have you found a 
better way to do it?

I was thinking if there was a tool where I could open up the image and I could 
create boxes with the mouse and it will automatically generate the correct box 
coordinates then my life would be a tad easier but nope, I don't think there is 
one. 

Also, I thought that I could get the content of the PDF using pyPdf with the 
PageObject's extractText() method then just remove the parts but it turns out 
this couldn't be done and is not possible with PDFs. Too bad, if I had this in 
place I wouldn't need to worry about elements moving and getting the 
coordinates for all the PDFs.

Any ideas will be appreciated.

PS: I'm thinking of just creating the coordinates generator tool myself but I 
have zero experience with GUI programming let alone TKinter. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to go about with PDF regression

2013-02-17 Thread Jon Reyes
Update: Found out with the Picture Manager by Windows I could view an image 
100%, use a tool that measures the windows and get a probably not accurate but 
still serviceable coordinate to use. I compared with the coordinates I 
currently have and tried to get it by the above method and the coordinates are 
surprisingly close.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Struggling with program

2013-02-17 Thread Michael Torrie
On 02/17/2013 07:29 PM, maiden129 wrote:
> I'm trying to do this assignment and it not working, I don't
> understand why...
> 
> This is what I have to do:
> 
> Write the definition of a class  Player containing: An instance
> variable  name of type  String , initialized to the empty String. An
> instance variable  score of type  int , initialized to zero. A method
> called  set_name that has one parameter, whose value it assigns to
> the instance variable  name . A method called  set_score that has one
> parameter, whose value it assigns to the instance variable  score . A
> method called  get_name that has no parameters and that returns the
> value of the instance variable  name . A method called  get_score
> that has no parameters and that returns the value of the instance
> variable  score . No constructor need be defined. can someone please
> help me?

While no one here is willing to do homework for someone else we do like
to help out however we can.

As Dave alluded to, python "instance variables" are called attributes
and typically are initialized in the the __init__(self, ...) method of
the class.  The "self" name, however, can be anything you want.  For
consistency, most python programmers use "self."

So your assignment is a bit misleading when it says a constructor is not
required, because if you want to initialize some instance attributes, it
has to be done in a method, usually the constructor, which in Python is
__init__.

"Instance variables" always need to be referred to with an explicit self
parameter.  This is always the first parameter of any method
declaration. Thus you would define things kind of like so:

-
from __future__ import print_function #in case python2

class MyClass(object):
def __init__(self, var2):
# create instance attributes and assign them values
self.instance_variable = 5
self.instance_variable2 = var2

def print_values(self):
print("instance_variable is {0}, and instance_variable2 is
{1}".format(self.instance_variable, self.instance_variable2))

if __name__ == "__main__":
c = MyClass(10); # this passes 10 to the __init__ method
c.print_values() # note there is no self parameter passed;
 # python passes "c" for you implicitly.
--

If you run this python snippet you get this as output:

instance_variable is 5, and instance_variable2 is 10

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


Re: Eric - "No module named MainWindow" - solved

2013-02-17 Thread Phil

On 17/02/13 21:35, Vincent Vande Vyvre wrote:

Le 17/02/13 10:08, Phil a écrit :

Thank you for reading this.

I've been playing with Eric all day and I almost have a working GUI
application, but not quite. I have followed the two tutorials on the
Eric site and I'm sure that I haven't miss entered anything and so I
think the error is the result of something missing from my system or
perhaps a path error.

This is the error message:

The debugged program raised the exception unhandled ImportError
"No module named MainWindow"
File: /home/phil/main.py, Line: 4



The solution is to save the various files in their correct directories 
as mentioned in the tutorial.


--
Regards,
Phil
--
http://mail.python.org/mailman/listinfo/python-list


Simulation of human body in movement

2013-02-17 Thread Nick Mellor
Hi all,

I'm looking for a fairly undetailed simulation of the human body walking and 
standing. Has anyone had a go at this in cgkit or similar?

Thanks,

Nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Awsome Python - chained exceptions

2013-02-17 Thread Rick Johnson
On Sunday, February 17, 2013 7:35:24 PM UTC-6, alex23 wrote:

> Any chance you can stop sending to both comp.lang.python _and_ the 
> python-list, given the former is a mirror of the later?

I apologize for this doubling of my messages and i can assure you i don't do 
this intentionally. Proper netiquette is very important to me. These double 
posts are another unfortunate side-effect of using the buggy Google Groups 
web-face to read/write Usenet. I've sent feedback to the Google Groups long ago 
and have yet to see any changes or even get any replys. 

You know, i try to support Google because (for the most part) they are the only 
option to M$ and they "give-back". However, sustaining the last few years of 
them cramming (this and other) buggy software down my throat is starting to 
wear on my patience. 

Not only does this software post the same message twice, it also inserts 
superfluous newlines in quoted text, does not support mono-spaced fonts 
_anymore_, and wraps lines at well over 150 chars! The old groups interface was 
simple, had mono-spaced font, and wrapped lines at reasonable lengths. I am a 
simple kinda guy, and so i really liked the old group interface. :-(

Alex, if you (or anyone else) would be kind enough to recommend an alternative 
to this gawd awful software, i'm all ears. My expectations at minimum are:

 * I only like to read the list from the web, i just hate
   getting thousands of emails in my inbox.

 * I MUST have mono-spaced font (at least as an option).

That's about it. Anything else is just icing really.

PS: To all of you that use the buggy GoogleGroups, please send them feedback 
detailing all of these bugs (and any more that you have experienced!)
-- 
http://mail.python.org/mailman/listinfo/python-list


news.gmane.org (was Re: Awsome Python - chained exceptions

2013-02-17 Thread Terry Reedy

On 2/18/2013 12:51 AM, Rick Johnson wrote:
> if you (or anyone else) would be kind enough to recommend an
> alternative to this gawd awful software [google groups],
?  i'm all ears. My expectations at minimum are:

For at least the 10th time, there is little to no excuse for reading and 
writing python-list thru google-groups. The news.gmane.org mirror has 
multiple interfaces:

'''
Information about gmane.comp.python.general
The archive for this list can be read the following ways:

On the web, using frames and threads.
On the web, using a blog-like, flat interface.
Using an NNTP newsreader.
RSS feeds:
All messages from the list, with excerpted texts.
Topics from the list, with excerpted texts.
All messages from the list, with complete texts.
Topics from the list, with complete texts.
'''


* I only like to read the list from the web, i just hate getting
thousands of emails in my inbox.


A newsreader interface does the same. That is what I use.


* I MUST have mono-spaced font (at least as an option).


That is what I have with Thunderbird. I may have told it once to use 
monospace for newsgroups. You might be able to do the same with a web 
browser.



--
Terry Jan Reedy

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


Re: news.gmane.org (was Re: Awsome Python - chained exceptions

2013-02-17 Thread Rick Johnson
Terry Reedy  udel.edu> writes:
> For at least the 10th time, there is little to no excuse for reading and 
> writing python-list thru google-groups. The news.gmane.org mirror has 
> multiple interfaces:

[Sent from gmane.comp.python.general]

Yes you have mentioned this before and for some reason i failed to follow your
advice. I must have fallen into the trap of familiarity. In any event, if this
message works i shall use gmane from now on. Thanks Terry!


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


Re: Can someone tell me what kinds of questions should be asked in this list and what kinds in the tutor section?

2013-02-17 Thread Chris Angelico
On Mon, Feb 18, 2013 at 4:37 PM, Dennis Lee Bieber
 wrote:
> On Mon, 18 Feb 2013 12:31:44 +1100, Steven D'Aprano
>  declaimed the following in
> gmane.comp.python.general:
>
>>
>> I suggest the Pope, since we know he's infallible, but if he's too old and
>> set in his ways for email, perhaps Rick would be almost as good.
>
> Let's kill two birds with one stone...
>
> Since the Pope is abdicating, write letters to your Cardinal (not
> the bird) to nominate Rick as the next Pope.

He should perform a miracle first, to prove he's worthy of the
position. (Pope, saint, same thing right? I'm not a Catholic...) I
suggest he produce Python 4000 - that would be clear evidence of
miraculous power.

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


Re: Struggling with program

2013-02-17 Thread Chris Angelico
On Mon, Feb 18, 2013 at 1:29 PM, maiden129  wrote:
> Write the definition of a class  Player containing:
> An instance variable  name of type  String , initialized to the empty String.
> An instance variable  score of type  int , initialized to zero.
> A method called  set_name that has one parameter, whose value it assigns to 
> the instance variable  name .
> A method called  set_score that has one parameter, whose value it assigns to 
> the instance variable  score .
> A method called  get_name that has no parameters and that returns the value 
> of the instance variable  name .
> A method called  get_score that has no parameters and that returns the value 
> of the instance variable  score .
>  No constructor need be defined.

Is this actually a Python assignment? This sounds decidedly
un-Pythonic. A much more idiomatic way to write this would simply be
(with the explicit subclassing of object optional in Python 3):

class Player(object):
pass

You can then create a player thus:

fred = Player()

And set his name and score:

fred.name = "Fred"
fred.score = 1024

And get them just as easily:

print("Name: "+fred.name)
print("Score: "+str(fred.score))

Note how much code I wrote to make all this possible: None. In Java
and C++, the convention is to hide internal members, on the off-chance
that you might need to change a trivial getter/setter pair into
something more complicated (though in my experience, this almost never
can be done so simply even if you _have_ the getter and setter - the
only situation that that model serves is logging/breakpoints); in
Python, you get the same benefit without them, thanks to some spiffy
features that you probably don't need to worry about the details of at
the moment.

The only thing that I might want to change in the above code is to
create an __init__ member that initializes all the "normal" members -
possibly to its arguments, letting you do fred=Player("Fred",1024), or
possibly to some sort of default value. This serves as documentation
and also saves checking for AttributeError when reading from the
object. But otherwise, there's nothing in there that Python hasn't
already done for you.

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


Re: Comparing types

2013-02-17 Thread Chris Angelico
On Mon, Feb 18, 2013 at 9:13 AM, Rick Johnson
 wrote:
> And if you look in the modules "_sre.py", "sre_parse.py", and 
> "sre_constants.py you cannot find the symbol "SRE_Pattern" anywhere -- almost 
> seems like magic huh? Heck the only "_sre.py" file i could find was wy 
> down here:
>
>  ...\Lib\site-packages\isapi\test\build\bdist.win32\winexe\temp\_sre.py
>
> What were they doing, trying to bury it deeper than Jimmy Hoffa? Maybe one of 
> my fellow Pythonistas would like to explain that mess?

I have ~/cpython/Modules/_src.c and .o in my build directory. I
suspect that that might be where it is.

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


SOAP web services using python. Would like to change the Envelope Document using MessagePlugin before sending it using suds

2013-02-17 Thread sarat . devineni
Hi ,

My current SOAP request sent via suds.client looks like this:


  

  

  
Test
  

  



This request fails on my server. If i take the same XML request and massage it 
and send it visa SOAPUI, it works fine. What I did was


  

  

  
Test
  

  



As you see, I had to change SOAP-ENV to soapenv, modify node ns5:saveModule to 
saveModule and also remove attributes such xsi:type to other child nodes

How can I , modify the request in above manner using suds.client. Documentation 
suggests to use a plugin with Client using marshalled method. But I was 
unsuccessful

Any help is greatly appreciated

Regards,
SD
-- 
http://mail.python.org/mailman/listinfo/python-list