Re: Replace blanks with letter

2013-08-21 Thread eschneider92
Thanks. I am running into a bunch of problems with the following code, all of which are clear when running the program import random letters='abcdefg' blanks='_'*len(letters) print('type letters from a to g') print(blanks) for i in range(len(letters)): if letters[i] in input(): bla

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-21 Thread Luca Cerone
> > I have used "cookielib" externally to "urllib2". It looks > > like this: > > from urllib2 import urlopen, Request > > from cookielib import CookieJar > cookies = CookieJar() > > > > r = Request(...) > > cookies.add_cookie_header(r) # set the cookies > > R = urlopen(r, ...) # make t

Re: Basic Python Query

2013-08-21 Thread Steven D'Aprano
On Wed, 21 Aug 2013 14:50:20 +0800, chandan kumar wrote: [...] > 1.Difference between  def StartThread(self) and def __init__(self): __init__ is a special method called automatically by Python when you create an instance. StartThread is a method that the author of the code (perhaps you?) wrote

Re: refresing the edited python function

2013-08-21 Thread Sudheer Joseph
Thank you,     But I wish if there was a foolproof reload with best regards, Sudheer - Original Message - > From: Jean-Michel Pichavant > To: Sudheer Joseph > Cc: python-list@python.org > Sent: Tuesday, 20 August 2013 10:07 PM > Subject: Re: refresing the edited python func

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-21 Thread Fábio Santos
On 21 Aug 2013 09:22, "Luca Cerone" wrote: > > > > > I have used "cookielib" externally to "urllib2". It looks > > > > like this: > > > > from urllib2 import urlopen, Request > > > > from cookielib import CookieJar > > cookies = CookieJar() > > > > > > > > r = Request(...) > > > > cookies.add

Re: Basic Python Query

2013-08-21 Thread Ulrich Eckhardt
Am 21.08.2013 08:50, schrieb chandan kumar: class Test(threading.Thread): def StartThread(self): Lock = threading.Lock() self.start() Inconsistently indented code, this is a killer for Python. Please read PEP8 and use four spaces! That said, there is never a need for de

Re: Replace blanks with letter

2013-08-21 Thread Chris Angelico
On Wed, Aug 21, 2013 at 5:49 PM, wrote: > Thanks. I am running into a bunch of problems with the following code, all of > which are clear when running the program Some of us don't have time to just execute arbitrary code in some safe environment, so we'd REALLY rather you paste in the exceptio

Matrix sort

2013-08-21 Thread vijayendramunikoti
Hi I have a matrix of numbers representing the nodal points as follows: Element No.Nodes 1 1 2 3 4 2 5 6 7 8 3 2 3 9 10 ... ... x 9 10 11 12 ... so this is

How to change scrollbar color in pygtk ?

2013-08-21 Thread Norah Jones
Hi, I Tried the below code, the color is not reflected, Am i missing something? #add description box beside test cases testCaseDescWindow = gtk.ScrolledWindow() testCaseDescWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) testCaseDescWindow.get_vscrollbar()

Re: default python os x

2013-08-21 Thread Cameron Simpson
On 20Aug2013 09:01, Uwe Rangs wrote: | Ah, I see. Thank you! Please don't top post. Thanks. | On 2013-08-20 05:39:56 +, Steven D'Aprano said: | >alias python1.5='env -u PYTHONSTARTUP python1.5' I should point out that -u is a GNU env feature. It is not portable, and in particular OSX "env"

Re: Matrix sort

2013-08-21 Thread Oscar Benjamin
On 21 August 2013 10:24, wrote: > Hi > I have a matrix of numbers representing the nodal points as follows: > > Element No.Nodes > > 1 1 2 3 4 > 2 5 6 7 8 > 3 2 3 9 10 > ... > ... > x

Re: Replace blanks with letter

2013-08-21 Thread Dave Angel
eschneide...@comcast.net wrote: > Thanks. I am running into a bunch of problems with the following code, all of > which are clear when running the program > > import random > letters='abcdefg' > blanks='_'*len(letters) > print('type letters from a to g') > print(blanks) > for i in range(len(let

Create an App with Python & Win $5000

2013-08-21 Thread yigit
Hi all, JotForm just announced its developer contest with their newly released API with a grand prize of $5000 to the best app and $500 for other categories. The API library can be used with Python so you can create endless apps with it. The deadline for the contest is September 24, 2013. Appl

Re: Replace blanks with letter

2013-08-21 Thread John Gordon
In <89146bb1-fb60-4746-93e2-6cb59cfbc...@googlegroups.com> eschneide...@comcast.net writes: > Thanks. I am running into a bunch of problems with the following code, all > of which are clear when running the program No, they're not clear. We can see what the code does, obviously, but we don't kn

I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Comment Holder
Hi, I am totally new to Python. I noticed that there are many videos showing how to collect data from Python, but I am not sure if I would be able to accomplish my goal using Python so I can start learning. Here is the example of the target page: http://and.medianewsonline.com/hello.html In this

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Joel Goldstick
On Wed, Aug 21, 2013 at 10:55 AM, Comment Holder wrote: > Hi, > I am totally new to Python. I noticed that there are many videos showing how > to collect data from Python, but I am not sure if I would be able to > accomplish my goal using Python so I can start learning. > > Here is the example o

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Comment Holder
Many thanks Joel, You are right to some extent. I come from Finance background, but I am very familiar with what could be referred to as non-native languages such as Matlab, VBA,.. actually, I have developed couple of complete programs. I have asked this question, because I am a little worried

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Joel Goldstick
On Wed, Aug 21, 2013 at 11:44 AM, Comment Holder wrote: > Many thanks Joel, > > You are right to some extent. I come from Finance background, but I am very > familiar with what could be referred to as non-native languages such as > Matlab, VBA,.. actually, I have developed couple of complete pro

Unpickling data with classes from dynamic modules

2013-08-21 Thread Fredrik Tolf
Dear list, I have a system in which I load modules dynamically every now and then (that is, creating a module with types.ModuleType, compiling the code for the module and then executing it in the module with exec()), and where I would wish to be able to have classes in those modules containing

A data transformation framework. A presentation inviting commentary.

2013-08-21 Thread F.R.
Hi all, In an effort to do some serious cleaning up of a hopelessly cluttered working environment, I developed a modular data transformation system that pretty much stands. I am very pleased with it. I expect huge time savings. I would share it, if had a sense that there is an interest out th

Re: refresing the edited python function

2013-08-21 Thread Piet van Oostrum
Dave Angel writes: > > Seems to me your problem is with ipython's IDE, not with Python. Python > requires you to rerun your application when making most changes to code. > But it doesn't say anything about restarting a "console," whatever that > is in this context. I use Komodo IDE when i want

Re: Encapsulation unpythonic?

2013-08-21 Thread random832
On Mon, Aug 19, 2013, at 3:05, Steven D'Aprano wrote: > In this toy example, both parties are at fault: the author of Parrot for > unnecessary data-hiding of something which is so obviously a useful piece > of information and should be part of the public interface, It may wish to be notified whe

Re: PEPs should be included with the documentation download

2013-08-21 Thread Chris Angelico
On Wed, Aug 21, 2013 at 3:14 PM, Aseem Bansal wrote: > Currently the documentation download includes a lot of things but PEPs are > not its part. I wanted to suggest that PEPs should be included in the > download. They are very much relevant to Python. The PEPs are kinda like the specs that Pyt

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Comment Holder
Dear Joel, Many thanks for your help - I think I shall start with this way and see how it goes. My concerns were if the task can be accomplished with Python, and from your posts, I guess it can - so I shall give it a try :). Again, thanks a lot & all best// -- http://mail.python.org/mailman/

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Joel Goldstick
On Wed, Aug 21, 2013 at 1:41 PM, Comment Holder wrote: > Dear Joel, > > Many thanks for your help - I think I shall start with this way and see how > it goes. My concerns were if the task can be accomplished with Python, and > from your posts, I guess it can - so I shall give it a try :). > > Ag

Re: PEPs should be included with the documentation download

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 13:32, Chris Angelico wrote: > On Wed, Aug 21, 2013 at 3:14 PM, Aseem Bansal > wrote: > > Currently the documentation download includes a lot of things but PEPs are > > not its part. I wanted to suggest that PEPs should be included in the > > download. They are very much

utcoffset v. _utcoffset

2013-08-21 Thread Skip Montanaro
Consider this little Python script: import dateutil.parser import pytz x = dateutil.parser.parse("2013-08-16 23:00:00+01:00") localtz = pytz.timezone("America/Chicago") y = localtz.normalize(x) When I execute it (Python 2.7.2, dateutil 1.5, pytz 2011h), I get this traceback: Traceback (most rec

Re: PEPs should be included with the documentation download

2013-08-21 Thread Jerry Hill
On Wed, Aug 21, 2013 at 1:55 PM, wrote: > I think, though, that if there's any useful information that can be > obtained by reading accepted PEPs but not the documentation, or if > things are explained less clearly than in the PEPs, that's a bug in the > documentation, and should be remedied by a

Re: refresing the edited python function

2013-08-21 Thread Chris Angelico
On Wed, Aug 21, 2013 at 4:26 PM, Sudheer Joseph wrote: > > > Thank you, > But I wish if there was a foolproof reload > with best regards, > Sudheer There isn't, any more than there's a foolproof way to prevent top-posting. Some languages are designed to handle code reload; others

Re: PEPs should be included with the documentation download

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 14:15, Jerry Hill wrote: > Personally, the only PEPs I've used as reference material as PEP 8 > (the Python Style Guide), and PEP 249 (the Python Database API > Specification v2.0). If I recall correctly, one of the database > adapters I used basically said that they were

Re: PEPs should be included with the documentation download

2013-08-21 Thread Chris Angelico
On Thu, Aug 22, 2013 at 4:15 AM, Jerry Hill wrote: > On Wed, Aug 21, 2013 at 1:55 PM, wrote: >> I think, though, that if there's any useful information that can be >> obtained by reading accepted PEPs but not the documentation, or if >> things are explained less clearly than in the PEPs, that's

Re: Basic Python Query

2013-08-21 Thread Johannes Bauer
On 21.08.2013 11:11, Ulrich Eckhardt wrote: > That said, there is never a need for deriving > from the Thread class, you can also use it to run a function without > that. That way is IMHO clearer because the threading.Thread instance is > not the thread, just like a File instance is not a file. Bo

Re: A data transformation framework. A presentation inviting commentary.

2013-08-21 Thread Chris Angelico
On Thu, Aug 22, 2013 at 2:29 AM, F.R. wrote: > The nucleus of the TX system is a Transformer class, a wrapper for any kind > of transformation functionality. The Transformer takes input as calling > argument and returns it transformed. Not to put too much of a damper on your concept, but it's see

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Terry Reedy
On 8/21/2013 1:52 PM, Joel Goldstick wrote: On Wed, Aug 21, 2013 at 1:41 PM, Comment Holder wrote: Many thanks for your help - I think I shall start with this way and see how it goes. My concerns were if the task can be accomplished with Python, and from your posts, I guess it can - so I sh

Re: A data transformation framework. A presentation inviting commentary.

2013-08-21 Thread Terry Reedy
On 8/21/2013 12:29 PM, F.R. wrote: Hi all, In an effort to do some serious cleaning up of a hopelessly cluttered working environment, I developed a modular data transformation system that pretty much stands. I am very pleased with it. I expect huge time savings. I would share it, if had a sense

Re: make elements of a list twice or more.

2013-08-21 Thread Tobiah
On 08/07/2013 01:50 AM, liuerfire Wang wrote: > Sorry for the title which didn't make clear. > > Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are > different type). Now I wanna generate a new list as [b, > b, a, a, c, c]. If you don't care about the order, you can do:

Arpex Capital seleciona: Desenvolvedor Python (MongoDB) / SP

2013-08-21 Thread zughumancapital
Arpex Capital seleciona para uma de suas empresas: Desenvolvedor Python (MongoDB) Objetivo geral da Posição: Desenvolver software estável e de primeira linha, que será incorporado à plataforma de WiFi mais moderna atualmente. Responsabilidades: escrever software que rodará tanto no backend (Pytho

Re: PEPs should be included with the documentation download

2013-08-21 Thread Terry Reedy
On 8/21/2013 1:32 PM, Chris Angelico wrote: On Wed, Aug 21, 2013 at 3:14 PM, Aseem Bansal wrote: Currently the documentation download includes a lot of things but PEPs are not its part. I wanted to suggest that PEPs should be included in the download. They are very much relevant to Python.

RE: Unpickling data with classes from dynamic modules

2013-08-21 Thread Prasad, Ramit
Fredrik Tolf wrote: > > Dear list, > > I have a system in which I load modules dynamically every now and then > (that is, creating a module with types.ModuleType, compiling the code for > the module and then executing it in the module with exec()), and where I > would wish to be able to have clas

Re: utcoffset v. _utcoffset

2013-08-21 Thread Terry Reedy
On 8/21/2013 2:05 PM, Skip Montanaro wrote: Consider this little Python script: import dateutil.parser import pytz Neither of these are stdlib modules, so I cannot run this. x = dateutil.parser.parse("2013-08-16 23:00:00+01:00") localtz = pytz.timezone("America/Chicago") y = localtz.normaliz

Re: utcoffset v. _utcoffset

2013-08-21 Thread Ned Deily
In article , Skip Montanaro wrote: > Consider this little Python script: > > import dateutil.parser > import pytz > > x = dateutil.parser.parse("2013-08-16 23:00:00+01:00") > localtz = pytz.timezone("America/Chicago") > y = localtz.normalize(x) > > When I execute it (Python 2.7.2, dateutil 1

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2013-08-21 Thread David M. Welch
Hi all, This is an old thread, but I'm having the same behavior in my terminal when I run some code but kill the process in the terminal (Ctrl-C). The code has two prime suspects (from a simple google search): 1. Creates ssh port forward via the subprocess module (http://unix.stackexchange.com/q

python3-sqlalchemy and debian repo

2013-08-21 Thread Mohsen Pahlevanzadeh
Dear all, I want to use sqlalchemy library, When i use "apt-cashe search sqlalchemy" , get the following result(part of result): /// python-sqlalchemy - SQL toolkit and Object Relational Mapper for Python python-sqlalchemy-doc - documentation for the SQLAlchemy Python library python-sq

Re: NodeTransformer: how to remove nodes?

2013-08-21 Thread Tobias Müller
Thanks Chris and Peter. I already went further along. No more issues so far. 2013/8/19 Peter Otten <__pete...@web.de> > Tobias Müller wrote: > > > I'm facing an issue with NodeTransformer, a tool used for Python AST > > manipulations. > > > > Last week I posted on stackoverflow.com, but there

RE: utcoffset v. _utcoffset

2013-08-21 Thread Prasad, Ramit
Skip Montanaro wrote: > > Consider this little Python script: > > import dateutil.parser > import pytz > > x = dateutil.parser.parse("2013-08-16 23:00:00+01:00") > localtz = pytz.timezone("America/Chicago") > y = localtz.normalize(x) > > When I execute it (Python 2.7.2, dateutil 1.5, pytz 2011h

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 12:42, David M. Welch wrote: > Hi all, > > This is an old thread, but I'm having the same behavior in my terminal > when > I run some code but kill the process in the terminal (Ctrl-C). The code > has > two prime suspects (from a simple google search): > 1. Creates ssh p

Re: Encapsulation unpythonic?

2013-08-21 Thread Ian Kelly
On Aug 21, 2013 10:53 AM, wrote: > > On Mon, Aug 19, 2013, at 3:05, Steven D'Aprano wrote: > > In this toy example, both parties are at fault: the author of Parrot for > > unnecessary data-hiding of something which is so obviously a useful piece > > of information and should be part of the public

Re: Basic Python Query

2013-08-21 Thread Fábio Santos
On 21 Aug 2013 20:07, "Johannes Bauer" wrote: > > On 21.08.2013 11:11, Ulrich Eckhardt wrote: > > > That said, there is never a need for deriving > > from the Thread class, you can also use it to run a function without > > that. That way is IMHO clearer because the threading.Thread instance is > >

Re: Basic Python Query

2013-08-21 Thread Ned Batchelder
On 8/21/13 6:50 PM, Fábio Santos wrote: On 21 Aug 2013 20:07, "Johannes Bauer" > wrote: > > On 21.08.2013 11:11, Ulrich Eckhardt wrote: > > > That said, there is never a need for deriving > > from the Thread class, you can also use it to run a function without > >

Re: Encapsulation unpythonic?

2013-08-21 Thread Steven D'Aprano
On Wed, 21 Aug 2013 12:52:06 -0400, random832 wrote: > On Mon, Aug 19, 2013, at 3:05, Steven D'Aprano wrote: >> In this toy example, both parties are at fault: the author of Parrot >> for unnecessary data-hiding of something which is so obviously a useful >> piece of information and should be part

Using PyQT with QT Designer

2013-08-21 Thread Michael Staggs
I'm learning Python and I have a problem. I've asked the question everywhere and no one helps me, so I'm hoping someone here will. I am making a program that shows album covers and you click on the album cover in the top window. In the bottom window, the list of songs appear and you can click th

Python and mysql 3 tier programming

2013-08-21 Thread Gary Roach
Hi all, I'm now to the list so apologies if I don't always follow the local protocol. My problem is the interface between python and mysql using a three tier model. First, some background: System Debian Wheezy Linux Python 2.7 Mysql 5.5.31 Apache Server I am somewhat conversant with html, cs

Re: Encoding problem in python

2013-08-21 Thread electron
If you use Arabic frequently on your system, I suggest to change your windows system locale from "Region and Language" in control panel (Administrative tab) and set to Arabic. -- http://mail.python.org/mailman/listinfo/python-list

RE: Unpickling data with classes from dynamic modules

2013-08-21 Thread Fredrik Tolf
On Wed, 21 Aug 2013, Prasad, Ramit wrote: Fredrik Tolf wrote: [...] I considered trying to create subclasses of the pickler and unpickler that pickle a reference to a module loader and data for the particular module along with a class that comes from such a module, by overriding Pickler.save_glo

Re: PEPs should be included with the documentation download

2013-08-21 Thread Cameron Simpson
On 22Aug2013 03:32, Chris Angelico wrote: | Also, how many people actually depend on the downloadable | documentation, rather than simply reading things online? I do. It is outstandingly faster, and works when one is offline; I always have a local copy of a 2.x and 3.x documentation set as deskto

Re: I wonder if I would be able to collect data from such page using Python

2013-08-21 Thread Piet van Oostrum
Comment Holder writes: > Hi, > I am totally new to Python. I noticed that there are many videos showing how > to collect data from Python, but I am not sure if I would be able to > accomplish my goal using Python so I can start learning. > > Here is the example of the target page: > http://and.

pydoc vs. non-def'd methods

2013-08-21 Thread Dan Sommers
Greetings, I'm hava a class in which there are two equally useful names for one method. Consider this design (there are other approaches, but that's not what my question is about): class Spam1: def eggs(self): '''Return the Meaning of Life.''' return 42 ham = eggs help

Re: Basic Python Query

2013-08-21 Thread Bob Martin
in 704175 20130822 010625 Ned Batchelder wrote: >This is a multi-part message in MIME format. Please post in plain text, not HTML. -- http://mail.python.org/mailman/listinfo/python-list

Running a command line program and reading the result as it runs

2013-08-21 Thread Ian Simcock
Greetings all. I'm using Python 2.7 under Windows and am trying to run a command line program and process the programs output as it is running. A number of web searches have indicated that the following code would work. import subprocess p = subprocess.Popen("D:\Python\Python27\Scripts\pip.e

Re: How to keep cookies when making http requests (Python 2.7)

2013-08-21 Thread dieter
Luca Cerone writes: >... > Have you tried this code to check if this work? Not this code, but code like this (as I have written). > If it works as intended can you explain a bit better > what it does exactly? Fabio already did the explanation. Let me make an additional remark however: you sh

Re: Running a command line program and reading the result as it runs

2013-08-21 Thread Chris Angelico
On Thu, Aug 22, 2013 at 3:51 PM, Ian Simcock wrote: > When I use this code I can see that the Popen works, any code between the > Popen and the for will run straight away, but as soon as it gets to the for > and tries to read p.stdout the code blocks until the command line program > completes, the

Re: Unpickling data with classes from dynamic modules

2013-08-21 Thread dieter
Fredrik Tolf writes: > ... >> Maybe all you need to add is implementation for obj.__reduce__ > > That would certainly work, and I guess I could perhaps use it as a > work-around, but that would mean I'd have to mark every single such > class as such in some way or another. What I'm looking for is

Re: pydoc vs. non-def'd methods

2013-08-21 Thread Steven D'Aprano
On Thu, 22 Aug 2013 05:13:03 +, Dan Sommers wrote: > Greetings, > > I'm hava a class in which there are two equally useful names for one > method. Consider this design (there are other approaches, but that's > not what my question is about): Generally though, one name will be the canonical

Re: A data transformation framework. A presentation inviting commentary.

2013-08-21 Thread dieter
"F.R." writes: > ... > In an effort to do some serious cleaning up of a hopelessly cluttered > working environment, I developed a modular data transformation system > that pretty much stands. I am very pleased with it. I expect huge time > savings. I would share it, if had a sense that there is a