[EMAIL PROTECTED] wrote:
I was a C Programmer for a while. Lately started to learn Python for
one small project at school. I joined a small company where they use
C++ for development.
Can we use Python and C together ? I mean create some classes in Python
and some number crunching
John Pote wrote:
Over this side of the pond the good old British Post Office changed its name
to 'Consignia' in 2001.
I thought it was actually the Royal Mail, but the brand history can be
found here:
http://www.royalmailgroup.com/aboutus/aboutus8.asp
The fact that people confuse Royal Mail
[EMAIL PROTECTED] wrote:
if you are really so scared of letting others exploit your config
scripts, then use the second, pickled fashion. that way you can store
the file at $HOME/blah-config.pkl, and everybody's happy.
Except the user who wants to edit the config file.
still, my point is we
[EMAIL PROTECTED] wrote:
'It certainoly does _not_ return 1.0 - it returns 1. And that is all it
can
return for being an integer that has by definition no fractional part.
'
For goodness sake, it was a typo, I'm so sorry!
Guess that's what you get for calling yourself brainy_muppet then.
[EMAIL PROTECTED] wrote:
I'm writing your name down and this is the last time I'm doing homework
for you.
James
Wow, you are really a pretentious asshole. If you don't want to provide
people with help, don't bother.
And that code's incorrect anyway.
So a smiley has to be
Hello,
I am trying to automate Excel and I cant seem to find out much relating to it's object model (in relation to Python)..seems as if its mostly covered by C and VB. Can anyone point me in the right direction? I am able to open excel, add information to cells, and then save and close the book
Those default values are not 0 and size-of-sequence, you may have
only experience with situations where they behave as such but that
is not the same.
Well, it might be - but the conceptual behavior is (usually) the same.
If you need to know these values then you will need to know them
just
Put this in your main function before you instantiate your wx.App.
if platform.system() == 'Linux':
try:
del os.environ['GTK_RC_FILES']
del os.environ['GTK2_RC_FILES']
except ValueError:
pass
This is a problem with
vinjvinj wrote:
I'm building an application with cherrypy and have started using
decorators quite extensively. A lot of my exposed functions look like:
@expose
@startTransactrionAndBuildPage
@partOfTabUi(tabId)
@convert(arg1=int, arg2=str)
def do_main_page(self, arg1, arg2):
some code
Hello,
I would like to be able to change the standard error path.
How can I do this in a script if I want to send error messages to /dev/null
by example ?
Thanks
--
Sebastien Moretti
--
http://mail.python.org/mailman/listinfo/python-list
Alex Martelli wrote:
[EMAIL PROTECTED] wrote:
C is the lowest, most fundamental level of extension, but there are many
other alternatives -- SWIG to wrap existing libraries, Boost or SCXX or
SIP to wrap specifically C++ with very different philosophies (template
heavy, minimal, Qt-based),
I agree with Steve and I agree Sybren.
Also:
This is a Bad Idea, since you should never add more complexity than needed.
Imports, computation, IO and so on are generally not needed for program
configuration, so standard configfile syntax should therefore not allow it.
Otherwise you may easily
Antoon Pardon [EMAIL PROTECTED] wrote:
Do you have trouble remembering that range(n) is actually providing the
second parameter to the function and what it does?
Yes. I don't use range() everyday, and it's very rare that I use more
than one argument. I do remember that there are additional
Paul Boddie wrote:
John Pote wrote:
Over this side of the pond the good old British Post Office changed its name
to 'Consignia' in 2001.
I thought it was actually the Royal Mail, but the brand history can be
found here:
http://www.royalmailgroup.com/aboutus/aboutus8.asp
The fact
how about
$ python test.py 2 /dev/null
?
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
but nobody seems to have
a problem with range(n) where n suddenly is the second parameter and
we use the default for the first.
Actually, I consider the unique calling pattern for x/range to be something
of a wart.
Paul Boddie wrote:
Bizarre names may be cute (to some people) but they don't lend
themselves to guessing or searching. Consequently, people who want
answers yesterday aren't likely to be amused to eventually discover
that the name of the resource they've been looking for is some opaque,
Hi All,
How can I remove an Instance of logger ?
I need this feature in one of my script where I need to associate each
time logger instance to different handler.
Thanks in advance
Pramod
--
http://mail.python.org/mailman/listinfo/python-list
Moretti wrote:
I would like to be able to change the standard error path.
(I'm not sure path is the right word here, really, but never mind...)
How can I do this in a script if I want to send error messages to /dev/null
by example ?
if you're talking about things that Python prints to
solution. I'm not going to tell you that decorators aren't the answer to
all programming problems, because you already know that in your heart :-
I was fearing that. The expose decorator is the only one that comes
with cherrypy. The other ones are mine and are of the format:
def
Hi folks,
i have an failover environment for a python application which can
fail-over to a AIX, Sun or Linux Box.
At the moment the python interpreter ( 2.4.2 on all platforms ) and the
application are installed localy but all data and configuration are on
a shared location ( NFS/GPFS)
So far no
[EMAIL PROTECTED] wrote:
isn't python suitable enough to hold your configuration?
that depends on the target application, and, more importantly, the
target audience and what kind of configuration they're expected to
do.
there's no one rule to rule them all for configuration issues.
(except,
Hello,
I'm trying to create an addin for Outlook 2002 using the one provided
in the demo of win32com as a starting point. I've been able to do my
addin and test it if I go the standard way (using the python
interpreter). But now, I want other poeple to use it to I want to
freeze it for windows
@expose - cherrypy decorator
@startTransactrionAndBuildPage - starts a db transaction, populates
the user in the session.
I guess that is ok - transaction handling is a classic for decorator-like
concepts. After all, you don't want
begin()
try:
pass
commit()
finally:
if not comitted():
Hi again,
Steve-
I'm trying to use python to model reliability. Basically, I want to
read an XML file in that defines a bunch of variables, that are then
accessible from the python interpreter. For example:
import reliability
reliability.read_xml(c:\\somefile.xml) #== defines x1, x2, x3
result
Alex Martelli napisał(a):
Wrong! Of _course_ it's an option -- why do you think it matters at all
whether you're the creator of this object?!
Statically typed languages background. Sorry. ;)
Code below doesn't work, but shows my
intention:
# obj is instance of BaseClass
def get_x(self):
vinjvinj wrote:
I'm building an application with cherrypy and have started using
decorators quite extensively. A lot of my exposed functions look like:
@expose
@startTransactrionAndBuildPage
@partOfTabUi(tabId)
@convert(arg1=int, arg2=str)
def do_main_page(self, arg1, arg2):
some code
i dont know about your experience with config files, but there
thousands of formats. on the python side -- just in this conversation,
we mentioned ConfigObj, ConfigParser and the Config module i linked to.
when everybody writes his own config, you get loads of unique formats.
anyway, for all the
HajoEhlers wrote:
Since the .py file are plain python scripts i assume that these are
not causing any trouble but what about the .pyc file ? ( Which i could
not figure out what they are acutelly for - My knowledge about python
is more or less a drop of water within the python ocean )
PYC
Hi,
Can you please tell me how Use python to process XML file?
The example I find is build a DOM, but I just need to do it in SAX
based, how can I do that?
For example, I have a xml file like this:
log
a text /a
a text /a
b text /b
a text /a
c text /c
a text /a
b text /b
/log
For i want to
That sounds like something for the templating engine, and _certainly_ not
for a decorator that otherwise deals with transactions.
The actual code for the page layout is in a preppy template. But the
calls to the template engine are made in the
startTransactrionAndBuildPage decorator
Template I
Alex Martelli napisał(a):
So another question arise. Is it possible to make function a method (so
it will receive calling object as first argument)?
Sure, impor types then call types.MethodType:
f = types.MethodType(f, obj, someclass)
(f.__get__ is also fine for Python-coded functions)
vinjvinj wrote:
I was fearing that. The expose decorator is the only one that comes
with cherrypy. The other ones are mine and are of the format:
def decorator(func):
def wrapper(self, *args, **kwargs)
some code
return wrapper
what exactly made you think that Python would
Gerardo Herzig wrote:
Lets say i have an DB object, who implements the querys to the database
trough a method called DBObject.doQuery.
On the other hand, i have 50 sql functions stored in the database. So i
can call DBObject.doQuery('select * from my_sql_function()')...Ok, what
do i want
On 3/10/06, Michal Kwiatkowski [EMAIL PROTECTED] wrote:
Alex Martelli napisał(a):
So another question arise. Is it possible to make function a method (so
it will receive calling object as first argument)?
Sure, impor types then call types.MethodType:
f = types.MethodType(f, obj,
vinjvinj [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I'm building an application with cherrypy and have started using
decorators quite extensively. A lot of my exposed functions look like:
@expose
@startTransactrionAndBuildPage
@partOfTabUi(tabId)
@convert(arg1=int,
Hi!
Steve Holden wrote:
Did you actually try removing the line and running the program?
I tried, of course :-) Removing the line
box.Add(item=upper_box, flag=wx.GROW)
yields the remaining program
import wx
app = wx.PySimpleApp()
frame = wx.Frame(parent=None, title=Test)
box =
Is there a way I can do time series calculation, such as a moving
average in list comprehension syntax? I'm new to python but it looks
like list comprehension's 'head' can only work at a value at a time. I
also tried using the reduce function and passed in my list and another
function which
Dave wrote:
Hi. I am learning PyOpenGL and I am working with a largish fixed scene
composed of several thousand GLtriangles. I plan to store the coords and
normals in a NumPy array.
Is this the fastest solution in python? would i be significantly better
off (timewise or otherwise)
MakaMaka wrote:
Hi again,
Steve-
I'm trying to use python to model reliability. Basically, I want to
read an XML file in that defines a bunch of variables, that are then
accessible from the python interpreter. For example:
import reliability
reliability.read_xml(c:\\somefile.xml) #==
Hello --
I'm a Java programmer who's slowly getting up to speed in Python. In
general I try to initialize the state of my objects as late as
possible, in the accessor. So if I have a member _foo, my accessor
is something like:
public FooType getFoo() {
if (_foo == null) {
//
Thanks guys! :D
--
http://mail.python.org/mailman/listinfo/python-list
I have an Access 2003 database, protected by a workgroup, that I am
trying to view through python. Currently, I'm attempting dao with the
win32 package, and I'm able to view all of the table names, but I don't
know how to view the attributes of the tables.
My code:
import win32com.client
from
falcon wrote:
Is there a way I can do time series calculation, such as a moving
average in list comprehension syntax? I'm new to python but it looks
like list comprehension's 'head' can only work at a value at a time. I
also tried using the reduce function and passed in my list and another
Is there an existing package for python that will perform simple letter
recognition from image files? I'm specifically looking for a way to
read from a png file, but that can be changed.
--
http://mail.python.org/mailman/listinfo/python-list
Em Sex, 2006-03-10 às 09:53 -0800, [EMAIL PROTECTED] escreveu:
I have an Access 2003 database, protected by a workgroup, that I am
trying to view through python. Currently, I'm attempting dao with the
win32 package, and I'm able to view all of the table names, but I don't
know how to view the
Hi,
I'm working on a library written in C using GObject, which i
provide python bindings for using pygtk. When I checked the
library for memory leaks using valgrind, I noticed that none
of the objects I created in the script (that is they are global in
the script) were deleted on exit. After some
[EMAIL PROTECTED]:
Can you please tell me how Use python to process XML file?
The example I find is build a DOM, but I just need to do it in SAX
based, how can I do that?
http://docs.python.org/lib/module-xml.sax.html
http://pyxml.sourceforge.net/topics/howto/section-SAX.html
--
René Pijlman
--
Steve,
I think I actually need to get the caller's local namespace. How do I
do that using sys? I read the documentation and can't find anything
specific. For example, if I have module A and it imports module B, I
want module B to add variables to A's global namespace. Python has to
store this
you can use function parse from xml.sax
It takes your xml as the first argument and an
xml.sax.handler.ContentHandler instance as the second.
---
from xml.sax import parse
from xml.sax.handler import ContentHandler
class LogHandler(ContentHandler):
def startElement(self,name):
if
In article [EMAIL PROTECTED],
Thomas Guettler [EMAIL PROTECTED] wrote:
.
.
.
tkinter (or better TK) has no good table widget.
.
.
.
URL:
In article [EMAIL PROTECTED],
Diez B. Roggisch [EMAIL PROTECTED] wrote:
However, I can't seem to get the program to treat the numbers as
numbers. If I put them in the dictionary as 'THE' = int(0.965) the
program returns 1.0
It certainoly does _not_ return 1.0 - it returns 1. And that is all it
Bill:
In general I try to initialize the state of my objects as late as
possible, in the accessor. [...]
Is there a more Pythonic way of looking at this?
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/131495
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/363602
--
René Pijlman
The second version seems the most sensible. Remeber this is python,
properties are more sensible then getters and setters.
--
http://mail.python.org/mailman/listinfo/python-list
falcon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Is there a way I can do time series calculation, such as a moving
average in list comprehension syntax? I'm new to python but it looks
like list comprehension's 'head' can only work at a value at a time. I
also tried using
Here is the full code I'm using now to try out your sample:
import dbi, odbc
import win32com.client
from pprint import pprint
#sample code to list all tables in the selected database
daoEngine = win32com.client.Dispatch('DAO.DBEngine.36')
dtbs = daoEngine.OpenDatabase('database.mdb')
for table
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
1. The fact that one function calls the other doesn't mean they're
logically nested.
In this situation they were logically nested, because the scramble_word
is a function needed by another one only, in Java the scramble_word
becomes
Tom Bradford [EMAIL PROTECTED] writes:
Let me first say that I'm sure that this subject has come up before,
and so forgive me for beating a dead horse. Secondly, let me say that
Python's strength is its dynamic nature, and I don't believe that it
should ever require a precondition
ok, I know what I had wrong :) I was hoping that your code would
return the column names for me, but it was expecting me to list the
columns to use. I want to know how to retrieve that list of columns
through python.
--
http://mail.python.org/mailman/listinfo/python-list
Pramod wrote:
Hi All,
How can I remove an Instance of logger ?
I need this feature in one of my script where I need to associate each
time logger instance to different handler.
Thanks in advance
Pramod
Are you sure you are using logging in the right way? What do you mean
by each time?
falcon wrote:
Is there a way I can do time series calculation, such as a moving
average in list comprehension syntax? I'm new to python but it looks
like list comprehension's 'head' can only work at a value at a time. I
also tried using the reduce function and passed in my list and another
Ok, I figured it out. Thanks for your help guys. If anybody else is
searching this group looking for the answer, you want the
sys._getframe() function.
sys._getframe(1).f_locals['a'] = 1
if you put the above in a function in a module, it creates a variable
'a' in the namespace of whatever
falcon [EMAIL PROTECTED] writes:
Is there a way I can do time series calculation, such as a moving
average in list comprehension syntax? I'm new to python but it looks
like list comprehension's 'head' can only work at a value at a time. I
also tried using the reduce function and passed in my
what exactly made you think that Python would be able to run your
code *without* calling your function ?
I was hoping that when the compiler finds decorators with wrapers that
have the same signature it can some how magically combine them into
one function (which gets called at run time) and not
Steven D'Aprano wrote:
On Thu, 09 Mar 2006 13:44:25 +0100, bruno at modulix wrote:
(snip)
And it's not self-referential - it introduces a references cycle
(class object - instances - class object), which may or may not be a
problem.
Every instance knows about a list of every other
Matthias Kluwe wrote:
Hi!
Steve Holden wrote:
Did you actually try removing the line and running the program?
I tried, of course :-) Removing the line
box.Add(item=upper_box, flag=wx.GROW)
yields the remaining program
import wx
app = wx.PySimpleApp()
frame =
To emphasize the point as a newbie: I know what CPAN is. I would go to
the Vaults of Parnassus for Python stuff. But Cheese Shop?
Well, why don't we promote it as PyPI (Python Package Index)? The url
_is_ python.org/pypi, and I'm pretty sure I read somewhere that PyPI
was the intended name...
I'm trying to get the mcmillan installer utility to generate a
standalone executable for me. I've gotten to work--almost!--but still
have one problem. After running Installer's Build.py on my script/spec,
it appears to work. I go into the directory generating by Build.py and
run my program. It
Andrew Gwozdziewycz wrote:
To emphasize the point as a newbie: I know what CPAN is. I would go to
the Vaults of Parnassus for Python stuff. But Cheese Shop?
Well, why don't we promote it as PyPI (Python Package Index)? The url
_is_ python.org/pypi, and I'm pretty sure I read somewhere
Hello,
for my project confux (http://confux.sourceforge.net) I want to read
a line from stdin.
But I don't want the user to type a new line. I want so display a
value which the user can edit.
For example I want to ask the user for a hostname and I print
localhost, the user modified it to
Some example (from real life).
def ChooseItems(StartDate, EndDate, Filter):
#function returns a set of some items in chronological order
#from required interval possibly using filter
ChooseItems() #get everything
ChooseItems('01.01.2000', ,SomeFilter) #get everything after a date using filter
Some example (from real life).
def ChooseItems(StartDate, EndDate, Filter):
#function returns a set of some items in chronological order
#from required interval possibly using filter
ChooseItems() #get everything
ChooseItems('01.01.2000', ,SomeFilter) #get everything after a date using filter
Jacob Kroon wrote:
Is there another way to make python delete objects which were
created in the global scope upon exit ?
Check out the `atexit' module.
--
Steve Juranich
Tucson, AZ
USA
--
http://mail.python.org/mailman/listinfo/python-list
Well, you could iterate over an index into the list:
from __future__ import division
def moving_average(sequence, n):
return [sum(sequence[i:i+n])/n for i in
xrange(len(sequence)-n+1)]
Of course, that's hardly efficient. You really want to use the value
calculated for the i_th term
Gau,
I'm a beginner and had fits connecting to my Access 2003 DB of
quotations. The best advice that finally worked for me was to use
mxODBC. In fact, you might just search this forum for Access and
mxODBC.
I can't customize to fit your situation, but here is the connection
part of a script I
Clemens Hepper wrote:
Hello,
for my project confux (http://confux.sourceforge.net) I want to read
a line from stdin.
But I don't want the user to type a new line. I want so display a
value which the user can edit.
For example I want to ask the user for a hostname and I print
localhost,
I was hoping that your code would
return the column names for me, but it was expecting me to list the
columns to use. I want to know how to retrieve that list of columns
through python.
I think once you establish connection to the database using Python and
mxODBC, then your question becomes
That would be fine for me to switch to mxodbc, I've used it before and
it worked fine. But if I switch, do you know how I can get the column
names from the table? Maybe I'm not being clear with my question here.
I'm going to try again
here's a table (it's in access):
=== tablename =
Hi everyone! I'm documenting some functions that return XML strings.
I'd like to have `sample' xml show up in my epydoc generated
documentation. However, epydoc does not like the indentation of the
XML and gives me this error -
L28: Error: Improper paragraph indentation.
Here is a simple
BartlebyScrivener:
Maybe you're right, and I'll try posting to another group. However, I
have found resources for doing this using the same data structure:
TableDefs which is in VB and python. I see how they are doing it in
VB, but I don't know how this works in python. I was hoping someone
It's a bit more complicated.
The field has a default and a preassigned Value.
The default is p.e. 'localhost' and the value is 'www.gentoo.org'.
Then localhost is chosen if the value is erased to ''. But i want to
make it easy to keep the preassigned value!
So if nothing is typed 'www.gentoo.org'
Benny wrote:
Paul Boddie wrote:
Bizarre names may be cute (to some people) but they don't lend
themselves to guessing or searching. Consequently, people who want
answers yesterday aren't likely to be amused to eventually discover
that the name of the resource they've been looking for is
bruno at modulix [EMAIL PROTECTED] writes:
I should just take some time and learn to read !-)
Then I am better of than you. I just had to learn the syntax of a
language :-)
--
Brian (remove the sport for mail)
http://www.et.web.mek.dtu.dk/Staff/be/be.html
http://www.rugbyklubben-speed.dk
--
For more reference, I got my information to start this from:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52267
When I try to run that code, it gives me this:
File C:\Python24\Lib\site-packages\win32com\client\util.py, line
83, in next
return _get_good_object_(self._iter_.next())
[EMAIL PROTECTED] enlightened us with:
i dont know about your experience with config files, but there
thousands of formats.
All the config files I needed were either very easy to learn, or well
documented in comments.
on the python side -- just in this conversation, we mentioned
ConfigObj,
[EMAIL PROTECTED] wrote:
Hi everyone! I'm documenting some functions that return XML strings.
I'd like to have `sample' xml show up in my epydoc generated
documentation. However, epydoc does not like the indentation of the
XML and gives me this error -
L28: Error: Improper paragraph
How can I get the names of the columns for each table??
SELECT * FROM mytable
--
http://mail.python.org/mailman/listinfo/python-list
On 10 Mar 2006 12:49:29 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi everyone! I'm documenting some functions that return XML strings.
I'd like to have `sample' xml show up in my epydoc generated
documentation. However, epydoc does not like the indentation of the
XML and gives me this
Is there a recommended way to specify the permissions and ownership of
scripts installed from distutils? Also, I'm currently just using this
config in setup.cfg to control where the scripts go:
[install]
install-scripts = /opt/mcad/bin
But it would be very helpful if I could install some of
Doh. That was too easy.
Thanks!
jw
--
http://mail.python.org/mailman/listinfo/python-list
MakaMaka wrote:
Ok, I figured it out. Thanks for your help guys. If anybody else is
searching this group looking for the answer, you want the
sys._getframe() function.
sys._getframe(1).f_locals['a'] = 1
if you put the above in a function in a module, it creates a variable
'a' in the
[EMAIL PROTECTED] wrote:
I have an Access 2003 database, protected by a workgroup, that I am
trying to view through python. Currently, I'm attempting dao with the
win32 package, and I'm able to view all of the table names, but I don't
know how to view the attributes of the tables.
My code:
[EMAIL PROTECTED] wrote:
Is there an existing package for python that will perform simple letter
recognition from image files? I'm specifically looking for a way to
read from a png file, but that can be changed.
simple letter recognition from image file now there's an oxymoron.
I've
I have written some C extension before but it was pretty tedious. I
have recently found another approach by using ctypes
(http://starship.python.net/crew/theller/ctypes/). Which you develop
your C module in dynamic library (DLL in Windows world), the from
Python, you can call the C functions in
Hello,
When parsing XML documents containing international characters, such as
the Norwegian characters Æ, Ø, Å, I get an exception in Python's SAX
module. What is the correct way to parse such characters in Python? I've
searched for methods to somehow escape the characters, without any luck
Andreas R. wrote:
When parsing XML documents containing international characters, such as
the Norwegian characters Æ, Ø, Å, I get an exception in Python's SAX
module. What is the correct way to parse such characters in Python? I've
searched for methods to somehow escape the characters, without
I have written some C extension before but it was pretty tedious. I
have recently found another approach by using ctypes
(http://starship.python.net/crew/theller/ctypes/). Which you develop
your C module in dynamic library (DLL in Windows world), the from
Python, you can call the C functions in
Gau,
This prints the names of the columns in my database.
# Modification of
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/389535
# Instructions for customizing are at:
# http://www.egenix.com/files/python/mxODBC.html
import mx.ODBC.Windows as odbc
driv='DRIVER={Microsoft Access
Hi,in stead of going for the traditional GUIS like wxPython, PyGtk and the like, you could consider using a browser based GUI. Try CherryPy for instance. See also here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442481regards,Dimitri On 3/10/06,
invitro81
[EMAIL PROTECTED]
Is there an existing package for python that will perform simple letter
recognition from image files? I'm specifically looking for a way to
read from a png file, but that can be changed.
simple letter recognition from image file now there's an oxymoron.
I've successfully used
101 - 200 of 273 matches
Mail list logo