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 wing

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-05 Thread Rafael Durán Castañeda
El 04/08/13 04:10, Francois Lafont escribió: Hi, Is it possible with argparse to have this syntax for a script? my-script (-a -b VALUE-B | -c -d VALUE-D) I would like to do this with the argparse module. Thanks in advance. I think you are looking for exclusive groups: http://docs.python.o

Re: Converting a list of lists to a single list

2013-07-23 Thread Rafael Durán Castañeda
El 23/07/13 23:52, st...@divillo.com escribió: [[A0,A1,A2], [B0,B1,B2] [C0,C1,C2]] Hi, I think you are looking for itertools.chain, or in this case, itertools.chain.from_iterable: In [1]: x = [['A0','A1','A2'], ['B0','B1','B2'], ['C0','C1','C2']] In [2]: import itertools In [3]: [ y for y

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-17 Thread Rafael Durán Castañeda
El 17/06/12 06:48, Chris Angelico escribió: On Sun, Jun 17, 2012 at 2:18 PM, Steven D'Aprano wrote: Safe from what? What is your threat model? Are you worried about your little sister reading your diary? Or the NSA discovering your plans to assassinate the President? Or something in between?

try/except KeyboardInterrupt vs signal handler for SIGINT

2012-05-07 Thread Rafael Durán Castañeda
Hi, I was wondering which approach is better to stop several servers from just on python application when 'ctrl-c' is pressed, a try/except KeyboardInterrupt or just registering a SIGINT handler and exit when the signal is triggered. Any advantage/disadvantage from one approach over the other

Re: Can't get around HTTP/401 response using SUDS

2012-03-08 Thread Rafael Durán Castañeda
El 08/03/12 16:44, Adam Tauno Williams escribió: SUDS version 0.4 pn x86_64 Python 2.7 I'm having a bear of a time getting HTTP Basic Authentication to work for a SOAP request via suds. Also using an HTTP proxy server. In WireShark I just see a request - GET http://./services/services/JobS

Re: redis beginner question

2011-11-16 Thread Rafael Durán Castañeda
El 16/11/11 03:22, Jabba Laci escribió: Hi, I'm reading the redis documentation and there is one thing that bothers me. For redis, you need to start a server on localhost. Is there an easy way that my Python script starts this server automatically? Before using my script, I don't want to start r

Re: Use and usefulness of the as syntax

2011-11-12 Thread Rafael Durán Castañeda
El 12/11/11 13:43, Tim Chase escribió: I hate trying to track down variable-names if one did something like from Tkinter import * +1 -- http://mail.python.org/mailman/listinfo/python-list

Re: create a directory structure

2011-09-17 Thread Rafael Durán Castañeda
2011/9/16 Andrea Crotti > After some research, I think that paste-script is the best choice in this > case. > > I can define templates and I'll get my directory structure nicely populated > for me. > > -- > http://mail.python.org/**mailman/listinfo/python-list

Re: optionparse: how to add a line break to the help text

2011-09-10 Thread Rafael Durán Castañeda
On 10/09/11 22:43, Gelonida N wrote: I'm having a small question about optionparse. Normaly optionparser will format the help text according to the console's width. I just wondered if there is any way to insert a line breakk into an options help text. Example: from optparse import OptionParse

Re: How to structure packages

2011-09-07 Thread Rafael Durán Castañeda
Check python pep8: http://www.python.org/dev/peps/pep-0008/ And you will see than you shouldn't named modules as you did, so you should do something like: mypackage __init__.py mymodule ... mypackage.mymodule.MyClass On 07/09/11 18:11, John Gordon wrote: In<2a4f542c-a8c1-46c7-98

Re: same code to login,one is ok,another is not

2011-08-15 Thread Rafael Durán Castañeda
First one is using http and second one https, did you try an https handler? as I already pointed out to you in other thread with the same topic... Please don't spam the list, if you aren 't getting the answers you was looking for, wait for a while and then repost not just open threads until get th

Re: login with urllib2

2011-08-14 Thread Rafael Durán Castañeda
I'm not sure but you probably need using HTTPS handler, but without exact error code/message... On 14/08/11 16:50, 守株待兔 wrote: please to see my code: import urllib import urllib2 url = 'http://hi.baidu.com/' values = {'username' : '**','password' : '**' } data = urllib.urlencode(value

Re: How do I convert String into Date object

2011-08-13 Thread Rafael Durán Castañeda
You can use datetime objects: >>> dt1 = datetime.datetime.strptime('07/27/2011',"%m/%d/%Y") >>> dt2 =datetime.datetime.strptime('07/28/2011',"%m/%d/%Y") >>> dt1 == dt2 False >>> dt1 > dt2 False >>> dt1 < dt2 True >>> dt1 - dt2 datetime.timedelta(-1) On 13/08/11 21:26, MrPink wrote: I have file

Re: Restricted attribute writing

2011-08-07 Thread Rafael Durán Castañeda
The assert on Order should be an if ... raise, like OrderElement, sorry for the mistake and repost El 7 de agosto de 2011 18:53, Rafael Durán Castañeda < rafadurancastan...@gmail.com> escribió: > I think you might use a tuple instead of a list for OrderElement, that > would make much

Re: Restricted attribute writing

2011-08-07 Thread Rafael Durán Castañeda
I think you might use a tuple instead of a list for OrderElement, that would make much easier your code: class OrderElement(tuple): def __new__(cls, x, y): if not isinstance(x, int) or not isinstance(y, int): raise TypeError("Order element must receives two integers")

Re: How do I implement two decorators in Python both of which would eventually want to call the calling function

2011-08-06 Thread Rafael Durán Castañeda
You don't need doing something special, each decorator returns a new function that and only the result function formed by all decorators will be run. Consider this: def clear_cache(func): def decorator(*args, **kwargs): print "cache cleared" return func(*args, **kwargs)

Python ++ Operator?

2011-07-15 Thread Rafael Durán Castañeda
Hello all, I seem something like this on python code: for : for : spam[i][eggs] = ham ++i . . . What's the meaning of using i++? Even, does exist ++ operator in python? Bye -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I make a program automatically run once per day?

2011-07-10 Thread Rafael Durán Castañeda
On 10/07/11 04:01, John Salerno wrote: Thanks everyone! I probably should have said something like "Python, if possible and efficient, otherwise any other method" ! :) I'll look into the Task Scheduler. Thanks again! You may use Celery http://docs.celeryproject.org/en/latest/userguide/periodic-

Re: python logging

2011-05-19 Thread Rafael Durán Castañeda
You are right that behavior isn't documented and might be a bug. You could report it. Bye El 19 de mayo de 2011 00:42, Ian Kelly escribió: > 2011/5/18 Ian Kelly : > > Ah, that's it. I was using Python 2.5. Using 2.7 I get the same > > result that you do. > > > > Still, it's a surprising chang

Re: python logging

2011-05-18 Thread Rafael Durán Castañeda
On 19/05/11 00:10, Ian Kelly wrote: 2011/5/18 Rafael Durán Castañeda: I think you are confuse because of you are looking at advanced logging, where getLogger is being used. Simple logging works without any configuration, getLogger doesn't. It seems to work without any configuration ju

Re: python logging

2011-05-18 Thread Rafael Durán Castañeda
On 18/05/11 23:29, Ian Kelly wrote: 2011/5/18 Rafael Durán Castañeda: That's not exactly how it works. You can use logging without any configuration and the default output will be console. In addition default logging level is warning, so: logging.info("Some text") won'

Re: python logging

2011-05-18 Thread Rafael Durán Castañeda
On 18/05/11 03:09, Fei wrote: On May 17, 6:55 pm, Ian Kelly wrote: On Tue, May 17, 2011 at 2:55 PM, Fei wrote: where is default logging file on Mac? I saw lots of app just import logging, and begins to logging.info(...) etc. I'm not sure where to look at the logging configuration to figure o

Re: python logging

2011-05-17 Thread Rafael Durán Castañeda
On 17/05/11 22:55, Fei wrote: where is default logging file on Mac? I saw lots of app just import logging, and begins to logging.info(...) etc. I'm not sure where to look at the logging configuration to figure out the log location. I just get in touch of python about 1month ago, and I appreciat

Re: Python drawing library?

2011-05-15 Thread Rafael Durán Castañeda
On 15/05/11 01:01, OKB (not okblacke) wrote: Is there any Python library for interactive drawing? I've done some googling but most searches for "drawing" lead me to libraries for programmatic creation of shapes on some GUI canvas. I'm looking for GUI widgets that allow the user to draw

Re: Py / VNC Automation

2011-05-03 Thread Rafael Durán Castañeda
You can check this https://github.com/kanaka/noVNC 2011/5/3 Dan Stromberg > > On Mon, May 2, 2011 at 5:23 PM, PyNewbie wrote: > >> Hi, >> I'm looking for a python class or open source code that is tightly >> integrated with VNC protocols - any ideas? >> -- >> http://mail.python.org/mailman/list

Re: A question about Python Classes

2011-04-21 Thread Rafael Durán Castañeda
You did: >>> class BaseHandler: ... def foo(self): ... print "Hello" ... >>> class HomerHandler(BaseHandler): ... pass ... >>> test = HomerHandler() >>> test.foo() Hello >>> isinstance(test, BaseHandler) True >>> isinstance(test, HomerHandler) True >>> You could say test is a

Re: Signal on qt

2011-04-12 Thread Rafael Durán Castañeda
I don't know what are you trying with this for, but I think you may be connecting signal to a combo_test and after that changing combo_test, losing connection, but I'm not really sure. Anyway, this is a python list for PyQt (I think you are using it) you should ask in PyQt list. 2011/4/12 luca72

Re: How to re import a module

2011-04-08 Thread Rafael Durán Castañeda
That's really easy: >>> import re >>> reload(re) >>> In python2.x, but if you are using python3.x I think is different, really easy to know if you search in python docs. 2011/4/8 > Hello i want to know the best way to re import a module, because i have a > web server with just one Apache sess

Re: Amazon Simple Queue Service Worker

2011-04-07 Thread Rafael Durán Castañeda
I'm not sure about what you want to do, but you could check http://www.openstack.org/ web and look for ideas for using with Amazon. 2011/4/7 Joseph Ziegler > Hi all, > > Little new to the python world, please excuse the Noobness. > > We are writing a server which will subscribe to the Amazon Sim

Re: Converting an array of string to array of float

2011-03-25 Thread Rafael Durán Castañeda
But you must be sure that the list only contains objects than can be converted into float, if not you'll get: >>> float('something') Traceback (most recent call last): File "", line 1, in float('something') ValueError: could not convert string to float: something >>> 2011/3/25 Blockheads O

Re: Use cookies from a script in a browser

2011-03-21 Thread Rafael Durán Castañeda
I think thiscould help you 2011/3/18 gervaz > On 18 Mar, 22:52, Miki Tebeka wrote: > > You can use mechanize, which holds a cookie jar and can user the browser > cookies as w

Re: strange QLineEdit problem in PyQt

2011-03-16 Thread Rafael Durán Castañeda
Just one remark about this line: QtGui.QWidget.__init__(self, parent) I think you should use this: super(Contract, self).__init__(parent) so you will be following PEP 3135 2011/3/16 taco > taco wrote: > > ah, I solved it myself. for completeness reasons. I had upgraded python for > reportla

Re: Problem with python 3.2 and circular imports

2011-03-05 Thread Rafael Durán Castañeda
from subpackage2? 2011/3/4 Frank Millman > > On February 28 2011 Rafael Durán Castañeda wrote > > I'm stil totally stuck with relative imports, i' ve tried the example tree >> from PEP 328 without any result: >> >> package/ >> __init__.py >>

Re: question about endswith()

2011-03-03 Thread Rafael Durán Castañeda
I think you want do this: >>> files = ['file1.hdf', 'file2.hdf', 'file3.hdf5','file4.hdf'] >>> print(''.join(x for x in files if x.endswith('5'))) file3.hdf5 >>> But if you need to use it later: >>> file_hdf5 = [x for x in files if x.endswith('5')] >>> file_hdf5 ['file3.hdf5'] >>> 2011/3/4 Gra

Re: Problem with python 3.2 and circular imports

2011-02-28 Thread Rafael Durán Castañeda
I'm stil totally stuck with relative imports, i' ve tried the example tree from PEP 328 without any result: package/ __init__.py subpackage1/ __init__.py moduleX.py moduleY.py subpackage2/ __init__.py moduleZ.py moduleA.py Assuming that the