Hi everyone,
I managed to package python for distribution with my app. I
made 'dist' using py2exe and everything runs fine except there
is no more output from the python interpreter. I redirect the
output like so...
static PyMethodDef ioMethods[] =
{
{"output", output, METH_VARARGS, "output"}
I'm a python guy, so I haven't tried rails myself (I did read the
tutorial though). I tried Django and didn't like it somewhat. One thing
I don't like about it is that you have to write the same things twice,
for ex. specify url resolver and reference it in config. Django is not
bad but not spectac
[EMAIL PROTECTED] wrote:
>
> I have tried to test RE and UTF-8 in Python generally and the results
> are even more confusing (done with locale cs_CZ.UTF-8 in konsole):
>
>>>locale.getpreferredencoding()
>
> 'UTF-8'
>
print re.sub("(\w*)","X","[Chelcický]",re.L)
You first have to turn the r
George Sakkis wrote:
>
>
>If by straightforward you mean one-liner, there is:
>''.join(c for c in input_string if c not in string.printable)
>
>If you care about performance though, string.translate is faster; as always,
>the best way to decide
>on a performance issue is to profile the alternativ
Peter Hansen wrote:
> While I can't speak for the OP, isn't it the case that the threadlets in
> Stackless (sorry, don't know what they are really called) are true
> threads in the sense of being able to switch contexts no matter how far
> down in a set of nested calls they might be? And that Nan
"George" <[EMAIL PROTECTED]> wrote:
> I'm very new to python and I have tried to read the tutorials but I am
> unable to understand exactly how I must do this problem.
>
> Specifically, the showIPnums function takes a URL as input, calls the
> read_page(url) function to obtain the entire page for
Hi list,
I am trying to find a general memory profiler that can measure the
memory usage in Python program
and gather some stats about object usages, and things like that.
I am trying to find a simple python module to be able to customize it
and integrates it to other tools i have.
(it should exi
Working on extension of genericwiki.py plugin for PyBlosxom and I have
problems with UTF-8 and RE. When I have this wiki line, it does break
URL too early:
[http://en.wikipedia.org/wiki/Petr_Chelcický Petr Chelcický's]
work(s) into English.
and creates
[http://en.wikipedia.org/wiki/Petr_Chel";>h
I'm very new to python and I have tried to read the tutorials but I am
unable to understand exactly how I must do this problem.
Specifically, the showIPnums function takes a URL as input, calls the
read_page(url) function to obtain the entire page for that URL, and
then lists, in sorted order, the
"qvx" <[EMAIL PROTECTED]> writes:
[...]
> 4. Process each line: compare pixels of each letter of alphabet with
> corresponding pixels in line of input picture. This consists of loops
> comparing pixel by pixel. This is my performance bottleneck.
>
> I'm using PIL for initial image processing. But
* George (2005-09-24 18:13 +0100)
> How can I parse an HTML file and collect only that the A tags.
import formatter, \
htmllib, \
urllib
url = 'http://python.org'
htmlp = htmllib.HTMLParser(formatter.NullFormatter())
htmlp.feed(urllib.urlopen(url).read())
htmlp.close()
print htm
"Stephen Prinster" <[EMAIL PROTECTED]> wrote:
> George wrote:
> > How can I parse an HTML file and collect only that the A tags. I have a
> > start for the code but an unable to figure out how to finish the code.
> > HTML_parse gets the data from the URL document. Thanks for the help
>
> Have you t
* Terry Reedy (2005-09-24 21:16 +0100)
> "Eyual Getahun" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>>I was wondering how could I edit the registery with python
>
> believe you can do that with pythonwin extensions, available at python.org
... and _winreg
--
http://mail.pytho
I thought I should correct and clarify the use of EMSL (even though
this isn't specific toward your request, qvx.)
http://esml.itsc.uah.edu/index.jsp
It's more for data format recognition and conversion. Here's a
description from the site. The sw was developed for earth science, but
is very usefu
"Steve Bergman" <[EMAIL PROTECTED]> wrote:
> When sanitizing data coming in from HTML forms, I'm doing this (lifted
> from the Python Cookbook):
>
> from string import maketrans, translate, printable
> allchars = maketrans('','')
> delchars = translate(allchars, allchars, printable)
> input_string
Kalle Anke wrote:
> Better (in this case) =
>
> + Being "pythonic"
>
> + Avoiding going through a second representation (the tuple)
> if there is some way to create a date object directly.
I think the plainest and simplest approach would be to create a
well-named function which does the
I'm working on essentially the same thing for a real-time context. No
formal schema developed yet, but I know that I'll be using some
combination of the following: ADaM, ESML (Binary data format
unification...xml config), Numarray/Scipy, Pytables (DataBase), PIL,
Cairo (svg), and MatPlotlib.
--
h
Thanks for all the replies - you are very nice people!
Don't worry Jeff, I assumed you weren't telling me what 1*1 equals! I
got your point.
James Stroud impressively got to the heart of what I was trying to do -
which was just to wrap up the code here:
en.wikipedia.org/wiki/Fibonacci_number_pr
> James Stroud <[EMAIL PROTECTED]> (JS) wrote:
>JS> def Multiply(self, other):
>JS> self.a = self.a * other.a + self.b * other.b
>JS> self.b = self.a * other.b + self.b * other.c
>JS> self.c = self.b * other.b + self.c * other.c
I gues this will give the wrong
On Saturday 24 September 2005 15:04, Eyual Getahun wrote:
> I was wondering how could I edit the registery with python
The excellent manual tells you how...
The _winreg module
http://docs.python.org/lib/module--winreg.html
-Michael
--
http://mail.python.org/mailman/listinfo/python-list
I also have 0 OCR experience, but the case is simple enough.
I know about scipy but I have 0 experience with it. I was actually
hoping somebody who knows about it might have some recipe.
I also tried psyco, but unfortunetly, the speedup is only few percent.
I will check out ADaM's site.
I was h
Oops!
I should have used '2' in the example, or some other number.
I was trying to make a point about what
x *= ...
means when it is in the context of a function (or method) body.
I think this is key to understanding what Python did in the case the user
posted.
Being rude wasn't my inte
On Saturday 24 September 2005 09:07, [EMAIL PROTECTED] wrote:
> For the same reason that
> def f(z):
> z *= z
> c = 1
> f(c)
> print c
> prints 1.
>
> Jeff
I don't mean to be rude, but this is a horrible example if your are intending
to help a neophyte:
py>
"Eyual Getahun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>I was wondering how could I edit the registery with python
believe you can do that with pythonwin extensions, available at python.org
--
http://mail.python.org/mailman/listinfo/python-list
Shoot, Square() should be:
def Square(self):
self.Multiply(self)
Forgot to proofread before hitting send.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo
As others have pointed out, you are just reassigning a new value to the
self argument in the Square() method shown. Instead, what you need to
do is change the object that 'self' refers to within the method. To do
this, change it to:
def Square( self ):
result = self * self
self
Additionally, your __mul__() returns a new FibonnacciMatrix. You do not want a
new FibbonacciMatrix, you want to operate on an existing matrix (otherwise,
you would want to go with Ivan Voras's solution, where you re-assign outside
of the class). If you don't want the overhead of creating a inst
I was wondering how could I edit the registery with python
--
http://mail.python.org/mailman/listinfo/python-list
you may define a start_a in MyHTMLParser.
e.g.
import htmllib
import formatter
class HTML_Parser(htmllib.HTMLParser):
def __init__(self):
htmllib.HTMLParser.__init__(self,
formatter.AbstractFormatter(formatter.NullWriter()))
def start_a(self, args):
for key, v
"beza1e1" <[EMAIL PROTECTED]> writes:
> I think for a quick hack, this is as good as a parser. A simple parser
> would miss some cases as well. RE are nearly not extendable though, so
> your critic is valid.
Pretty much any first attempt is going to miss some cases. There
libraries available that
I think the gist of your problem is that you are re-binding self in the
method. Here is a simpler example of your problem:
py> def doit(c):
... c = 5
... print "c in the method is", c
...
py> c = 42
py> print "c before calling the method is", c
c before calling the method is 42
py> doit(c)
c
I am trying this out, parts of it are direct from the Python 2.4
manual.
//--- icallbk.c
#include "Python.h"
PyObject *fcallback = NULL;
static PyObject*
call_func(PyObject* self, PyObject* args)
{
PyObject *result;
PyObject *arglist;
int arg = 123;
arglist = Py_BuildValue("(i)",
In a nutshell lux says that:
f = open("LPT1:")
f.write("bla bla")
f.close()
prints pure text very well, but he's looking for code that'll print
without having to specify how the printer is attached ( net, parallel,
usb or whatever).
the only thing that comes to my mind is getting python code to
Tor Erik Sønvisen wrote:
>
> I've been doing some research since my first post and now I'm really
> confused. I'm programming in xp, and found some c++ code out of this world
> that supposidly should list all available services to a given bluetooth
> device. This code however where only working wit
On 24 Sep 2005, at 19:14, qvx wrote:
> Hi all,
>
>
> 4. Process each line: compare pixels of each letter of alphabet with
> corresponding pixels in line of input picture. This consists of loops
> comparing pixel by pixel. This is my performance bottleneck.
>
> I'm using PIL for initial image p
Hi Take a look at ADaM's image processing functionality. I'd also
suggest seeing if Numarray of Scipy can be utilized.
Here's ADaM's site. I'm sure your familiar with the others mentioned.
http://datamining.itsc.uah.edu/adam/
hth,
Dieter
--
http://mail.python.org/mailman/listinfo/python-list
I think for a quick hack, this is as good as a parser. A simple parser
would miss some cases as well. RE are nearly not extendable though, so
your critic is valid.
The point is, what George wants to do. A mixture would be possible as
well:
Getting all by a RE and then extracting the url with some
In the "Extending and Embedding" part of the Python documentation: section
5.4 "Extending Embedded Python" - it describes how to use a Python
extension module from Python that is embedded in a C application.
Is it safe to call Py_InitModule() more than once in the same application -
in order to be
"beza1e1" <[EMAIL PROTECTED]> writes:
> I do not really know, what you want to do. Getting he urls from the a
> tags of a html file? I think the easiest method would be a regular
> expression.
I think this ranks as #2 on the list of "difficult one-day
hacks". Yeah, it's simple to write an RE that
One caveat, as I recently discovered, to dynamically adding methods is
that it doesn't work for __foo__ methods. For example, you can't make
an object into an iterator by dynamically assigning bound methods to
obj.__iter__ and obj.next. Same thing with __getitem__, __setitem__,
etc; adding them dir
"Gerard Flanagan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>def __mul__( self, other ):
>def Square( self ):
>self *= self
Among the other reasons cited, I believe that 'op=' maps to a different
special method than 'op'. __imul__? or something? do check.
tj
Suppose I create a class with some methods:
py> class C:
... def spam(self, x):
... print "spam " * x
... def ham(self, x):
... print "ham * %s" % x
...
py> C().spam(3)
spam spam spam
>>> C().ham(3)
ham * 3
To dynamically remove the methods, delete them from the cl
Hi all,
I have a performance problem in my app. It is a poor man's version of
OCR app. I started this app as a prototype before implementing it in
C++. But now, after I have a working copy in Python, I don't feel like
doing the job again in C++. A speed improvement of at least 5 times
would be nec
George wrote:
> How can I parse an HTML file and collect only that the A tags. I have a
> start for the code but an unable to figure out how to finish the code.
> HTML_parse gets the data from the URL document. Thanks for the help
Have you tried using Beautiful Soup?
http://www.crummy.com/softwar
I do not really know, what you want to do. Getting he urls from the a
tags of a html file? I think the easiest method would be a regular
expression.
>>>import urllib, sre
>>>html = urllib.urlopen("http://www.google.com";).read()
>>>sre.findall('href="([^>]+)"', html)
['/imghp?hl=de&tab=wi&ie=UTF-8
Robert wrote:
> Wouldn't it be an issue to think about if future win-python distributions
> should keep on including the asian codecs in the main-dll?
Indeed, it would. As I said before: if somebody defines a clear, fair
policy which finds agreement in the community, I'm willing to change the
curr
thanks, I go for that.
Wouldn't it be an issue to think about if future win-python distributions
should keep on including the asian codecs in the main-dll?
See some reason in including smaller functional pyd's lik zip or even ssl,
etc. (as they are used regularly in projects >30%) - but asian cod
I've been googling around for a bit trying to find some mechanism for
doing in Python something like Java's synchronized methods. In the
decorators PEP, I see examples using a hypothetical synchronized
decorator, but haven't stumbled across any actual implementation of
such a decorator. I've al
How can I parse an HTML file and collect only that the A tags. I have a
start for the code but an unable to figure out how to finish the code.
HTML_parse gets the data from the URL document. Thanks for the help
def HTML_parse(data):
from HTMLParser import HTMLParser
parser = MyHTMLParser()
par
Gerard Flanagan wrote:
> def Square( self ):
> self *= self
You probably mean
return self * self
> A = FibonacciMatrix()
> A.Square()
Make this
A = A.Square()
--
http://mail.python.org/mailman/listinfo/python-list
When sanitizing data coming in from HTML forms, I'm doing this (lifted
from the Python Cookbook):
from string import maketrans, translate, printable
allchars = maketrans('','')
delchars = translate(allchars, allchars, printable)
input_string = translate(input_string, allchars, delchars)
Which is
[EMAIL PROTECTED] wrote:
> I'm making a little research project about programming languages e
> their respective IDEs
Paul Rubin wrote:
> Peter Hansen <[EMAIL PROTECTED]> writes:
>>If you focus on IDEs, your research will have pre-selected only
>>certain kinds of programmers and teams, and w
For the same reason that
def f(z):
z *= z
c = 1
f(c)
print c
prints 1.
Jeff
pgpF5jQBO3otJ.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 24 Sep 2005 16:06:06 +0200, Peter Hansen wrote
(in article <[EMAIL PROTECTED]>):
> Kalle Anke wrote:
>> On Fri, 23 Sep 2005 23:01:18 +0200, Larry Bates wrote:
>>
>>> but I'm not sure it is "better". I guess it depends
>>> on what you want to do with them after parsing.
>>
>> Sorry, I sh
Leo Jay wrote:
>Thanks for all of your replies.
>
>but my problem is not how to decompile .pyo or .pyc files.
>
>i used py2exe to compile my source file `hjparser.py' into
>`hjparser.exe' and other files. but i deleted the `hjparser.py' file
>by misoperation.(of cause, i tried to recover, but fail
Hello
I'm pretty new to Python and was wondering why the 'Square' method in
the following code doesn't work. It doesn't fail, just doesn't do
anything ( at least, not what I'd like! ). Why doesn't 'A.a' equal 2
after squaring?
TIA.
class FibonacciMatrix:
def __init__( self ):
self.a
I finally figured what I was missing. I forgot to import my Widget
class!!! I have imported Tkinter in the module for other GUI related
stuff. So Python was testing my Button class against Tkinter's Widget
class, and that's why the result was False. It finally made sense :)
Thank you Anand and
some thing platform independent will be preferable... (like a file like
interface for TK/Tcl)
--
http://mail.python.org/mailman/listinfo/python-list
I've got 2 differents sources of code, one for the main code (let's
call it Main), and the other one for plugins (let's call it Plugins).
The setup.py for Main is trivial and install all files in /site-packages/Main/. Thus, Works well.
My problem is because Plugins must go to:/site-packages/Main/
Kalle Anke wrote:
> On Fri, 23 Sep 2005 23:01:18 +0200, Larry Bates wrote:
>
>>but I'm not sure it is "better". I guess it depends
>>on what you want to do with them after parsing.
>
> Sorry, I should have been clearer. I want to parse the date and create a
> 'date object' that is a part of lar
Jan-Ole Esleben wrote:
> That doesn't really give him a way of using the class variable inside a
> method.
Oh! I must have misunderstood the question. I'd like to know more
about why the OP wants to do this; a small example would help narrow
down the possibilities.
--
Benji York
--
http://ma
Hi,
I have once seen a variant of "national brotherhood week" with
programming languages; 'all the python folk hate alle the perl folk and
all the ... hate all the ... and everybody hates Java', or something
like that, but I can't find it anymore. Does anyone remember it and is
anyone able to find
Last I looked, py2exe only kept the byte-compiiled versions of your
files, and not the raw source.
py2exe is just an archive, you can open it up in WinZip for example
and see your .pyc/pyo files.
That gets you part of the way there ... Then you would need to find a
way to "disassemble" the byte
Thanks for all of your replies.
but my problem is not how to decompile .pyo or .pyc files.
i used py2exe to compile my source file `hjparser.py' into
`hjparser.exe' and other files. but i deleted the `hjparser.py' file
by misoperation.(of cause, i tried to recover, but failed)
I opened the `hjpa
"Paul Boddie" <[EMAIL PROTECTED]> writes:
[...]
> I've just uploaded a patch/suggestion/module (#1301512) to SourceForge
> which seeks to provide the equivalent of os.startfile for KDE and GNOME
> (as well as Windows) as part of a generic desktop module:
>
> http://sourceforge.net/tracker/index.ph
Leo Jay wrote:
> Dear All,
>
> I lost my source code because of my incaution.
> so anyone can tell me how to decompile the exe file compiled by py2exe?
>
> Thanks.
>
> --
> Best Regards,
> Leo Jay
In older versions of py2exe (haven't tried it for new ones) I only had
to drag the py2exe created fi
Hi all,
Thanks to the people trying out Shed Skin 0.0.2 and letting me know
about several problems they encountered. I have released an updated
version, 0.0.3. It contains some fixes, adds support for several
builtin functions (sorted, xrange..) and the Windows version is now a
mere 3 MB, instead
"Johnny Lee" <[EMAIL PROTECTED]> writes:
> Fredrik Lundh wrote:
[...]
> To the HTMLParser, there is another problem (take my code for example):
>
> import urllib
> import formatter
> parser = htmllib.HTMLParser(formatter.NullFormatter())
> parser.feed(urllib.urlopen(baseUrl).read())
> parser.clos
Hi all,
Is there any way to get the details of a network card programatically
thro' Python? Moreover I would require to change the network
adapater/Card's Link state enabled/disabled also programatically.
Any help would be highly appericated.
Regards
Sreekanth
--
http://mail.python.org/mailman/li
Thomas Jollans wrote:
> interpreter. This is based on the assumption that py2exe really
> generates a pure exe and not an exe that interprets bytecode python.
> be that the case, it may yield decent results, but ugly nontheless.
It is - py2exe embeds python bytecodes. It seems it does it in the
"Fredrik Lundh" <[EMAIL PROTECTED]> writes:
[...]
> or, if you're going to parse HTML pages from many different sources, a
> real parser:
>
> from HTMLParser import HTMLParser
>
> class MyHTMLParser(HTMLParser):
>
> def handle_starttag(self, tag, attrs):
> if tag == "
Noam Raphael <[EMAIL PROTECTED]> writes:
> Fredrik Lundh wrote:
> >
> > you can enable new metadata fields in older versions by assigning to
> > the DistributionMetadata structure:
> >
> > try:
> > from distutils.dist import DistributionMetadata
> > DistributionMetadata.packa
That doesn't really give him a way of using the class variable inside a method.
Ole
2005/9/24, Benji York <[EMAIL PROTECTED]>:
> Carlos wrote:
> > Hi!
> >
> > class A:
> > X = 2
> > def F():
> > print A.X
> > F()
> >
> > The above fails because the name A is not
> > yet at global scope
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all
> I am a newbie and I just saw a ongoing thread on Fileprocessing which
> talks abt config parser.
> I have writen many pyhton program to parse many kind of text files by
> using string module and regex. But after reading that con
On Fri, 23 Sep 2005 23:01:18 +0200, Larry Bates wrote
(in article <[EMAIL PROTECTED]>):
> but I'm not sure it is "better". I guess it depends
> on what you want to do with them after parsing.
Sorry, I should have been clearer. I want to parse the date and create a
'date object' that is a part
Leo Jay wrote:
> Dear All,
>
> I lost my source code because of my incaution.
> so anyone can tell me how to decompile the exe file compiled by py2exe?
>
> Thanks.
>
> --
> Best Regards,
> Leo Jay
If you find a program that de-compiles exe to python, it will most
likely use very ugly, c-like p
76 matches
Mail list logo