Re: D-CM; Software Testers

2010-06-19 Thread Kruptein
> What does it *do*?
>
> The LP page is vague, "all those apps", then you're talking about
> various vague statements of Stuff Doing Stuff Together.
>
> But *what* is the stuff? The home page link on the LP page goes
> somewhere weird.
>
> So yeah. What's it *do*? I don't like downloading software until I have
> an idea of what its for :)
>
> --
>
>    Stephen Hansen
>    ... Also: Ixokai
>    ... Mail: me+list/python (AT) ixokai (DOT) io
>    ... Blog:http://meh.ixokai.io/

You're perfectly right about not doing that!

So the program is kind of a platform to which several addons can be
added.
I've made some base addons that work well together.
These addons are tools that you in my opinion need to develop certain
programs/websites
for example I've made a file-manager, a text-editor, ftp-manager, sql-
support

These are the only ones available for now, but I'm going to offer more
in the future and maybe there will come one day a third party addon :)

I hope this already cleared it up a bit.

So I've bundles all those programs in one large program that makes it
easy to interact between eachother and make it easy for the user to
change it to his taste (because he can add or delete other addons)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Installing or adding python dev installed python.

2010-06-19 Thread Robert Kern

On 6/19/10 9:49 PM, Vincent Davis wrote:

I have several versions of python installed and some I have built from
source which seems to install the python-dev on osx. I know that on
ubuntu python-dev is an optional install. The main python version I
use is the enthought distribution. Can I install the python-dev tools
with this? How. It there a good place for me to better understand what
python-dev is and how to get it installed on osx?


Question specifically about the Enthought Python Distribution should be directed 
to the epd-users mailing list:


  https://mail.enthought.com/mailman/listinfo/epd-users

However, to answer your question, there is no equivalent of a python-dev package 
for EPD or any of the Python distributions on OS X that I am aware of. All of 
them come with the necessary headers. On Linux distributions, Python 
installations are typically divided up into several packages; the python-dev(el) 
packages typically contain the header files and maybe a few other things for 
people building Python packages and extensions.


I suspect that you are asking this question because you are trying to build 
numpy and getting our message that says something along the lines of "I cannot 
find Python.h; please install the python-dev package". There is something else 
wrong with your environment. Please ask for help on either numpy-discussion or 
epd-users. Tell us exactly what you are doing and exactly the output you are 
getting (i.e., copy and paste your terminal session). If you have any relevant 
environment variables set for some reason (CFLAGS, CPPFLAGS, etc.) please let us 
know.


--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list


Installing or adding python dev installed python.

2010-06-19 Thread Vincent Davis
I have several versions of python installed and some I have built from
source which seems to install the python-dev on osx. I know that on
ubuntu python-dev is an optional install. The main python version I
use is the enthought distribution. Can I install the python-dev tools
with this? How. It there a good place for me to better understand what
python-dev is and how to get it installed on osx?

Thanks
Vincent
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: C interpreter in Lisp/scheme/python

2010-06-19 Thread Tim Rentsch
nanothermite911fbibustards 
writes:

>> Probably doesn't meet your intent, but this is a really impressive bit
>> of (whacky) art:
>
> Lisp runs faster than C. Once you get more time away from screwing
> Palestinians, and other false-flags, you will find ideas like these
>
> How to make Lisp go faster than C
> Didier Verna
> [snip]

Asking whether Lisp is faster than C is like asking why it's
colder in the mountains than it is in the summer.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: introducing Lettuce, BDD tool for python with Django integration

2010-06-19 Thread Gregory Ewing

Steven D'Aprano wrote:

I assume the one you're talking about is Behaviour Driven 
Development. Wikipedia defines it as:


BDD is a second-generation, outside-in, pull-based, 
multiple-stakeholder, multiple-scale, high-automation, 
agile methodology. It describes a cycle of interactions 
with well-defined outputs, resulting in the delivery of 
working, tested software that matters.


Oh, my goodness. My buzzword-density meter just flew off the
scale. Approach with caution -- the bogon flux may be lethal.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-19 Thread Terry Reedy

On 6/19/2010 2:53 PM, DivX wrote:

I found on the forum some discussion about crypting text and one guy
did make assembly implementation of crypting algorithm. He dynamically
generates mashine code and call that from python. Here are impressive
results http://www.daniweb.com/code/snippet216632-5.html

Is this better approach then writing extensions in c?


You have to define 'better'. This approach requires someone to write 
template assembler code, which will be machine specific. To be faster 
than compiled C on a particular machine, one must be pretty good at 
assemblee also.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-19 Thread Steven D'Aprano
On Sat, 19 Jun 2010 13:36:57 -0700, DivX wrote:

> On 19 lip, 21:18, geremy condra  wrote:
>> On Sat, Jun 19, 2010 at 11:53 AM, DivX  wrote:
>> > I found on the forum some discussion about crypting text and one guy
>> > did make assembly implementation of crypting algorithm. He
>> > dynamically generates mashine code and call that from python. Here
>> > are impressive
>> > resultshttp://www.daniweb.com/code/snippet216632-5.html
>>
>> > Is this better approach then writing extensions in c?
>>
>> No, xor cipher is not suitable for general purpose encryption, and what
>> do you need the speed for? xor is almost certainly not going to be the
>> bottleneck in your application.
>>
>> Geremy Condra
> 
> Just asking if this approach is good for example quicksort algoriths or
> some kind of sorting algorithms, or simulations but the point is of
> mixing python and assembler?


Ask yourself, why aren't programs written in assembly if it's so good?

(1) It's platform dependent. Do you really need a separate program for 
every single hardware platform you want to run Quicksort on?

(2) Writing assembler is hard, really hard. And even harder to debug.

(3) Modern C compilers can produce better (faster, more efficient) 
machine code than the best assembly code written by hand.


Honestly, this question has been resolved twenty years ago -- thirty 
years ago, maybe there was still a good point in writing general purpose 
code in assembly, but now? It's just showing off. Unless you're writing 
hardware specific code (e.g. device drivers) it is pointless, in my 
opinion.

I think that mixing assembly and python is a gimmick of very little 
practical significance. If you really need the extra performance, check 
out PyPy, Cython, Pyrex and Psyco.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb and bits

2010-06-19 Thread voidnothings
On Jun 13, 5:52 am, Dafydd Hughes  wrote:
> Hi there
>
> This is my first post to the list - please forgive me if this has been
> addressed elsewhere.
>
> I'm running MySQL 32-bit in Snow Leopard, and had MySQLdb working well.
> I switched to 64-bit, rebuilt MySQLdb, and again it worked fine within
> Python, but had to switch back to 32 bit - I'm using a wrapper for
> Python within Pure Data, and it forces Python to 32-bit.
>
> So back to 32-bit. It works fine wrapped in Pd, but if I try import
> MySQLdb from the terminal, I get:
>
>  >>> import MySQLdb
> Traceback (most recent call last):
>    File "", line 1, in 
>    File "build/bdist.macosx-10.6-fat/egg/MySQLdb/__init__.py", line 19,
> in 
>    File "build/bdist.macosx-10.6-fat/egg/_mysql.py", line 7, in 
>    File "build/bdist.macosx-10.6-fat/egg/_mysql.py", line 6, in
> __bootstrap__
> ImportError:
> dlopen(/Users/dafydd/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-fat.egg-tmp/_mysql.so,
> 2): no suitable image found.  Did find:
>
> /Users/dafydd/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-fat.egg-tmp/_mysql.so:
> mach-o, but wrong architecture
>
> Is there a solution to this? I assume this is happening because Python's
> trying to work 64-bit but MySQLdb was built 32. Am I way off base?
>
> Thanks for any help.
>
> cheers
> dafydd

I got the same problem though in a different scenario. I'm trying to
setup my local django environment here and mysql_python fails on me.
Same "...mach-o, but wrong architecture" message. Anyone?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 500 tracker orphans; we need more reviewers

2010-06-19 Thread Shashwat Anand
Terry: Thanks for bringing this to notice.
Mark: Kudos for your effort in cleaning up bugs.python.org

On Sat, Jun 19, 2010 at 10:16 PM, Mark Lawrence wrote:

> On 19/06/2010 03:37, Terry Reedy wrote:
>
>> Go to the bottom of
>> http://bugs.python.org/iss...@template=search&status=1
>> enter 1 in the Message Count box and hit Search.
>>
>> At the moment, this gets 510 hits. Some have had headers updated, nearly
>> half have had a person add himself as 'nosy' (put 1 in the Nosy count
>> box to count those that have not), but none have a written response.
>>
>> In the past two weeks, I have commented on some old orphans and gotten a
>> couple of previously orphaned patches applied and the issue closed. But
>> I am not prepared to spend my whole life on this ;=).
>>
>> We need more issue reviewers.
>> Clearly.
>> If you want to contibute, opportunity is here.
>> With 500 orphans, and 2200 other open issues,
>> there must be something that matches your interests and abilities.
>> Use other search fields to narrow the choices.
>>
>> If you want to contibute to the tracker, this may help:
>> http://wiki.python.org/moin/TrackerDocs/
>> Then read examples of comments already there.
>>
>> Or consider my first-response comment to
>> http://bugs.python.org/issue8990
>>
>> To write that, I
>>
>> * verified the reported behavior, though I forgot to explicitly say so;
>> when doing so, include version and system (such as 3.1.2, WinXP), as
>> that is sometimes helpful.
>>
>> * read the relevant doc section and pasted it in to establish a basis
>> for discussion (the OP might have done that, but did not, so I did).
>>
>> Everyone reading this should at least be able to do this much for an
>> issue like this, and this much *is* helpful.
>>
>> * compared behavior and doc and concluded that there is a bug.
>>
>> * read the posted patch as best I could, which is not much in this case,
>> but it at least looked like a real diff file.
>>
>> * noticed that the diff did *not* patch the appropriate unit test file.
>>
>> * discussed two possible fixes and identified which the OP choose.
>>
>> * wrote an 'executive summary' both for the OP and future reviewers.
>>
>> Oh yes, I also adjusted the headers. Although new reviewers cannot do
>> that, you *can* suggest in the message what changes to make.
>>
>> Special offer to readers of this thread, especially new reviewers:
>> if you make such a suggestion, you may email me, subject: Tracker, with
>> one clickable link like the above, cut and pasted from the browser URL
>> box, per line of the message.
>>
>> Perhaps you are shy and uncomfortable saying much. Well so was I. I
>> started about 5 years ago with *safe* comments and have s l o w l y
>> expanded my comfort zone. The shock of discovering this week that there
>> are 500 orphans, some 2 years old, expanded it. After no response for a
>> year or two, even an imperfect response must be better than nothing.
>>
>> While there is occasional negativity on the tracker, I believe it
>> averages less per message than python-list, which itself is pretty decent.
>>
>> Terry Jan Reedy
>>
>>
> Ok, but I'm going for EAFP rather than LBYL.  I have written a will. :)
>
> Kindest regards.
>
> Mark Lawrence.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: exceptions and unicode

2010-06-19 Thread Stuart McGraw
On 06/16/2010 03:51 PM, Thomas Jollans wrote:
> On 06/16/2010 10:10 PM, Stuart McGraw wrote:
>> Note that the exceptions may be anything (I just used IOError 
>> as an example) and are generated in bowels of an API that I 
>> can't/won't mess with.
> 
> Yeah, well, you'd have to special-case every single exception type that
> gets unicode arguments, as they probably all treat them in the same
> ungrateful way.

Unfortunate.  In general it does not seem possible to know what 
exceptions could be generated (they could be custom exceptions 
defined in the api) without examining all the code. 

Seems like I'll have to live with it or try some grotesque hack 
like looking for a repr-of-a-unicode-string-like text and converting
back to unicode.

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: exceptions and unicode

2010-06-19 Thread Stuart McGraw
On 06/16/2010 03:53 PM, Martin v. Loewis wrote:
>> So how do I get what I want?
> 
> Submit a patch. You would have to explain why this is a bug fix and not 
> a new feature, as new features are not allowed anymore for 2.x.

Thanks.  Actually I have no idea if this is a bug or a feature 
(despite reading bug tracker issues 2517 and 6108, most of which
I did not understand) so I'm not in a position to argue either.  
What I think I'll do is note in my documentation that the unreadable
error messages are from Python and are only temporary for a couple 
years until the app can move to Python 3. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-19 Thread DivX
On 19 lip, 21:18, geremy condra  wrote:
> On Sat, Jun 19, 2010 at 11:53 AM, DivX  wrote:
> > I found on the forum some discussion about crypting text and one guy
> > did make assembly implementation of crypting algorithm. He dynamically
> > generates mashine code and call that from python. Here are impressive
> > resultshttp://www.daniweb.com/code/snippet216632-5.html
>
> > Is this better approach then writing extensions in c?
>
> No, xor cipher is not suitable for general purpose encryption, and what do you
> need the speed for? xor is almost certainly not going to be the bottleneck in
> your application.
>
> Geremy Condra

Just asking if this approach is good for example quicksort algoriths
or some kind of sorting algorithms, or simulations but the point is of
mixing python and assembler?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overriding "__setattr__" of a module - possible?

2010-06-19 Thread Fuzzyman
On Jun 18, 5:25 am, "Gabriel Genellina" 
wrote:
> En Thu, 17 Jun 2010 07:12:23 -0300, Fuzzyman  escribi�:
>
> > On Jun 17, 10:29 am, "Gabriel Genellina" 
> > wrote:
> >> En Thu, 17 Jun 2010 04:52:48 -0300, Alf P. Steinbach   
> >> escribi�:
>
> >> > But who would have thunk that Python *isn't dynamic enough*? :-)
>
> >> Yep... There are other examples too (e.g. the print statement in 2.x  
> >> bypasses sys.stdout.write;
>
> > What do you mean by this? The print statement in 2.x does *not* bypass
> > sys.stdout. It may use other methods besides write (writeln perhaps)
> > but you can *definitely* override sys.stdout to capture the output
> > from print statements.
>
> Suppose you want to implement a "tee" variant in Python: print output
> should go to stdout and also to some file (with timestamp added, just to
> be fancy). First attempt:
>
> py> import sys
> py> import time
> py>
> py> class tee(file):
> ...   def write(self, data):
> ...     file.write(self, '%s: %r\n' % (time.ctime(), data))
> ...     sys.__stdout__.write(data)
> ...
> py> sys.stdout = tee('test.txt', 'w')
> py> print "Hello world"
> py> print "Bye"
> py> ^Z
>
> D:\TEMP>type test.txt
> Hello world
> Bye
>
> Note:
> - no output to stdout inside the interpreter
> - no timestamp in the file
>
> This modified version works fine:
>
> py> class tee():
> ...   def __init__(self, filename, mode):
> ...     self.file = open(filename, mode)
> ...   def write(self, data):
> ...     self.file.write('%s: %r\n' % (time.ctime(), data))
> ...     sys.__stdout__.write(data)
>
> What happened? When sys.stdout is an instance of some class inheriting
>    from file (that is, isinstance(sys.stdout, file) is true) then the print
> statement ignores sys.stdout.write() completely -- instead it calls
> directly some C stdio functions (fwrite).
> The only way to influence 'print' is *not* to inherit from file in the
> first place.
>
> It's an optimization, sure.  I guess it is there before inheriting from
> builtin types was allowed (in such scenario, it's a perfectly valid
> optimization).  Now, perhaps the test for 'file' should be more strict,
> only taking the C shortcut when using an actual file instance, not a
> subclass of it.  This would allow the example above to work correctly.
>


Ah, so by "bypasses" you mean "under certain specific circumstances
bypasses".  By all means file a bug report on this, I agree that
bypassing the optimization for file subclasses (assuming your
diagnosis is correct) would be a sensible approach.

All the best,

Michael


> --
> Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-19 Thread geremy condra
On Sat, Jun 19, 2010 at 11:53 AM, DivX  wrote:
> I found on the forum some discussion about crypting text and one guy
> did make assembly implementation of crypting algorithm. He dynamically
> generates mashine code and call that from python. Here are impressive
> results http://www.daniweb.com/code/snippet216632-5.html
>
> Is this better approach then writing extensions in c?

No, xor cipher is not suitable for general purpose encryption, and what do you
need the speed for? xor is almost certainly not going to be the bottleneck in
your application.

Geremy Condra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: D-CM; Software Testers

2010-06-19 Thread Stephen Hansen
On 6/19/10 11:16 AM, Kruptein wrote:
> Okay so I just released the 0.2-alpha version of my project and I'm
> looking for people that would like to test it.
> 
> It is written in python with the wxpython gui bindings  and is aimed
> to help developers.
> 
> You can find more info on launchpad: http://launchpad.net/d-cm

What does it *do*?

The LP page is vague, "all those apps", then you're talking about
various vague statements of Stuff Doing Stuff Together.

But *what* is the stuff? The home page link on the LP page goes
somewhere weird.

So yeah. What's it *do*? I don't like downloading software until I have
an idea of what its for :)

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: If Not CGI...

2010-06-19 Thread Tim Chase

I've caught a lot of flack (imagine that) about using CGI.


The main reason is that CGI has the overhead of loading & 
unloading the Python interpreter on every request.  The other 
methods load the Python interpreter once (or a small, 
fixed-number of times), then handle lots of requests from that 
process (or pool of processes), and then optionally unload if 
server-load drops.


However CGI is old and fairly entrenched, so it's easy to find 
with cheap hosting services -- what do they care if your site is 
slow?



I understand there are several other options, to wit:
mod_python, fastcgi and wcgi. I've messed around with
mod_python without luck. What are your suggestions?


Generally, one writes to a framework (Django[1], web.py[2], 
TurboGears[3], CherryPy[4], etc) that either has a 
preferred/suggested method of interface, or allows you to plug 
into [m]any of the items you list.  I know Django is happy with 
mod_python and wsgi (and I suspect fastcgi, but I'll let you 
google that).  YMMV with the others.  I've even seen an 
abomination of a hack that ran Django under CGI (whie, is the 
performance bad!).  I think the general direction of the Python 
web-world seems to be moving toward WSGI (and Graham Dumpleton's 
work on mod_wsgi[5]; IIUC, he was heavily involved in the initial 
mod_python) instead of mod_python.


Since you seem fairly adamant about *not* using a framework and 
cobbling together the universe from the ground up, you might look 
into Paul Boddie's "WebStack"[6] which abstracts away a number of 
the main interfaces into a common interface.  Kindly, his work 
even allows you to plug into a CGI interface since that's what 
you're familiar with, and then shift to a different interface.


-tkc


[1]
http://djangoproject.com

[2]
http://turbogears.org

[3]
http://webpy.org

[4]
http://www.cherrypy.org

[5]
http://code.google.com/p/modwsgi/

[6]
http://www.boddie.org.uk/python/WebStack.html






--
http://mail.python.org/mailman/listinfo/python-list


Is this make sence? Dynamic assembler for python

2010-06-19 Thread DivX
I found on the forum some discussion about crypting text and one guy
did make assembly implementation of crypting algorithm. He dynamically
generates mashine code and call that from python. Here are impressive
results http://www.daniweb.com/code/snippet216632-5.html

Is this better approach then writing extensions in c?
-- 
http://mail.python.org/mailman/listinfo/python-list


D-CM; Software Testers

2010-06-19 Thread Kruptein
Okay so I just released the 0.2-alpha version of my project and I'm
looking for people that would like to test it.

It is written in python with the wxpython gui bindings  and is aimed
to help developers.

You can find more info on launchpad: http://launchpad.net/d-cm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: If Not CGI...

2010-06-19 Thread Stephen Hansen
On 6/19/10 10:31 AM, Victor Subervi wrote:
> Hi;
> I've caught a lot of flack (imagine that) about using CGI. I understand
> there are several other options, to wit: mod_python, fastcgi and wcgi. I've
> messed around with mod_python without luck. What are your suggestions?

Its a slightly complicated question.

First of all, it is not absolutely *wrong* to use CGI. Its just simply
decades out of date, slow, and has certain problems.

Primarily, that one must start Python for each and every request. That
adds up: that adds up a LOT over time.

The "solution" to all of these are various methods to run Python once,
and keep it running and loaded, and simply call into it (i.e., execute
some function you've defined) for those requests that need to be dynamic.

mod_python accomplishes this by embedding Python into Apache directly.
After you set it all up, there's various ways you can access it. The
simplest is the publisher handler. With it, you can 'call' a Python
function by linking to, say, /myform.py/view -- it'll call the 'view'
function in 'myform.py'.

With it, check out
http://www.modpython.org/live/current/doc-html/tutorial.html

"without luck" is a worthless statement to make, so I can't comment on it.

But with mod_python, you wouldn't just be running it and then running
your existing code as-is. The interface between the web server and your
code is different in it, so you'll have to reorganize some stuff.

FastCGI is a different kind of approach to the problem; it launches
Python alongside Apache, and that Python stays alive forever. It just
redirects requests to said process when they come in. I know very little
about this model, but believe its meant to sort of mimic a CGI
environment so you can sort of migrate to it easier, but I'm not
entirely sure. So I can't comment on this directly, but
http://docs.python.org/howto/webservers.html seems interesting (Though
it speaks of ALL of these options, so is a good read anyways)

Then there's mod_wsgi; this is like mod_python, but approaches the
problem differently, with a bit more formal structure with an eye for
interoperability. It implements the Web Server Gateway Interface
specification, and lets you easily load up "wsgi apps" and "wsgi
frameworks" which are a very, very nifty way to write modern web
applications.

But the thing is: a WSGI web application looks and is shaped nothing
like a CGI application. They're awesome. Btu different. Writing a WSGI
app from scratch without a framework is possible, but it seems like a
terribly painful thing to go about doing.

Instead, most people who are writing modern Python web applications, use
some sort of framework.

Django is one of the most popular. I like it. But I prefer pylons-- its
a little more low level, and that suits me. There's also TurboGears,
webpy, and on and on and on.

The cool thing about WSGI applications is that they are "stacks";
there's a lot of "middleware" that can sit between the server and your
end-application. You can add features and functionality and capabilities
to your app just by adding another piece of middleware.

For example, do you want to store state about what a user is doing? The
things in their shopping cart, for example? A really, really elegant way
is to use a "session" middleware -- Beaker for instance. It creates a
unique session key, and sets it on the user's cookies. In your web
application now, you can associate any kind of data you'd like with that
key. And you can even remember stuff about that user if they return to
your app later.

Now, you could do that all by hand-- but its painful, and doing it right
is not trivial.

My suggestion? I can't really give you one. You're in the middle of a
project. Doing it "right" from this point is basically a rewrite --
though it may not take as long as you suspect, if you use something like
Django which is -very- easy.

So maybe my suggestion is for now, to figure out what's wrong with
mod_python for you. It works just fine.

But then when this project is over, sit down and load up Django (or
another of the options: look around, find one that tickles you), and
spend a few days re-doing this project in that. Not for real, but for
practice, to figure out how you'd do it in a proper framework. See how
you like it. See how it works.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

P.S. An added plus to the WSGI app's: they'll encourage (nay, force) you
to write better code. Including some encapsulation and classes and such.
Which is not to say that procedural programming is /wrong/, but, for a
lot of things, mixing in at least a little bit of OOP (even if you do
not buy the OOP koolaid) just for organizational purposes is utter win.
-- 
http://mail.python.org/mailman/listinfo/python-list


If Not CGI...

2010-06-19 Thread Victor Subervi
Hi;
I've caught a lot of flack (imagine that) about using CGI. I understand
there are several other options, to wit: mod_python, fastcgi and wcgi. I've
messed around with mod_python without luck. What are your suggestions?
TIA.
beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 500 tracker orphans; we need more reviewers

2010-06-19 Thread Mark Lawrence

On 19/06/2010 03:37, Terry Reedy wrote:

Go to the bottom of
http://bugs.python.org/iss...@template=search&status=1
enter 1 in the Message Count box and hit Search.

At the moment, this gets 510 hits. Some have had headers updated, nearly
half have had a person add himself as 'nosy' (put 1 in the Nosy count
box to count those that have not), but none have a written response.

In the past two weeks, I have commented on some old orphans and gotten a
couple of previously orphaned patches applied and the issue closed. But
I am not prepared to spend my whole life on this ;=).

We need more issue reviewers.
Clearly.
If you want to contibute, opportunity is here.
With 500 orphans, and 2200 other open issues,
there must be something that matches your interests and abilities.
Use other search fields to narrow the choices.

If you want to contibute to the tracker, this may help:
http://wiki.python.org/moin/TrackerDocs/
Then read examples of comments already there.

Or consider my first-response comment to
http://bugs.python.org/issue8990

To write that, I

* verified the reported behavior, though I forgot to explicitly say so;
when doing so, include version and system (such as 3.1.2, WinXP), as
that is sometimes helpful.

* read the relevant doc section and pasted it in to establish a basis
for discussion (the OP might have done that, but did not, so I did).

Everyone reading this should at least be able to do this much for an
issue like this, and this much *is* helpful.

* compared behavior and doc and concluded that there is a bug.

* read the posted patch as best I could, which is not much in this case,
but it at least looked like a real diff file.

* noticed that the diff did *not* patch the appropriate unit test file.

* discussed two possible fixes and identified which the OP choose.

* wrote an 'executive summary' both for the OP and future reviewers.

Oh yes, I also adjusted the headers. Although new reviewers cannot do
that, you *can* suggest in the message what changes to make.

Special offer to readers of this thread, especially new reviewers:
if you make such a suggestion, you may email me, subject: Tracker, with
one clickable link like the above, cut and pasted from the browser URL
box, per line of the message.

Perhaps you are shy and uncomfortable saying much. Well so was I. I
started about 5 years ago with *safe* comments and have s l o w l y
expanded my comfort zone. The shock of discovering this week that there
are 500 orphans, some 2 years old, expanded it. After no response for a
year or two, even an imperfect response must be better than nothing.

While there is occasional negativity on the tracker, I believe it
averages less per message than python-list, which itself is pretty decent.

Terry Jan Reedy



Ok, but I'm going for EAFP rather than LBYL.  I have written a will. :)

Kindest regards.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Help with suds: HTTP Error 401

2010-06-19 Thread Sean DiZazzo
On Jun 11, 5:27 am, Eric von Horst  wrote:

> I have small program that tries to open a wsdl. When I execute the
> program I am getting 'suds.transport.TransportError: HTTP Error 401:
> Unauthorized'

Hey Eric,

Im a suds noob as well.  I found some code that led me to the below
example.  It worked for me when connecting to one particular site.  I
couldnt tell you why though...  I guess its worth a shot.

from suds.transport.https import HttpAuthenticated
import urllib2

t = HttpAuthenticated(username='me', password='password')
t.handler = urllib2.HTTPBasicAuthHandler(t.pm)
t.urlopener =  urllib2.build_opener(t.handler)
c = client.Client(url='http://xxx.xxx.xxx.xxx/path/to?
WSDL',transport=t)

~Sean
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: scraping from bundes-telefonbuch.de with python

2010-06-19 Thread Michael Torrie
On 06/19/2010 04:23 AM, davidgp wrote:
> opener = urllib2.build_opener()
> opener.addheaders = [('User-Agent', 'Mozilla/5.0 (compatible;
> Konqueror/3.5; Linux) KHTML/3.5.4 (like Gecko)')]
> urllib2.install_opener(opener)
> 
> data = urllib.urlencode({'F0': 'mySearchKeyword','B': 'T','F8': 'A ||
> G','W': '1','Z': '0','HA': '10','SAS_static_0_treffer_treffer': 'Suche
> starten','S': '1','translationtemplate': 'checkstrasse'})
> 
> url = 'http://www.bundes-telefonbuch.de/cgi-btbneu/chtml/chtml?WA=20'
> response = urllib2.urlopen(url, data)
> 
> this returns a page saying i have to reenter my search terms..
> what's going wrong here?

Most likely you need a cookie.  You'll probably have to set up a cookie
store for use with urllib2, then request the page that the search form
is on so that the cookie is generated, and then make your post with your
search terms.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: catching my own exception

2010-06-19 Thread Nikola Skoric
Dana 18 Jun 2010 17:45:31 GMT, 
Steven D'Aprano  kaze:
> Other than that, I notice that your module throws away useful debugging 
> information, and replaces it with bland, useless pap of no nutritional 
> value:
>
> try:
> import account, fetch, resources, const
> except Exception:
> raise Exception('One or more travapi modules not available.')

Oh, yes, thanks for pointing that out, that was a dirty hack for
solving some error I was getting with pydoc. I'll remove that, thanks
for pointing that out.

-- 
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: catching my own exception

2010-06-19 Thread Nikola Skoric
Dana Fri, 18 Jun 2010 20:01:45 +0200, 
Peter Otten <__pete...@web.de> kaze:
> Solution: move your startup code into a separate file and have it import the 
> village module.

Excellent, thanks! Everything works now, but I still don't quite get what the 
problem is...

> You are importing your main script elswhere. Your code then 
> effectively becomes
>
> try:
> # in another module
> raise village.SomethingBuiltError 
> except __main__.SomethingBeingBuiltError:
>print "caught"
>
> i. e. you get two versions of every class that are built from the same code 
> but not (recognized as) identical.

What I don't get is: what do you mean I'm importing my main script
elsewhere by runing "python village.py"? SomethingBuiltError is
defined in the same script that I'm runing, I didn't import it, did I?
If you could please clear it up for me... or point me to relevant
literature, that's also cool, I couldn't find this thing explained
anywhere.

Anyway, thanks for the solution!

-- 
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: scraping from bundes-telefonbuch.de with python

2010-06-19 Thread Rebelo
On 19 lip, 12:23, davidgp  wrote:
> hello, i'm new on this group, and quiet new to python!
> i'm trying to scrap some adress data from bundes-telefonbuch.de but i
> run into a problem:
> the link is like 
> this:http://www.bundes-telefonbuch.de/cgi-btbneu/chtml/chtml?WA=20
> and it is basically the same for every search query.
> thus i need to submit post data to the webserver, i try to do this
> like this:
>
> opener = urllib2.build_opener()
> opener.addheaders = [('User-Agent', 'Mozilla/5.0 (compatible;
> Konqueror/3.5; Linux) KHTML/3.5.4 (like Gecko)')]
> urllib2.install_opener(opener)
>
> data = urllib.urlencode({'F0': 'mySearchKeyword','B': 'T','F8': 'A ||
> G','W': '1','Z': '0','HA': '10','SAS_static_0_treffer_treffer': 'Suche
> starten','S': '1','translationtemplate': 'checkstrasse'})
>
> url = 'http://www.bundes-telefonbuch.de/cgi-btbneu/chtml/chtml?WA=20'
> response = urllib2.urlopen(url, data)
>
> this returns a page saying i have to reenter my search terms..
> what's going wrong here?
>
> Thanks!!

Try mechanize : http://wwwsearch.sourceforge.net/mechanize/

import mechanize
response = mechanize.urlopen("http://www.bundes-telefonbuch.de/";)
forms = mechanize.ParseResponse(response, backwards_compat=False)
form = forms[0]
form["F0"] = "query" #enter query
html =  mechanize.urlopen(form.click()).read()
f = open("tmp.html","w")
f.writelines(html)
f.close()

Or you can try to parse response but I think that their HTML is not
valid
-- 
http://mail.python.org/mailman/listinfo/python-list


MAKE UPTO $5000 PER MONTH! $2000 IN FIRST 30 DAYS!

2010-06-19 Thread benadict raj
MAKE UPTO $5000 PER MONTH! $2000 IN FIRST 30 DAYS!

Generate $50 to $100 whenever you have a couple of hours free time
tospare.
You could make $50 or more in the next 2 hours. Starting right Now!
Today!
Awesome earnings get paid for your honest work
Join as a free member and get paid to your bank account
To join the Network follow the link

http://www.go-easy-money.com/home.html?a_aid=4c0be5bc81f9c

Get paid for your real work and earn awesome 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pythonize this!

2010-06-19 Thread Mark Lawrence

On 19/06/2010 11:36, Stefan Behnel wrote:

Mark Lawrence, 18.06.2010 17:53:

... *AND* (looking at your email address) Germany loosing in the world
cup. :(


Yep, we always do that once at the early stages of a world cup. Pretty
good camouflage, still works most of the time.

Stefan



Yes, but trying to be fair the Spanish referee for your game was crap. 
England had no excuses what so ever for their pathetic performance last 
night, unless they were trying to emulate your camouflage.  The only 
good thing about it is that I have an excuse to go out and drown my 
sorrows. :)


Mark.

--
http://mail.python.org/mailman/listinfo/python-list


Re: pythonize this!

2010-06-19 Thread Stefan Behnel

Mark Lawrence, 18.06.2010 17:53:

... *AND* (looking at your email address) Germany loosing in the world
cup. :(


Yep, we always do that once at the early stages of a world cup. Pretty good 
camouflage, still works most of the time.


Stefan

--
http://mail.python.org/mailman/listinfo/python-list


scraping from bundes-telefonbuch.de with python

2010-06-19 Thread davidgp
hello, i'm new on this group, and quiet new to python!
i'm trying to scrap some adress data from bundes-telefonbuch.de but i
run into a problem:
the link is like this: 
http://www.bundes-telefonbuch.de/cgi-btbneu/chtml/chtml?WA=20
and it is basically the same for every search query.
thus i need to submit post data to the webserver, i try to do this
like this:

opener = urllib2.build_opener()
opener.addheaders = [('User-Agent', 'Mozilla/5.0 (compatible;
Konqueror/3.5; Linux) KHTML/3.5.4 (like Gecko)')]
urllib2.install_opener(opener)

data = urllib.urlencode({'F0': 'mySearchKeyword','B': 'T','F8': 'A ||
G','W': '1','Z': '0','HA': '10','SAS_static_0_treffer_treffer': 'Suche
starten','S': '1','translationtemplate': 'checkstrasse'})

url = 'http://www.bundes-telefonbuch.de/cgi-btbneu/chtml/chtml?WA=20'
response = urllib2.urlopen(url, data)

this returns a page saying i have to reenter my search terms..
what's going wrong here?

Thanks!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pythonize this!

2010-06-19 Thread Andre Alexander Bell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/18/2010 05:53 PM, Mark Lawrence wrote:
> Andre, looks like a really bad day for you then, *TWO* nights out with
> me *AND* (looking at your email address) Germany loosing in the world
> cup. :(

There are days one looses and there are days the others win... ;)

Andre

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwckGYACgkQnuHMhboRh6QvDACfSAzSKvE90a9YY51ab2nksYd7
gOkAoNV5YvXLddtgeYBqqWFqGsB5fXlL
=w4uA
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to get bit info

2010-06-19 Thread Anssi Saari
Back9  writes:

> Hi,
>
> I have one byte data and want to know each bit info,
> I mean how I can know each bit is set or not?

Other than the tedious anding, oring and shifting, you can convert
your byte to a string (with function bin) and use normal string
handling functions to check if individual bits are 0 or 1. 

String format is also handy if you happen to need to do things like
reversing the bit order or slicing and joining together various bits
from different bytes.

I seem to invariably need to do some bit order reversing when I mess
around with serial data, which is one reason why I like Python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subprocess in Command promt+ webbrowser

2010-06-19 Thread shanti bhushan
On Jun 19, 11:01 am, shanti bhushan  wrote:
> I have a code ,in which i invoke the local webserver in back
> ground ,then open URL and access the web page.
> below is my code.
> I am able to invoke and kill the local webserver in seperate python
> script,but when i club opening of browser and and subprocess , my like
> below ,then my script is not responding.
> Please guide me.
>
> import subprocess
> import time
> subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
> \mongoose-2.8.exe -root D:\New1\ >YourOutput.txt"')
> webbrowser.open("http://43.88.79.229:8080/index.html/";)
> time.sleep(11)
> subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
> mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
> time.sleep(3)
> subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
> \mongoose-2.8.exe -root D:\New1\ >YourOutput.txt"')
> webbrowser.open("http://43.88.79.229:8080/index.html/";)
> time.sleep(11)
> subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /c "taskkill /F /IM
> mongoose-2.8.exe >YourOutput1.txt"') # kill in back ground
> time.sleep(3)
> subprocess.Popen(r'C:\WINDOWS\system32\cmd.exe /C "D:\372\pythonweb
> \mongoose-2.8.exe -root D:\New2\ >YourOutput.txt"')
> webbrowser.open("http://43.88.79.229:8080/index.html/";)


if i want to put exception handing for invoking the local web
server ?? how to do that please guide
-- 
http://mail.python.org/mailman/listinfo/python-list