Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
2012/12/11 Dennis Lee Bieber : > On Tue, 11 Dec 2012 10:34:23 -0300, peter declaimed > the following in gmane.comp.python.general: > >> >> stderrfile = '%s/error.log' % os.getcwd() >> stdoutfile = '%s/out.log' % os.getcwd() >> > Ouch... > > stdoutfile = os.path.join(os.getcwd(), "o

running multiple django/bottle instances

2013-01-03 Thread Andrea Crotti
I'm working on a quite complex web app that uses django and bottle (bottle for the API which is also restful). Before I came they started to use a staging server to be able to try out things properly before they get published, but now we would like to have the possibility to see multiple branches

Re: running multiple django/bottle instances

2013-01-07 Thread andrea crotti
che, your problem > is actually not Python related. > If you want to run your applications on different ports, take a look on e.g. > Apaches virtual host configurations. > http://httpd.apache.org/docs/2.2/vhosts/examples.html > > Am 03.01.2013 17:35, schrieb Andrea Crotti: > &

Re: while True or while 1

2012-01-23 Thread Andrea Crotti
On 01/23/2012 06:05 PM, Evan Driscoll wrote: To play devil's advocate for a moment, if you have the choice between two ways of writing something, A and B, where both are basically the same in terms of difficulty to write, difficulty to maintain, and difficulty to understand, but A is faster t

windows and home path

2012-01-24 Thread Andrea Crotti
Window never stops to surprise me, I've been banging my head since yesterday and only now I now what is the problem. So suppose I have something like from os import path print path.expanduser('~') If I run it from cmd.exe I get /Users/user, doing the same in an emacs eshell buffer I get /Use

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-24 Thread Andrea Crotti
I suggest to create English 2.0, and convince the whole world to speak your own way better implementation of English. -- http://mail.python.org/mailman/listinfo/python-list

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:05 PM, Jerry Hill wrote: The os.path.exanduser() docs ( http://docs.python.org/library/os.path.html#os.path.expanduser ) say that "On Windows, HOME and USERPROFILE will be used if set, otherwise a combination of HOMEPATH and HOMEDRIVE will be used. An initial ~user is handled by

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:09 PM, Jerry Hill wrote: On Tue, Jan 24, 2012 at 11:05 AM, Jerry Hill wrote: So, my guess is that emacs is mangling your HOME environment variable. That appears to be confirmed by the emacs documentation here: http://www.gnu.org/software/emacs/manual/html_node/emacs/General-V

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:09 PM, Jerry Hill wrote: On Tue, Jan 24, 2012 at 11:05 AM, Jerry Hill wrote: So, my guess is that emacs is mangling your HOME environment variable. That appears to be confirmed by the emacs documentation here: http://www.gnu.org/software/emacs/manual/html_node/emacs/General-V

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:21 PM, Jerry Hill wrote: windows might make the trick.. It would not do the trick on my windows XP workstation here. Your target environments may be different, of course. From a general command prompt (cmd.exe) on my work machine, here's what you would have to work with: HOME

Re: windows and home path

2012-01-24 Thread Andrea Crotti
On 01/24/2012 04:43 PM, Chris Angelico wrote: On Wed, Jan 25, 2012 at 3:36 AM, Andrea Crotti wrote: I just would like to be able to write somewhere in a place that should always exist, why Windows you're so annoying :(? Can you use the current directory, and rely on the user running

running in a virtualenv

2012-01-26 Thread Andrea Crotti
I have a python script which has to run some other code and to separate the different projects I'm using virtualenv. What my this script does is: - check if the virtualenv exists already, otherwise create it with virtualenv.create_environment(venv_path, site_packages=True,

profiling the evolution

2012-01-26 Thread Andrea Crotti
I am doing some analysis of profiling results and I use gprof2dot to generate nice graphs. Now I was thinking, wouldn't it be great to have a way to get a nice report that summarizes the evolution of my code. For example given two versions : version 1: func1: 10 seconds func2: 20 seconds ver

Re: Weird newbie question

2012-01-26 Thread Andrea Crotti
On 01/26/2012 10:05 PM, Matty Sarro wrote: Hey everyone. I'm running into a funky error as I work through "Learn Python the Hard Way." What's weird is both idle and the python interpreter in idle spit out an error about syntax, but when I run the same script from the command line it works just fi

Re: parse binary file

2012-01-29 Thread Andrea Crotti
On 01/29/2012 07:51 AM, contro opinion wrote: please download the attachment ,and put in c:\test.data Your program should never use hard-coded path, and actually I think the majority here is not using windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Andrea Crotti
On 01/30/2012 09:30 PM, Roy Smith wrote: Every so often (typically when refactoring), I'll remove a .py file and forget to remove the corresponding .pyc file. If I then import the module, python finds the orphaned .pyc and happily imports it. Usually leading to confusing and hard to debug fa

Debugging / profiling subscripts

2012-01-31 Thread Andrea Crotti
If for example I have a Python script which for some reasons needs to run another Python script as a subprocess, is there a way to debug / profile it? If I add an import pdb; pdb.set_trace() In my specific case I am running a program that, under certain conditions, has to restart from scratch, d

configobj

2012-01-31 Thread Andrea Crotti
I have a couple of questions about configobj, which I'm happily trying to use for this project. The first question is, how do I make a very long list of things? Suppose I have declared in a spec file. val = string_list now I would like to do val = one, two, three but that's not all

Re: configobj

2012-02-01 Thread Andrea Crotti
On 02/01/2012 12:21 AM, Terry Reedy wrote: On 1/31/2012 11:06 AM, Andrea Crotti wrote: I have a couple of questions about configobj, which I'm happily trying to use for this project. When asking about 3rd party modules, please include a url, so we can be sure of what you mean and even t

changing sys.path

2012-02-01 Thread Andrea Crotti
So suppose I want to modify the sys.path on the fly before running some code which imports from one of the modules added. at run time I do sys.path.extend(paths_to_add) but it still doesn't work and I get an import error. If I take these paths and add them to site-packages/my_paths.pth everythi

Re: Installing pypi package twice

2012-02-01 Thread Andrea Crotti
On 02/01/2012 04:49 PM, Hans Mulder wrote: How about (in another directory): $ tar xzf package.tar.gz $ cd package $ /opt/python/bin/python setup.py build $ sudo /opt/python/bin/python setup.py install This assumes that /opt/python/bin/python is your python3.2 executable. You may want to inse

Re: changing sys.path

2012-02-01 Thread Andrea Crotti
On 02/01/2012 05:13 PM, Eric Snow wrote: On Wed, Feb 1, 2012 at 9:15 AM, Andrea Crotti wrote: So suppose I want to modify the sys.path on the fly before running some code which imports from one of the modules added. at run time I do sys.path.extend(paths_to_add) but it still doesn't wor

Re: changing sys.path

2012-02-02 Thread Andrea Crotti
On 02/02/2012 12:51 AM, Steven D'Aprano wrote: On Wed, 01 Feb 2012 17:47:22 +0000, Andrea Crotti wrote: Yes they are exactly the same, because in that file I just write exactly the same list, but when modifying it at run-time it doesn't work, while if at the application start the

Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread andrea crotti
2012/2/2 Amirouche Boubekki : > They are solution to write Python code that translates to javascript see > this thread > http://mail.python.org/pipermail/python-list/2011-November/1283110.html > Mm I don't think it's what the OP is asking (unless I misunderstood...). I think he wants to compile so

Re: SnakeScript? (CoffeeScript for Python)

2012-02-03 Thread andrea crotti
2012/2/3 Dennis Lee Bieber : > On Thu, 2 Feb 2012 18:19:22 -0700, Ian Kelly >         > >        I spent nearly 20 years having to maintain the /output/ of such a > translator. > Yes I think that is the point, if the code you maintain and the code which you have to debug differ because there is a

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
I think I finally located the issue with the sys.path extension. The problem is that I have many namespace directories, for example lib: - sub1 - sub2 lib: - sub3 - sub4 But to have everything working I had lib.sub3 in easy-install.pth. Now if I try to add something else to the path it d

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
Ok now it's getting really confusing, I tried a small example to see what is the real behaviour, so I created some package namespaces (where the __init__.py declare the namespace package). /home/andrea/test_ns: total used in directory 12 available 5655372 drwxr-xr-x 3 andrea andrea 4096 F

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
On 02/10/2012 03:06 PM, Dave Angel wrote: Yes, you've got periods in your directory names. A period means something special within python, and specifically within the import. When you say from a.c import api You're telling it:from package a get module c, and from there impoort the sy

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
On 02/10/2012 03:27 PM, Peter Otten wrote: The package a will be either a.c/a/ or a.b/a/ depending on whether a.c/ or a.b/ appears first in sys.path. If it's a.c/a, that does not contain a c submodule or subpackage. I would agree if I didn't have this declaration __import__('pkg_resources').

Re: changing sys.path

2012-02-10 Thread Andrea Crotti
On 02/10/2012 04:00 PM, Peter Otten wrote: Sorry, you didn't mention that in the post I responded to and I didn't follow the thread closely. I found a description for declare_namespace() at http://peak.telecommunity.com/DevCenter/PkgResources but the text explaining the function is completely u

atexit.register in case of errors

2012-02-15 Thread Andrea Crotti
I have the following very simplified situation from atexit import register def goodbye(): print("saying goodbye") def main(): while True: var = raw_input("read something") if __name__ == '__main__': register(goodbye) main() But in my case the "goodbye" function is

Re: atexit.register in case of errors

2012-02-15 Thread Andrea Crotti
On 02/15/2012 01:52 PM, Devin Jeanpierre wrote: On Wed, Feb 15, 2012 at 8:33 AM, Mel Wilson wrote: The usual way to do what you're asking is if __name__ == '__main__': main() goodbye() and write main so that it returns after it's done all the things it's supposed to do. If you've spr

Re: atexit.register in case of errors

2012-02-15 Thread Andrea Crotti
On 02/15/2012 03:18 PM, Thomas Rachel wrote: Wouldn't if __name__ == '__main__': try: main() finally: goodbye() be even better? Or doesn't it work well together with SystemExit? Thomas Well in that case goodbye is always called, even if I have some other nasty exce

Re: paper submission and versioning system - advice?

2012-02-20 Thread Andrea Crotti
On 02/20/2012 05:45 PM, Brian Blais wrote: Hello, I'd like to find a web-based system to help a committee I'm on, where we receive proposals from different faculty. I wrote something in python, from scratch, a number of years ago because there wasn't anything available then but it is showing

windows executable calling python script

2012-02-27 Thread Andrea Crotti
I am creating an installer for python projects, using CMake and NSIS. Now my goal is to be able to select at installer time the python executable that will run that project, and then associate them. I saw that setuptools is able to generate exe wrappers, but how does that work exactly? From w

Re: windows executable calling python script

2012-02-27 Thread Andrea Crotti
On 02/27/2012 01:57 PM, Andrea Crotti wrote: I am creating an installer for python projects, using CMake and NSIS. Now my goal is to be able to select at installer time the python executable that will run that project, and then associate them. I saw that setuptools is able to generate exe

Re: windows executable calling python script

2012-02-27 Thread Andrea Crotti
On 02/27/2012 02:21 PM, Andrea Crotti wrote: At the moment I ended up with something like this: #include #include #include #include // the function takes as arguments only the python interpreter full path int main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, &qu

check if directory is writable in a portable way

2012-02-28 Thread Andrea Crotti
How should I check if I can create files in a directory? I tried to simply check if the directory is writeable with this function: def is_writable(name): """Return true if the file is writable from the current user """ return os.access(name, os.W_OK) but that doesn't work at all on

Re: check if directory is writable in a portable way

2012-02-28 Thread Andrea Crotti
On 02/28/2012 11:34 AM, Tim Chase wrote: On 02/28/12 04:07, Andrea Crotti wrote: How should I check if I can create files in a directory? So maybe the only solution that works is something like try: open(path.join('temp', 'w')) except OsError: return False e

suppressing argparse arguments in the help

2012-02-28 Thread Andrea Crotti
I have a script that might be used interactively but also has some arguments that should not be used by "normal" users. So I just want to suppress them from the help. I've read somewhere that the help=SUPPRESS should do what I want: parser.add_argument('-n', '--test_only',

Re: suppressing argparse arguments in the help

2012-02-28 Thread Andrea Crotti
On 02/28/2012 04:02 PM, Peter Otten wrote: Andrea Crotti wrote: I have a script that might be used interactively but also has some arguments that should not be used by "normal" users. So I just want to suppress them from the help. I've read somewhere that the help=SUPPRESS s

avoid import short-circuiting

2012-03-16 Thread Andrea Crotti
I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an import hook. It works quite well for small examples but the main problem is that once a module is imported it's added to sys.

Re: avoid import short-circuiting

2012-03-16 Thread Andrea Crotti
On 03/16/2012 05:19 PM, Robert Kern wrote: On 3/16/12 4:49 PM, Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an import hook. It works quite well for

Re: avoid import short-circuiting

2012-03-16 Thread Andrea Crotti
On 03/16/2012 10:20 PM, Robert Kern wrote: On 3/16/12 10:04 PM, Andrea Crotti wrote: On 03/16/2012 05:19 PM, Robert Kern wrote: On 3/16/12 4:49 PM, Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what

Unittest2 on python 2.6

2012-03-18 Thread Andrea Crotti
Suppose we want to use the unittest from Python 2.7, but also want to support Python 2.6, what is the best way to do it? The solution used now is to have in setup.py if sys.version < '2.7': tests_require.append('unittest2') and then in every test file try: import unittest2 as unittes

Re: Unittest2 on python 2.6

2012-03-18 Thread Andrea Crotti
On 03/18/2012 03:46 PM, Terry Reedy wrote: 1. If the difference between unittest and unittest2 is strictly a matter of deletions and addition, replace unittest with the union of the two. 2. Put the try/except dance in a compat file. Then everywhere else 'from compat import unittest'. This ide

configobj validation

2012-03-19 Thread Andrea Crotti
I seemed to remember that type validation and type conversion worked out of the box, but now I can't get it working anymore. Shouldn't this simple example actually fail the parsing (instead it parses perfectly port to a string)? sample.py: from configobj import ConfigObj conf = ConfigObj('sa

Re: configobj validation

2012-03-19 Thread Andrea Crotti
On 03/19/2012 12:59 PM, Andrea Crotti wrote: I seemed to remember that type validation and type conversion worked out of the box, but now I can't get it working anymore. Shouldn't this simple example actually fail the parsing (instead it parses perfectly port to a string)? sampl

pypi and dependencies

2012-03-19 Thread Andrea Crotti
When I publish something on Pypi, is there a way to make it fetch the list of dependencies needed by my project automatically? It would be nice to have it in the Pypi page, without having to look at the actual code.. Any other possible solution? -- http://mail.python.org/mailman/listinfo/pytho

Re: pypi and dependencies

2012-03-20 Thread Andrea Crotti
On 03/20/2012 11:18 AM, Ben Finney wrote: Andrea Crotti writes: When I publish something on Pypi, is there a way to make it fetch the list of dependencies needed by my project automatically? It would be nice to have it in the Pypi page, without having to look at the actual code.. Sadly, no

Re: pypi and dependencies

2012-03-21 Thread Andrea Crotti
On 03/21/2012 11:38 AM, Diez B. Roggisch wrote: Andrea Crotti writes: When I publish something on Pypi, is there a way to make it fetch the list of dependencies needed by my project automatically? It would be nice to have it in the Pypi page, without having to look at the actual code.. Any

Re: configobj validation

2012-03-21 Thread Andrea Crotti
On 03/21/2012 11:40 AM, Diez B. Roggisch wrote: Andrea Crotti writes: It works - so why do you bother? And I'm not sure about the above code - AFAIK, validation is a two-step thing: http://www.voidspace.org.uk/python/articles/configobj.shtml#validation Diez I don't agree, if you

Re: Python classes: Simplify?

2012-03-22 Thread Andrea Crotti
On 03/22/2012 10:51 AM, Steven Lehar wrote: It seems to me that the Python class system is needlessly confusing. Am I missing something? For example in the class Complex given in the documentation *class Complex:* *def __init__(self, realpart, imagpart):* *self.r = realpart* *

Re: is this foolish?

2012-04-12 Thread Andrea Crotti
On 04/12/2012 10:35 AM, Cameron Simpson wrote: I've found myself using a Python gotcha as a feature. I've got a budding mail filter program which keeps rule state in a little class instance. Slightly paraphrased: class RuleState(object): def __init__(self, M, maildb_path, maildirs

validating XML

2012-06-13 Thread andrea crotti
Hello Python friends, I have to validate some xml files against some xsd schema files, but I can't use any cool library as libxml unfortunately. A Python-only validator might be also fine, but all the projects I've seen are partial or seem dead.. So since we define the schema ourselves, I was all

Re: validating XML

2012-06-13 Thread andrea crotti
So as far as I understood what I should do is the following. Go through my own XML keeping track of the full path of everything for example and so on, then for every entry found in this iteration, check the schema to make sure that that particular construct is allowed on that level of the tree

Re: validating XML

2012-06-14 Thread andrea crotti
2012/6/13 Stefan Behnel > andrea crotti, 13.06.2012 12:06: > > Hello Python friends, I have to validate some xml files against some xsd > > schema files, but I can't use any cool library as libxml unfortunately. > > Any reason for that? Because the canonical answer

Re: Emacs Python indention

2011-06-12 Thread Andrea Crotti
Bastian Ballmann writes: > Hi Emacs / Python coders, > > moving a region of python code for more than one indention in Emacs is > quite annoying, cause the python-shift-left and -right functions always > loose the mark and one has to reactivate it with \C-x \C-x or > guess how many indentions one

Re: parsing a file for analysis

2011-02-26 Thread Andrea Crotti
Il giorno 26/feb/2011, alle ore 06.45, Rita ha scritto: > I have a large text (4GB) which I am parsing. > > I am reading the file to collect stats on certain items. > > My approach has been simple, > > for row in open(file): > if "INFO" in row: > line=row.split() > user=line[0] >

Re: I am not able to open IDLE in python on Vista.

2011-03-01 Thread Andrea Crotti
Jayneil Dalal writes: > This is the error message I get when I try to run Pyhon on Vista: > > unable to create user config directory > C:\Users\Jayneil\.idlerc > Check path and permissions. > Exiting! > > So please help me out!. > > Thank you. Best solution would be to avoid Windows Vista. If th

why memoizing is faster

2011-03-24 Thread Andrea Crotti
I was showing a nice memoize decorator to a friend using the classic fibonacci problem. --8<---cut here---start->8--- def memoize(f, cache={}): def g(*args, **kwargs): # first must create a key to store the arguments called # it's for

Re: why memoizing is faster

2011-03-25 Thread Andrea Crotti
Terry Reedy writes: > > For the reason Stefan explained and hinted above. Try the following instead: > > def fib_iter(n, _cache = [1,1]): > k = len(_cache) > if n >= k: > for i in range(k, n+1): >_cache.append(_cache[i-2] + _cache[i-1]) > return _cache[n] > > This should be sligh

Re: why memoizing is faster

2011-03-25 Thread Andrea Crotti
"eryksun ()" writes: > > Regarding this I have question about function attributes. Is there an > equivalent of 'self' for functions? I've seen people use function > attributes as local static variables, but this seems problematic when > all you have is a global reference to the function. The orig

Re: why memoizing is faster

2011-03-25 Thread Andrea Crotti
"eryksun ()" writes: > See Pep 232: http://www.python.org/dev/peps/pep-0232 > > Also, see the discussion thread on Python-Dev: > > http://mail.python.org/pipermail/python-dev/2000-April/thread.html#3282 > > I don't think self-referenced static variables (as in C's "static" > declaration) are discu

jump to C definition

2011-03-25 Thread Andrea Crotti
While I use emacs, if it knows where the source code is, I can very easily jump to a function definition even if it's in C. I think it would be nice to have something like this also for python, at least to make it easy to explore the code and learn something new, without digging too much into the

Re: why memoizing is faster

2011-03-26 Thread Andrea Crotti
Stefan Behnel writes: > > Not "restarted" in the sense that it gets cleaned up, though. The > above simply passes an explicit value for it that will be used for the > single call. Future calls won't be affected. > > Stefan About this global caching thing I thought, but isn't this a source of poss

Re: Why aren't copy and deepcopy in __builtins__?

2011-03-28 Thread Andrea Crotti
John Ladasky writes: > Simple question. I use these functions much more frequently than many > others which are included in __builtins__. I don't know if my > programming needs are atypical, but my experience has led me to wonder > why I have to import these functions. I almost never use them

design question

2011-04-10 Thread Andrea Crotti
I've been wondering for weeks now how to do but I still didn't get a satisfying answer, so I hope someone can give a hint... I have some logs which I extract from simulation results. These logs are in the form timestamp, nodeid, eventname, event_argument and now I have to analyze the data. I don

Re: OOP only in modules

2011-04-10 Thread Andrea Crotti
newpyth writes: > Hi all, > from the subject of my post, you can see I do not > like very much OOP... and I am not the only one... > Knowing that python is intrinsecally OO, I propose > to move all OOP stuff (classes, instances and so on) > to modules. > In this way the OOP fan can keep on using

Re: design question

2011-04-10 Thread Andrea Crotti
Andrea Crotti writes: [...] I left the Timeline as before, but tried to rewrite some more classes. This is the abstract class for a metric, and below another class for the metric which involve only counting things. In the end an example on how to use this. I need to see synthetic values during

Re: OOP only in modules

2011-04-10 Thread Andrea Crotti
newpyth writes: [...] > My main goal is to arrange OO in a paradigmatic manner in order to > apply to it the > procedural scheme. especially to the caller or called modules. > Bye. I have some troubles understanding what you mean. Can you write an example of code that it's for you annoying and

Re: OOP only in modules

2011-04-12 Thread Andrea Crotti
newpyth writes: > Hi Andrea, > excuse my beeing criptic (you wrote: "I have some troubles > understanding what you mean") but I coudn't to go on too long. > Now I can conclude my speech... > When I was younger I transformed a big Clipper program in > simil-C in order to apply cflow... and I succe

Re: file deleted

2011-04-13 Thread Andrea Crotti
luca72 writes: > hello i'm working with eric, running a program eric crash and when i > try to open my project again with eric i see that myproject.py is > deleted, but my project is still running there is a way to find > myprogram.py file aving it in execution? It's more about your operating sy

Re: split string but ignore sep inside double quotes

2011-04-13 Thread Andrea Crotti
Jonno writes: > All, > > I have the following unicode object: > u'3,"Some, text",more text' > > and I want to split it into a list like this: > [3,"Some, text", more text] > > In other words I want to split on the comma but not if it's inside a > double-quote. > > Thanks. I'm not sure how but al

Re: split string but ignore sep inside double quotes

2011-04-13 Thread Andrea Crotti
Andrea Crotti writes: > > I'm not sure how but also this seems to work: > In[20]: s = '2,"some, text",more text' > > In [21]: re.split(r'(?<=">),', s) > Out[21]: ['2,"some, text",more text'] > > I just want

Re: automated pep8 reformatter ?

2011-04-14 Thread Andrea Crotti
James Mills writes: > Does anyone know of a tool that will help with > reformatting badly written code to be pep8 compliant ? > > a 2to3 for pep8 ? > What I daily and with great happiness use is flymake-mode in emacs. Combined with pylint, pep8 and pychecker I can see while I'm programming all t

Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
Alec Taylor writes: > Good Afternoon, > > I'm looking for an IDE which offers syntax-highlighting, > code-completion, tabs, an embedded interpreter and which is portable > (for running from USB on Windows). > > Here's a mockup of the app I'm looking for: http://i52.tinypic.com/2uojswz.png > > Whi

Re: Can Python control Thuderbird?

2011-04-16 Thread Andrea Crotti
marceepoo writes: > I want to control Mozilla Thunderbird using Python. > Does anyone know if that is that possible? > I would like to use Python to save email attachments to a specific > directory, depending on the name of the sender, content in the email, > etc.--- and to rename the attachment

Re: [Q] ipython: Multiple commands on the same line and newlines

2011-04-16 Thread Andrea Crotti
Phil Winder writes: > Hi, > I'm having a go at using ipython as a command prompt for data > analysis. Coming from Matlab, I'm used to typing multiple commands on > the same line then using the up arrow to go through my history. > How can I write multiple python commands on the same line? > E.g. "

Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
Chris Angelico writes: > Based on the comments here, it seems that emacs would have to be the > editor-in-chief for programmers. I currently use SciTE at work; is it > reasonable to, effectively, bill my employer for the time it'll take > me to learn emacs? I'm using a lot of the same features th

Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
Chris Angelico writes: > Sure, that was a *slight* exaggeration :) but thanks for the advice. > I'll poke around with it some time. > > ChrisA I also suggest to take a look here, there's a quite nice environment setup for python. https://github.com/gabrielelanaro/emacs-for-python The nice thing

Re: Python IDE/text-editor

2011-04-16 Thread Andrea Crotti
rusi writes: > > It takes a day or two to learn emacs. > > It takes forever to set it up. > > [How many shots of cocaine are are needed to de-addict a cocaine > addict? ] Not to set it up, but surely to master it. There are also many people that didn't really learn elisp but still use emacs taki

Re: ipython: Multiple commands on the same line and newlines

2011-04-17 Thread Andrea Crotti
Phil Winder writes: > Yes, that does not produce an error, but it does not "work". Please > refer to my first post. Try the first code, you will get a syntax > error. Placing things on one line makes for easy history scrollback. > In your version you will have 2 lines of history for the x = 0 ter

Re: Python IDE/text-editor

2011-04-17 Thread Andrea Crotti
Ben Finney writes: > As many others in this thread have said, the learning curve pays off in > access to a powerful general-purpose tool that you can apply to an > enormous range of programming tasks. > > A reason Vim and Emacs survive while so many thousands of other options > rise and fall and

Re: Python IDE/text-editor

2011-04-18 Thread Andrea Crotti
Alec Taylor writes: > > Emacs and vim still seem like good alternatives, when I get the time. > However, currently have 3 assignments to start and finish so would > like a simple Notepad2 with python interpreter attached (and keyboard > shortcut to run script) type program. > > Please continue rec

Re: Need Assistance on this program.

2011-05-12 Thread Andrea Crotti
vijay swaminathan writes: > Hi All, > > I'm new bie to python thread programming and would like to assistance > on the attached code. > > In this, I'm calling a thread to invoke a command prompt and would > like to print the "Thread as alive" as long as the command prompt is > opened and would li

Re: Slice implementation bug

2011-05-12 Thread Andrea Crotti
Tambet writes: > Hello! > > Let's say slice is multidimensional now - how to interpret it? > But who said that slice is multidimensional in the first place? Since python is not matlab I don't think it will ever be done, so what's the purpose of talking about a bug in something that doesn't exis

Re: Archives and magic bytes

2005-03-26 Thread andrea crotti
> Perhaps this is mostly a reflection on me as a programmer :-} but I > found the job surprisingly tricky. No I think you're right... It's not very important for me retrieve exactly what kind of file it is, it could be just something more in my little program (an organizer that put files in the rig

Re: how to avoid spaghetti in Python?

2014-01-21 Thread andrea crotti
2014/1/21 CM : > I've been learning and using Python for a number of years now but never > really go particularly disciplined about all good coding practices. I've > definitely learned *some*, but I'm hoping this year to take a good step up in > terms of refactoring, maintainability, and mostly

generator slides review

2014-02-01 Thread andrea crotti
I'm giving a talk tomorrow @Fosdem about generators/iterators/iterables.. The slides are here (forgive the strange Chinese characters): https://dl.dropboxusercontent.com/u/3183120/talks/generators/index.html#3 and the code I'm using is: https://github.com/AndreaCrotti/generators/blob/master/code/

Re: generator slides review

2014-02-02 Thread andrea crotti
2014-02-02 Terry Reedy : > On 2/1/2014 9:12 AM, andrea crotti wrote: > > Comments: > > The use is assert in the first slide seem bad in a couple of different > respects. > Why is it bad? It's probably not necessary but since we ask for a range it might be good to c

Re: generator slides review

2014-02-02 Thread andrea crotti
2014-02-01 Miki Tebeka : > > My 2 cents: > > slide 4: > [i*2 for i in range(10)] > Well this is not correct in theory because the end should be the max number, not the number of elements. So it should be [i*2 for i in range(10/2)] which might be fine but it's not really more clear imho.. > slide

Re: generator slides review

2014-02-02 Thread andrea crotti
The slides are updated now 2014-02-02 andrea crotti : > 2014-02-01 Miki Tebeka : >> >> My 2 cents: >> >> slide 4: >> [i*2 for i in range(10)] >> > > Well this is not correct in theory because the end should be the max > number, not the number of e

Re: generator slides review

2014-02-02 Thread andrea crotti
which explain things, to tell a clear story in a way 2014-02-02 andrea crotti : > The slides are updated now > > 2014-02-02 andrea crotti : >> 2014-02-01 Miki Tebeka : >>> >>> My 2 cents: >>> >>> slide 4: >>> [i*2 for i in range(10)]

Re: generator slides review

2014-02-02 Thread andrea crotti
Thanks everyone for your feedback. The talk I think went well, maybe I was too fast because I only used 21 minutes. >From the audience feedback, there were some questions about my "Buggy code" example, so yes probably it's not a good example since it's too artificial. I'll have to find something

Re: generator slides review and Python doc (+/- text bug)

2014-02-03 Thread andrea crotti
2014-02-03 : > generator slides review and Python doc > > > I do not know what tool is used to produce such > slides. > > When the mouse is over a a text like a title ( ... <\H*> ???) > the text get transformed and a colored eol is appearing. > > Example with the slide #3: > > Even numbers > becom

Re: generator slides review

2014-02-03 Thread andrea crotti
2014-02-03 Terry Reedy : > On 2/2/2014 5:40 AM, andrea crotti wrote: >> > In general, use assert (== AssertionError) to check program logic (should > never raise). Remember that assert can be optimized away. Use other > exceptions to check user behavior. So I believe

Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))

2014-02-04 Thread andrea crotti
2014-02-04 : > Le mardi 4 février 2014 15:39:54 UTC+1, Jerry Hill a écrit : > > Useless and really ugly. > I think this whole discussion is rather useless instead, why do you care since you're not going to use this tool anyway? -- https://mail.python.org/mailman/listinfo/python-list

lxml tostring quoting too much

2013-08-06 Thread andrea crotti
I would really like to do the following: from lxml import etree as ET from lxml.builder import E url = "http://something?x=10&y=20"; l = E.link(url) ET.tostring(l) -> "http://something?x=10&y=20" However the lxml tostring always quotes the &, I can't find a way to tell it to avoid quoting it. Is

Re: lxml tostring quoting too much

2013-08-07 Thread andrea crotti
2013/8/6 Chris Down : > On 2013-08-06 18:38, andrea crotti wrote: >> I would really like to do the following: >> >> from lxml import etree as ET >> from lxml.builder import E >> >> url = "http://something?x=10&y=20"; >> l = E

<    1   2   3   4   >