Re: Edit Python code programmatically

2008-02-09 Thread Benjamin
On Feb 9, 5:47 am, Guilherme Polo [EMAIL PROTECTED] wrote: 2008/2/9, Alex [EMAIL PROTECTED]: Which library could you recommend to perform simple editing of Python code (from Python program)? For example, open *.py file, find specific function definition, add another function call inside,

Re: Passing a callable object to Thread

2008-02-15 Thread Benjamin
On Feb 15, 6:51 pm, skawaii [EMAIL PROTECTED] wrote: On Feb 15, 7:23 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: t = th.Thread(target=tribalwars.populate_all_tribes, args=(data/w7/,)) Thanks, that did it. After playing around in the interpreter a bit, I realize now that args=(data/w7/)

Re: Passing a callable object to Thread

2008-02-16 Thread Benjamin
On Feb 15, 9:31 pm, Carsten Haese [EMAIL PROTECTED] wrote: On Fri, 2008-02-15 at 19:21 -0800, Benjamin wrote: You could type args=tuple(data/w7/). That will produce an 8-tuple containing single-character strings, not a 1-tuple containing one string. Opps. That iterable thing of string gets

flattening a dict

2008-02-16 Thread Benjamin
How would I go about flattening a dict with many nested dicts within? The dicts might look like this: {mays : {eggs : spam}, jam : {soda : {love : dump}}, lamba : 23 } I'd like it to put / inbetween the dicts to make it a one dimensional dict and look like this: {mays/eggs : spam, jam/soda/love :

Re: flattening a dict

2008-02-21 Thread Benjamin
On Feb 17, 6:18 am, Terry Jones [EMAIL PROTECTED] wrote: Hi Arnaud Benjamin Here's a version that's a bit more general. It handles keys whose values are empty dicts (assigning None to the value in the result), and also dict keys that are not strings (see the test data below). It's also less

Re: flattening a dict

2008-02-21 Thread Benjamin
On Feb 21, 9:13 pm, George Sakkis [EMAIL PROTECTED] wrote: On Feb 21, 8:04 pm, Benjamin [EMAIL PROTECTED] wrote: On Feb 17, 6:18 am, Terry Jones [EMAIL PROTECTED] wrote: Hi Arnaud Benjamin Here's a version that's a bit more general. It handles keys whose values are empty dicts

Re: Permission to use Mac OS 'rocketship' dock icon?

2008-02-28 Thread Benjamin
On Feb 28, 3:37 pm, Anand Patil [EMAIL PROTECTED] wrote: Hi all, The image of a rocket with the Python logo that occasionally shows up in the dock would make part of a nice logo for PyMC, an open-source Python Bayesian statistics package. Anyone know who we would have to ask to get

Re: metaclasses

2008-03-03 Thread Benjamin
On Mar 3, 7:12 pm, [EMAIL PROTECTED] wrote: What are metaclasses? Depends on whether you want to be confused or not. If you do, look at this old but still head bursting essay: http://www.python.org/doc/essays/metaclasses/. Basically, the metaclass of a (new-style) class is responsible for

Re: execute

2008-03-09 Thread Benjamin
On Mar 9, 4:22 pm, Gif [EMAIL PROTECTED] wrote: i'm trying to execute a file without replacing the current process, but after searching the help file, documentations and the web, i can't a way of doing that. os.exec*() will close the current program. Have a look at the subprocess module.

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Benjamin
On Mar 10, 2:11 pm, Stefan Behnel [EMAIL PROTECTED] wrote: Malcolm Greene wrote: My personal experience with wxPython has its ups and downs. Specifically when it comes to crashes, I wouldn't bet my life on it. I'm new to Python and getting ready to build a small client based application

Re: os.path.isdir question

2008-03-15 Thread Benjamin
On Mar 15, 8:12 pm, lampshade [EMAIL PROTECTED] wrote: Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python import os my_path = os.path.expanduser(~/pictures/) print my_path results = os.listdir(my_path) for

Re: 'join' in the wrong word for the method in class Thread.

2008-03-15 Thread Benjamin
On Mar 15, 7:29 pm, [EMAIL PROTECTED] wrote: 'join' in the wrong word for the method in class Thread. The agent-patient semantics of calling functions can get ambiguous. It is not a problem of native Pythoners alone. Is it due to lazy programming, an inability of English (do you have it in

Re: os.path.isdir question

2008-03-16 Thread Benjamin
On Mar 16, 2:27 pm, MRAB [EMAIL PROTECTED] wrote: On Mar 16, 2:27 am, Benjamin [EMAIL PROTECTED] wrote: On Mar 15, 8:12 pm, lampshade [EMAIL PROTECTED] wrote: Hello, I'm having some problems with os.path.isdir I think it is something simple that I'm overlooking. #!/usr/bin/python

Re: Using threads in python is safe ?

2008-03-16 Thread Benjamin
On Mar 16, 3:40 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sat, 15 Mar 2008 11:57:44 -0200, Deepak Rokade [EMAIL PROTECTED] escribi�: I want to use therads in my application. Going through the docs , I read about GIL. Now I am confused whether using threads in python is safe or

Re: Is IronPython real Python?

2008-03-24 Thread Benjamin
On Mar 24, 12:00 pm, jmDesktop [EMAIL PROTECTED] wrote: I know that IronPython and CPython are different in that one does not use the .net framework, but are they both really the same Python language. From my basic understanding, it will depend on what the programmer's goal is as to which of

Re: Using QSystemTrayIcon with PyQt

2008-03-30 Thread Benjamin
On Mar 29, 11:02 pm, Alex Teiche [EMAIL PROTECTED] wrote: Hello, I am pretty new to Python, and have never learned C++. I am trying to implement the following thing into my python application: http://doc.trolltech.com/4.3/qsystemtrayicon.html Through PyQt. I have been using PyQt for

Re: Using QSystemTrayIcon with PyQt

2008-03-31 Thread Benjamin
On Mar 31, 8:41 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 6:40 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 11:49 am, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 30, 3:50 pm, Benjamin [EMAIL PROTECTED] wrote: On Mar 29, 11:02 pm, Alex Teiche [EMAIL PROTECTED] wrote

Re: Using QSystemTrayIcon with PyQt

2008-04-01 Thread Benjamin
On Apr 1, 7:56 am, BlueBird [EMAIL PROTECTED] wrote: On Apr 1, 6:00 am, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 7:53 pm, Benjamin [EMAIL PROTECTED] wrote: On Mar 31, 8:41 pm, Alex Teiche [EMAIL PROTECTED] wrote: On Mar 31, 6:40 pm, Alex Teiche [EMAIL PROTECTED] wrote

Re: Classes in modules

2008-04-02 Thread Benjamin
On Apr 2, 8:05 pm, [EMAIL PROTECTED] wrote: I'm trying to get this source code split into multiple files: http://pygermanwhist.googlecode.com/files/pygermanwhist.12.py I've been trying to make so that I have one class per file for easier readability. My problem is that the interpreter

Parsing HTML?

2008-04-02 Thread Benjamin
I'm trying to parse an HTML file. I want to retrieve all of the text inside a certain tag that I find with XPath. The DOM seems to make this available with the innerHTML element, but I haven't found a way to do it in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: How is GUI programming in Python?

2008-04-09 Thread Benjamin
On Apr 9, 8:54 pm, Chris Stewart [EMAIL PROTECTED] wrote: I've always had an interest in Python and would like to dabble in it further. I've worked on a few very small command line programs but nothing of any complexity. I'd like to build a really simple GUI app that will work across Mac,

Re: Module Conflicts

2008-04-09 Thread Benjamin
On Apr 9, 5:33 pm, Jose [EMAIL PROTECTED] wrote: I have a module named math.py in a package with some class definitions. I am trying to import the standard python math module inside of math.py but It seems to be importing itself. Is there any way around this problem without renaming my

Re: How to use my dynamic link libraries in python??

2008-04-10 Thread Benjamin
On Apr 10, 9:21 pm, 郭勇军 [EMAIL PROTECTED] wrote: Hello: My OS is Linux, I compile my dynamic link libraries , and want to call the function of my dynamic library through python! How can I realize the function? Please give me some advices! Thanks You have several options.

Re: Brand New!

2008-04-14 Thread Benjamin
On Apr 14, 9:00 pm, agent E 10 [EMAIL PROTECTED] wrote: Hi, I'm brand new to programming. Have any suggestions? I'm young. Was it a good idea to start with python? I was planning on creating a very simple program that asked yes/no questions for a school project. IMHO, Python is an excellent

Re: about the ';'

2008-04-14 Thread Benjamin
On Apr 13, 10:33 pm, Penny Y. [EMAIL PROTECTED] wrote: I saw many python programmers add a ';' at the end of each line. As good style, should or should not we do coding with that? Where did you see that? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Brand New!

2008-04-15 Thread Benjamin
On Apr 15, 6:37 pm, agent E 10 [EMAIL PROTECTED] wrote: On Apr 14, 8:37 pm, Benjamin [EMAIL PROTECTED] wrote: On Apr 14, 9:00 pm, agent E 10 [EMAIL PROTECTED] wrote:Hi, I'm brand new to programming. Have any suggestions? I'm young. Was it a good idea to start with python? I

Re: How is GUI programming in Python?

2008-04-15 Thread Benjamin
On Apr 15, 9:17 pm, [EMAIL PROTECTED] wrote: On 11 abr, 20:31, sturlamolden [EMAIL PROTECTED] wrote: On Apr 11, 5:01 am, Gabriel Genellina [EMAIL PROTECTED] wrote: Another annoying thing with the Qt license is that you have to choose it at the very start of the project. You cannot

Re: How to print a unicode string?

2008-04-18 Thread Benjamin
On Apr 18, 7:14 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: From what I've googled, I think I need to set my locale. Not on this operating system. On Windows, you need to change your console. If it is a cmd.exe-style console, use chcp. For IDLE, changing the output encoding is not

Re: Explicit variable declaration

2008-04-22 Thread Benjamin
On Apr 22, 7:39 pm, Filip Gruszczyński [EMAIL PROTECTED] wrote: Hello everyone! It is my first message on this list, therefore I would like to say hello to everyone. I am fourth year student of CS on the Univeristy of Warsaw and recently I have become very interested in dynamically typed

Re: Parsing HTML?

2008-04-26 Thread Benjamin
On Apr 3, 9:10 pm, 7stud [EMAIL PROTECTED] wrote: On Apr 3, 12:39 am, [EMAIL PROTECTED] wrote: BeautifulSoup does what I need it to.  Though, I was hoping to find something that would let me work with the DOM the way JavaScript can work with web browsers' implementations of the DOM.  

Re: Parsing HTML?

2008-04-26 Thread Benjamin
On Apr 6, 11:03 pm, Stefan Behnel [EMAIL PROTECTED] wrote: Benjamin wrote: I'm trying to parse an HTML file.  I want to retrieve all of the text inside a certain tag that I find with XPath.  The DOM seems to make this available with the innerHTML element, but I haven't found a way to do

Re: Are rank noobs tolerated, here?

2008-05-04 Thread Benjamin
On May 4, 6:45 pm, notbob [EMAIL PROTECTED] wrote: I'm trying to learn how to program. I'm using: How to Think Like a Computer Scientist Learning with Python 2nd Edition Am I likely to receive any help, here, or is there another irc, forum, etc, that might better serve a complete amateur

Re: Abstract Base Class register function

2008-09-27 Thread Benjamin
On Sep 27, 4:50 pm, Mikolai Fajer [EMAIL PROTECTED] wrote: I have been experimenting with the abc module in py3k and thought about using the register method of an ABC as a class decorator: code import abc class MyABC(metaclass=abc.ABCMeta):     pass @MyABC.register class MySub():    

Re: docstrings = RestructuredText = Sphinx = Nice html docs (?)

2008-10-01 Thread Benjamin
On Oct 1, 4:10 pm, Infinity77 [EMAIL PROTECTED] wrote: Hi All,     I apologize in advance if my question sounds dumb. I googled back and forth but my google-fu today is not working very well... I have seen the new style Python html documentation, which is extremely nice, and by reading here

Re: lint for Python?

2008-10-04 Thread Benjamin
On Oct 3, 4:38 pm, Pat [EMAIL PROTECTED] wrote: I've been searching for a good multi-module lint checker for Python and I haven't found one yet. Pylint does a decent job at checking for errors only within a single module. Here's one of my problems.  I have two modules. In module one, I

Re: What AugStore and AugLoad AST nodes are?

2008-10-06 Thread Benjamin
On Oct 6, 7:00 am, franck [EMAIL PROTECTED] wrote: Dear all, I'm experimenting with new ast module. I'd like to have pieces of code that can generate AugLoad and AugStore AST nodes. Indeed, I actually do not know what they correspond to. They aren't used by the current implementation.

Re: Python pre-release announcements

2008-10-08 Thread Benjamin
On Oct 8, 12:42 am, Ben Finney [EMAIL PROTECTED] wrote: Martin v. Löwis [EMAIL PROTECTED] writes: Is there some policy document or release management guide that could be updated for release teams to follow on this without needing to have this discussion every time? It's in PEP 101.

Re: utf-8 read/write file

2008-10-08 Thread Benjamin
On Oct 8, 12:49 pm, Bruno [EMAIL PROTECTED] wrote: Hi! I have big .txt file which i want to read, process and write to another .txt file. I have done script for that, but im having problem with croatian characters (Š,Đ,Ž,Č,Ć). Can you show us what you have so far? How can I read/write

Re: What do _ast Load | Store | Del | AugLoad | AugStore | Param mean?

2008-10-11 Thread Benjamin
On Oct 11, 12:57 pm, Eloff [EMAIL PROTECTED] wrote: In the _ast module Attribute, Subscript, Name, List, Tuple all have an expr_context associated with them which is defined as: expr_context = Load | Store | Del | AugLoad | AugStore | Param I have no idea what they mean, and what's the

Re: Transformation with ``parser`` ast

2008-10-13 Thread Benjamin
On Oct 13, 2:39 pm, Malthe Borch [EMAIL PROTECTED] wrote: (Note: repost from python-dev) The ``compiler.ast`` module makes parsing Python source-code and AST manipulation relatively painless and it's straight-forward to implement a transformer class. However, I find that the

Re: ANN: pyparsing 1.5.1 released

2008-10-19 Thread Benjamin
On Oct 17, 11:14 pm, Paul McGuire [EMAIL PROTECTED] wrote: (Python 3.0 uses syntax for catching exceptions that is incompatible with Python versions pre 2.6, so there is no way for me to support both existing Python releases and Python 3.0 with a common source code base.  For those who wish

Re: How is the logical processing being done for strings like 'Dog' and 'Cat'

2008-10-20 Thread Benjamin
On Oct 20, 8:41 pm, Sumitava Mukherjee [EMAIL PROTECTED] wrote: Hi all, I am a novice programmer in Python. Please could you explain me the results (regarding logical operators). I get this: print bool('God' and 'Devil') True [This is ok because (any) string is True, so; (True and

Re: set/dict comp in Py2.6

2008-10-25 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: I'd like to know why Python 2.6 doesn't have the syntax to create sets/ dicts of Python 3.0, like: Because nobody bothered to backport them. {x*x for x in xrange(10)} {x:x*x for x in xrange(10)} Bye, bearophile --

Re: set/dict comp in Py2.6

2008-10-25 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: I'd like to know why Python 2.6 doesn't have the syntax to create sets/ dicts of Python 3.0, like: Because nobody bothered to backport them. {x*x for x in xrange(10)} {x:x*x for x in xrange(10)} Bye, bearophile --

Re: set/dict comp in Py2.6

2008-10-26 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: I'd like to know why Python 2.6 doesn't have the syntax to create sets/ dicts of Python 3.0, like: Because nobody bothered to backport it. {x*x for x in xrange(10)} {x:x*x for x in xrange(10)} Bye, bearophile --

Re: set/dict comp in Py2.6

2008-10-26 Thread Benjamin
On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: I'd like to know why Python 2.6 doesn't have the syntax to create sets/ dicts of Python 3.0, like: Because nobody bothered to backport it. {x*x for x in xrange(10)} {x:x*x for x in xrange(10)} Bye, bearophile --

Re: print_function and unicode_literals cannot be used at the same time?

2008-10-28 Thread Benjamin
it: http://docs.python.org/reference/simple_stmts.html#future-statements Yes, and Benjamin Peterson already submitted a patch because of this thread.http://bugs.python.org/issue4209 It will be fixed in 2.6.1. -- http://mail.python.org/mailman/listinfo/python-list

Re: set/dict comp in Py2.6

2008-10-29 Thread Benjamin
On Oct 27, 3:38 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sat, 25 Oct 2008 23:44:46 -0200, Benjamin [EMAIL PROTECTED]   escribió: On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: I'd like to know why Python 2.6 doesn't have the syntax to create sets/ dicts of Python 3.0, like

Re: Performance of Python builtins

2008-05-25 Thread Benjamin
On May 25, 6:19 pm, [EMAIL PROTECTED] wrote: Is there any place outside the actual C source for Python that has information about the performance of Python's built-in operations? For example, I'd *expect* list.append to be O(1), and I hope that list[i] is O(1), but I don't really know that for

Re: undocumented functions in pkgutil

2008-05-29 Thread Benjamin
On May 29, 12:34 pm, Michele Simionato [EMAIL PROTECTED] wrote: I see that the pkgutil module has many useful functions which are however undocumented. Does anybody know why it is so? In particolar, can I safely use pkg.walk_packages without risking a change of interface in the future? I

Re: New chairman

2008-05-29 Thread Benjamin
On May 27, 10:48 am, Sverker Nilsson [EMAIL PROTECTED] wrote: Good luck to you to. Its just that it .. well it has never been easy for me to introduce Python at work. This py3k, if I like it or not, is not making it easier. Praktical, pragmatic, you know --- as I said, its not broken so lets

Re: python blogs

2008-06-02 Thread Benjamin
On Jun 2, 1:49 pm, [EMAIL PROTECTED] wrote: Hello! It seems like Python blogs are gaining popularity. It seems to me that they play a crucial role in promoting Python as a language. Do you agree with that? Just a few days ago I've finished setting up a dedicated Python blogging environment

Re: Register codec dynamically without copying module to lib/python/encodings/

2008-06-05 Thread Benjamin
On Jun 5, 2:57 pm, Michael Ströder [EMAIL PROTECTED] wrote: HI! I have a simple codec module for T.61 which principally works. I'd like to use this codec without having to copy the module to lib/python/encodings/. Is that possible? Can I can extend the encodings search path or register the

Re: ABC question: what is the purpose of the register() method?

2008-06-07 Thread Benjamin
On Jun 7, 1:37 pm, Kay Schluehr [EMAIL PROTECTED] wrote: I was reading PEP 3119 (http://www.python.org/dev/peps/pep-3119/) and have done some experiments using Python 3.0a5. Now I'm somewhat puzzled about the purpose of the ABCMeta.register() method. One can use the register() method to

Re: Context manager for files vs garbage collection

2008-06-16 Thread Benjamin
On Jun 16, 8:24 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: IIRC (please someone correct me if I'm wrong), proper release of file resources as soon as the file object gets out of scope is not garanteed in the language spec and is implementation dependant. Right. Resources are

Re: Python-3.0b1 build fails on Linux : _gestalt

2008-06-19 Thread Benjamin
On Jun 19, 5:07 am, Helmut Jarausch [EMAIL PROTECTED] wrote: Hi, trying to build Python-3.0b1 on my Gentoo Linux box fails with Failed to find the necessary bits to build these modules: _gestalt Looking at setup.py it seems that module '_gestalt' is only needed on Darwin but my build on

Re: tuple.index() and tuple.count()

2008-06-23 Thread Benjamin
On Jun 23, 3:13 pm, [EMAIL PROTECTED] wrote: never mind... a coworker pointed me to this http://bugs.python.org/issue1696444 apparently they're there in py3k... and 2.6 -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads, GIL and re.match() performance

2008-06-25 Thread Benjamin
On Jun 25, 9:05 am, Mirko Dziadzka [EMAIL PROTECTED] wrote: 1) Is there a reason for this? I think it is because the Python re library uses the Python C-API which is not threadsafe. 2) Is the regex library not thread-safe? 3) Is it possible, to release the GIL in re.match() to    get more

Re: Problem found in tutorial

2008-06-25 Thread Benjamin
On Jun 25, 2:09 pm, Terry Reedy [EMAIL PROTECTED] wrote: John W. Hamill wrote: C:\__jh\ftp\python\2_5_2\doc\tutorial\node11.html When reporting doc bugs, it is a good idea to check the most recent version.  The 3.0 version has the same problems (no changes have been made -- page and

Re: CAPI and thread safety

2008-06-27 Thread Benjamin
On Jun 27, 4:33 pm, Lane Brooks [EMAIL PROTECTED] wrote: I am writing an extension module that needs to release the global interpreter lock during some blocking I/O calls, but I need a mutex in the C code to make some of the shared data in the extension module are kept thread safe.  Can anyone

Re: Embedded Python Import problem

2008-06-27 Thread Benjamin
On Jun 27, 5:47 pm, sleek [EMAIL PROTECTED] wrote: I am having trouble with the following code: PyObject *module = PyImport_ImportModule(modulename); if (module == NULL) {     PyObject* et, *ev, *etr;     PyErr_Fetch(et, ev, etr);     PyObject* traceback = PyImport_ImportModule(traceback);

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread Benjamin
On Jun 27, 4:05 pm, Joe P. Cool [EMAIL PROTECTED] wrote: If I call os.environ.clear in a python program child processes still see the deleted entries. But when I iterate over the keys like so names =  os.environ.keys for k in names:     del  os.environ[k] then the entries are also deleted

Re: surprising behaviour of os.environ.clear

2008-06-28 Thread Benjamin
On Jun 28, 1:23 am, Tim Roberts [EMAIL PROTECTED] wrote: Benjamin [EMAIL PROTECTED] wrote: This is because of how os.environ is implement with a UserDict subclass. Why?  I mean, I can see that it happens, but I don't understand why being a UserDict causes this. The contents of a UserDict

Re: HTML Parsing

2008-06-28 Thread Benjamin
On Jun 28, 9:03 pm, [EMAIL PROTECTED] wrote: Hi everyone I am trying to build my own web crawler for an experiement and I don't know how to access HTTP protocol with python. Look at the httplib module. Also, Are there any Opensource Parsing engine for HTML documents available in Python

Re: using Python's AST generator for other languages

2008-07-10 Thread Benjamin
On Jul 10, 12:40 pm, eliben [EMAIL PROTECTED] wrote: Hello, I'm building a parser in Python, and while pondering on the design of my ASTs had the idea to see what Python uses. I quickly got to the compiler.ast module, and understood it's automatically generated. So I went to the source,

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread Benjamin
On Jul 11, 3:06 am, Ben Finney [EMAIL PROTECTED] wrote: Martin v. Löwis [EMAIL PROTECTED] writes: This is rather disappointing. Is that entire page suspect? All documentation about Python 3 is suspect until Python 3 gets actually released (nobody can say for sure how the release will

Re: using Python's AST generator for other languages

2008-07-11 Thread Benjamin
On Jul 11, 12:27 am, eliben [EMAIL PROTECTED] wrote: snip 2) What is the meaning of the comment in astgen.py ? Are the Python maintainers unhappy with the design of the AST ?3 Node, I think, is talking about a node in the parse tree. (AST is generated from another parse tree.) See PEP

The file executing

2007-07-02 Thread Benjamin
How does one get the path to the file currently executing (not the cwd). Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: The file executing

2007-07-03 Thread Benjamin
On Jul 2, 9:47 pm, Justin Ezequiel [EMAIL PROTECTED] wrote: On Jul 3, 9:40 am, Benjamin [EMAIL PROTECTED] wrote: How does one get the path to the file currently executing (not the cwd). Thank you os.path.dirname(sys.argv[0]) The returns the file that was called first, but not the one

Re: The file executing

2007-07-06 Thread Benjamin
On Jul 3, 8:56 am, Sebastian Wiesner [EMAIL PROTECTED] wrote: [ Benjamin [EMAIL PROTECTED] ] On Jul 2, 9:47 pm, Justin Ezequiel [EMAIL PROTECTED] wrote: On Jul 3, 9:40 am, Benjamin [EMAIL PROTECTED] wrote: How does one get the path to the file currently executing (not the cwd

Re: The file executing

2007-07-09 Thread Benjamin
On Jul 9, 6:42 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Fri, 06 Jul 2007 17:15:22 -0300, Benjamin [EMAIL PROTECTED] escribió: How does one get the path to the file currently executing (not the cwd). Thank you So: if __name__ == main: currentDir = os.path.dirname

wxPython, threads, and search engine

2007-07-17 Thread Benjamin
I'm writing a search engine in Python with wxPython as the GUI. I have the actual searching preformed on a different thread from Gui thread. It sends it's results through a Queue to the results ListCtrl which adds a new item. This works fine or small searches, but when the results number in the

wxPython and threads

2007-07-17 Thread Benjamin
I'm writing a search engine in Python with wxPython as the GUI. I have the actual searching preformed on a different thread from Gui thread. It sends it's results through a Queue to the results ListCtrl which adds a new item. This works fine or small searches, but when the results number in the

wxPython, searching, and threads

2007-07-18 Thread Benjamin
Hello! I am writing a search engine with wxPython as the GUI. As the search thread returns items, it adds them to a Queue which is picked up by the main GUI thread calling itself recursively with wx.CallAfter. These are then added to a ListCtrl. This works fine for small searches, but with larger

wxPython, searching, and threads

2007-07-18 Thread Benjamin
Hello! I am writing a search engine with wxPython as the GUI. As the search thread returns items, it adds them to a Queue which is picked up by the main GUI thread calling itself recursively with wx.CallAfter. These are then added to a ListCtrl. This works fine for small searches, but with larger

Re: Any python module for Traversing HTML files

2007-07-24 Thread Benjamin
On Jul 24, 12:12 pm, johnny [EMAIL PROTECTED] wrote: Any python module for navigating and selecting, parsing HTML files? htmlparse -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython - How to add sorting to a ListCtrl?

2007-07-24 Thread Benjamin
On Jul 24, 11:21 am, Robert Dailey [EMAIL PROTECTED] wrote: Hi, I have 3 columns in my list control, each with a different type of data (for example, one column has names, the other has dates, etc). Can anyone reference a tutorial for solving this issue? I've done my share of googling to no

Re: Learning Jython?

2007-07-26 Thread Benjamin
Paul Rubin wrote: Matt Bitten [EMAIL PROTECTED] writes: It looks like Jython is for me. That said, I have two questions: (1) Am I thinking straight here? Or is there some other solution that a knows-Python-but-not-Java programmer might use? You could convert to the whole world to using the

Re: Tkinter -- Show Data in an Excel like Read-Only Grid

2007-07-28 Thread Benjamin
On Jul 27, 4:56 pm, beginner [EMAIL PROTECTED] wrote: Hi All, I am really new to Tk and Tkinter. I googled the web but it was not mentioned how to build a data grid with Tkinter. Basically, I want to show an excel like data grid with fixed column and row headers and sortable columns. But

Icons for GUI development

2007-08-13 Thread Benjamin
I'm developing a mail client. Since GUI are usually improved with some icons, I'm looking for some. Because I'm not a very gifted artist I'm searching for a library of GPL or public domain icons. Any suggestions? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python question (PyNoob)

2007-08-19 Thread Benjamin
On Aug 19, 7:33 pm, Anonymous [EMAIL PROTECTED] wrote: I have exp with C/C++ (and a few other langs). I want to use Python to start doing the ff: 1). Data Munging (text processing) - instead of Perl 2). Automating my build process 3). (Possibly) some web data retrieval jobs Can anyone

Re: pdf library.

2007-12-29 Thread Benjamin
On Dec 29, 12:54 pm, Shriphani [EMAIL PROTECTED] wrote: Hi, I am looking for a pdf library that will give me a list of pages where new chapters start. Can someone point me to such a module ? ReportLab (ReportLab) might help. Regards, Shriphani P. --

Re: Mix different C source files into a single one

2007-12-29 Thread Benjamin
On Dec 29, 12:05 pm, Horacius ReX [EMAIL PROTECTED] wrote: Hi, I have a C program split into different source files. I am trying a new compiler and for some reason it only accepts a single source file. So I need to mix all my different C source files into a single one. That sounds like one

Re: What is the best way to do dynamic imports ?

2007-12-30 Thread Benjamin
On Dec 30, 8:24 am, [EMAIL PROTECTED] wrote: Hi list and python gurus :-) I'm playing with some mod_python and web development. And in me code I need to do som dynamic imports. Right now I just do a: exec 'import '+some_modulename The correct way to do this is use the __import__ function.

Re: reassign to builtin possible !?

2008-01-03 Thread Benjamin
On Jan 3, 7:04 am, Bernhard Merkle [EMAIL PROTECTED] wrote: Hi there, I am reading Learning Python 3e from Mark Lutz and just found out that reassigning to builtins is possible. What is the reason, why Python allows this ? IMO this is very risky and can lead to hard to find errors. I don't

Re: Detecting OS platform in Python

2008-01-10 Thread Benjamin
On Jan 10, 8:37 pm, Devraj [EMAIL PROTECTED] wrote: Hi everyone, My Python program needs reliably detect which Operating System its being run on, infact it even needs to know which distribution of say Linux its running on. The reason being its a GTK application that needs to adapt itself to

Re: env parameter to popen won't accept Unicode on Windows - minor Unicode bug

2008-01-14 Thread Benjamin
On Jan 14, 6:26 pm, John Nagle [EMAIL PROTECTED] wrote: I passed a dict for the env variable to Popen with Unicode strings for the dictionary values. Got: File D:\Python24\lib\subprocess.py, line 706, in _execute_child TypeError: environment can only contain strings It

Re: env parameter to popen won't accept Unicode on Windows - minor Unicode bug

2008-01-14 Thread Benjamin
On Jan 14, 6:26 pm, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: John Nagle wrote: It turns out that the strings in the env parameter have to be ASCII, not Unicode, even though Windows fully supports Unicode in CreateProcess. Are you sure it supports Unicode, not UTF8 or UTF16?

Unique thread ID

2008-01-17 Thread Benjamin
Is there a way to obtain a unique ID for the current thread? I have an object that I need to store local thread data in, and I don't want to use threading.local because each thread might have multiple instances of my object. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create graphs an embed them in GUI?

2008-01-17 Thread Benjamin
On Jan 17, 10:07 am, A.T.Hofkamp [EMAIL PROTECTED] wrote: On 2008-01-17, Heiko Niedermeyer [EMAIL PROTECTED] wrote: As I'm learning Python from scratch, I don't care wether to use (=learn) TKinter or PyQt or whatever, I just need some advice, which suits my needs best. It would be nice

Re: Unique thread ID

2008-01-18 Thread Benjamin
On Jan 18, 2:31 am, Christian Heimes [EMAIL PROTECTED] wrote: Benjamin wrote: Is there a way to obtain a unique ID for the current thread? I have an object that I need to store local thread data in, and I don't want to use threading.local because each thread might have multiple instances

Re: Unique thread ID

2008-01-18 Thread Benjamin
On Jan 18, 8:31 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Fri, 18 Jan 2008 22:41:47 -0300, Benjamin [EMAIL PROTECTED] escribió: On Jan 18, 2:31 am, Christian Heimes [EMAIL PROTECTED] wrote: Benjamin wrote: Is there a way to obtain a unique ID for the current thread? I have

Re: read files

2008-01-21 Thread Benjamin
On Jan 21, 9:08 pm, Mel [EMAIL PROTECTED] wrote: J. Peng wrote: first I know this is the correct method to read and print a file: fd = open(/etc/sysctl.conf) done=0 while not done: line = fd.readline() if line == '': done = 1 else: print line,

Cleanup when a object dies

2008-01-22 Thread Benjamin
I writing writing a class to allow settings (options, preferences) to written file in a cross platform manner. I'm unsure how to go a about syncing the data to disk. Of course, it's horribly inefficient to write the data every time something changes a value, however I don't see how I can do it on

Re: Cleanup when a object dies

2008-01-23 Thread Benjamin
On Jan 22, 11:29 pm, Raymond Hettinger [EMAIL PROTECTED] wrote: On Jan 22, 7:54 pm, Benjamin [EMAIL PROTECTED] wrote: I writing writing a class to allow settings (options, preferences) to written file in a cross platform manner. I'm unsure how to go a about syncing the data to disk

Re: Convert list to file object without creating an actual file.

2008-01-24 Thread Benjamin
On Jan 24, 8:57 pm, Bart Kastermans [EMAIL PROTECTED] wrote: I have written a little program that takes as input a text file, converts it to a list with appropriate html coding (making it into a nice table). Finally I want to upload this list as a textfile using ftp. If homeworkhtml

Re: refcount

2008-01-29 Thread Benjamin
On Jan 29, 5:46 am, Christian Heimes [EMAIL PROTECTED] wrote: Simon Pickles wrote: Hi, Is is possible to access the refcount for an object? Ideally, I am looking to see if I have a refcount of 1 before calling del Help on built-in function getrefcount in module sys: getrefcount(...)

Re: Python GUI toolkit

2008-02-03 Thread Benjamin
On Feb 3, 10:55 am, Grant Edwards [EMAIL PROTECTED] wrote: On 2008-02-03, Torsten Bronger [EMAIL PROTECTED] wrote: Hallöchen! [EMAIL PROTECTED] writes: [...] the only remaining are qt4 and wx, i would like to know if one of these or any other toolkit is capable of creating

Re: Python Embedding Thread

2008-07-21 Thread Benjamin
On Jul 21, 6:56 am, [EMAIL PROTECTED] wrote: Hi :) I want to run Python in my app. That works still fine. But my app supports now Threads and I would like to know what to do, that it runs without problems. PyGILState_Release and PyGILState_Ensure should solve the problem right? Where do I

Re: sys.stderr.write returns string length in Python 3

2008-07-22 Thread Benjamin
Alan G Isaac wrote: Is this new behavior intentional? :: Yes, it's in the PEP http://www.python.org/dev/peps/pep-3116/. sys.stderr.write(thisisatest\n) thisisatest 12 Here is the reason for it: help(sys.stderr.write) Help on method write in module io:

  1   2   3   4   5   6   7   8   9   10   >