FlightFeather Social Networking Platform + site for office politics, etc.

2006-12-30 Thread George Belotsky

FlightFeather's goal is social networking for everyone.  This means
that *anyone* should have a chance to run a *popular* social
networking site -- on minimal hardware, and without wasting bandwidth.

Although the project is in its early stages, it is functional, and
supports the BoSStats web application.  BoSStats is a site dedicated
to improving the world of work: you can discuss what makes a good
boss, or share your experiences of office politics. You can also
comment and vote on the posts made by others.  The application does
not set cookies, and no registration is required for anything except
voting.


  http://www.bosstats.com/


Follow the Platform link on the above site to download the
FlightFeather source code (released under the GPL).  BoSStats is a
good testbed for FlightFeather, and has value of its own, since
meaningful advice about work-related problems is very hard to find.  A
Wisdom of Crowds solution -- particularly with strong privacy
protection (see below) -- is a necessary addition to this field.

The major design focus for FlightFeather are responsiveness and
performance; the system should eventually support very high traffic
volumes.  In addition, FlightFeather allows for a great deal of user
privacy -- a critical, rapidly emerging problem in the social
networking realm.

FlightFeather's most important feature is that all write requests
generate (or modify) HTML files.  In consequence, a pure read (the
most common operation) merely serves static pages.

This architecture strongly favors the use of Python, because of the
complex logic required to manipulate an entire tree of text files.
Expressing this logic clearly and succinctly is the key to
maintainability of the code.

The Python 2.5 with statement has proved to be particularly valuable
for FlightFeather development.  The implementation started with Python
2.4, and switched to Python 2.5 once that release became stable.

Rewriting parts of FlightFeather using the with statement
immediately simplified the system's file handling logic.  This feature
alone is reason enough to use Python 2.5.

Everyone feel free to try out FlightFeather/BoSStats, and give me
feedback either on the site itself, or by email.  You can post any
appropriate content to the site, as the system is live.


Best Wishes for the Holidays,


George Belotsky
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


parakeet 0.1.0 - web-based reporting for PyKota

2006-12-30 Thread Andrew Ross
Parakeet is a TurboGears (http://www.turbogears.org) application
intended to provide a rich web interface for reporting on print quotas
managed by PyKota (http://www.pykota.org) and CUPS (http://www.cups.org).

The 0.1.0 release is aimed solely at developers already familiar with
PyKota, LDAP and TurboGears. It allows end-users to log in and view
their current balance, as well as a list of recently printed jobs.

Parakeet is licensed under the GPL, and is available for download from
http://cheeseshop.python.org/pypi/parakeet

Cheers

Andrew







signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: INSERT statements not INSERTING when using mysql from python

2006-12-30 Thread Tim Roberts
Ben [EMAIL PROTECTED] wrote:

Perhaps when I'm checking for table existance using mysql through
python I have to be more explicit:

Where I did have:
USE database;
IF NOT EXISTS CREATE table(.

Perhaps I need:
USE database;
IF NOT EXISTS CREATE database.table(.

I'll try it after lunch. Does anyoone know whether this might be the
problem?

The IF NOT EXISTS clauses are not standard SQL; they are MySQL
extensions.  Although my reasons are nebulous and more related to principle
than to practicality, I try never to use them, because they might not be
available in my next database.

After all, you should have a pretty good idea at any given time whether
your database and table already exist.

I do occasionally allow myself a DROP TABLE IF NOT EXISTS, which then
allows the unadulterated CREATE TABLE command.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Steven D'Aprano
On Fri, 29 Dec 2006 19:35:22 -0800, Beliavsky wrote:

 Especially I like:
 - more relaxed behavior of exceeded the upper limit of a (1-dimensional)
   array
 
 Could you explain what this means? In general, I don't want a
 programming language to be relaxed about exceeding array bounds.

I'm not sure about SciPy, but lists in standard Python allow this:

 array = [1, 2, 3, 4]
 array[2:5]
[3, 4]

That's generally a good thing.




-- 
Steven.

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


Re: Easiest way to print from XP/DOS.

2006-12-30 Thread Tim Roberts
jim-on-linux [EMAIL PROTECTED] wrote:

Did you run from a file or type in from keyboard?

When the client runs the utility program  the 
output file is built but nothing prints and no 
messages appear. When I typed from keyboard on an 
xp pro at c:\, I got the message.

Is it possible that  virus detector or some 
self.defense software is interacting?

It is quite possible that they simply do not have a printer hooked up to
their computer's parallel port.  If all of your printers are from network
shares, then the special file prn will not go anywhere.

Typing to prn is a dreadful way to do printing on Windows.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Easiest way to print from XP/DOS.

2006-12-30 Thread Tim Golden
jim-on-linux wrote:

 The utility creates a text file that is sent to
 the printer with the statement below.
os.system('type ' +FileName+ ' prn'),
 and the file prints.

 But, from an xp machine if I try to print using
 the same statement,  I get a question on the dos
 screen which reads something like this;
   Which program authorized this operation?

 Since I don't have an xp machine, the statement
 above may not be exact, but you get the idea.

You might want to look at this for some more
conventional approaches to printing under
windows:

http://timgolden.me.uk/python/win32_how_do_i/print.html

Specifically, I think you want the second option.

TJG

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


Re: Why does Python never add itself to the Windows path?

2006-12-30 Thread Eric Pederson
Ben Sizer wrote:

I've installed several different versions of Python across several
different versions of MS Windows, and not a single time was the Python
directory or the Scripts subdirectory added to the PATH environment
variable. Every time, I've had to go through and add this by hand, to
have something resembling a usable Python installation. No such
problems on Linux, whether it be Mandrake/Mandriva, Fedora Core, or
Kubuntu. So why is the Windows install half-crippled by default? I just
rediscovered this today when trying to run one of the Turbogears
scripts, but this has puzzled me for years now.


+1

It is a pain for me because it is something I need to remember to do 
maybe once a year or less.

It seems best practice with Windows is to throw away the machine every 2 
years - so much crap gets automatically installed in places and ways not 
solicited I'd think only cybermonks get away clean.  That the Python 
install is a good citizen in this regard is noble, but does it really 
make a difference in regard to the overall Windows installation?  And is 
that difference worth the recurring pain of not having Python on the 
path automatically?

There must be hundreds of programs on the PATH of the machine I type on, 
its ugly.  And lets not even talk about the Registry.  Time to throw 
away the machine. That's what I get for being a cheap slut for any 
interesting program.


Windows will never be UNIX, invest in penicillin.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DOS, UNIX and tabs

2006-12-30 Thread Sebastian 'lunar' Wiesner
Paul McNett [EMAIL PROTECTED] typed

 Steven D'Aprano wrote:
 But I think we all agree that mixing tabs and spaces is A Very Bad
 Thing.
 
 I like mixing tabs and spaces, actually. Tabs for indentation, and
 additional spaces to make the code look pretty. Somebody please tell
 me why this is bad and I'll stop.
 
 class Apple(object):
 def contrived_example_function(self, argument1, argument2,
 argument3, argument4):
 print hello, world
 
 Apparently, emacs in python mode follows this convention, too.

That doesn't seem like a standard settings to me. I can't remember
changing the indentation settings for python, nonetheless my gnu emacs
uses four spaces for indentation. Placing wrapped lines into ordered
columns is done by inserting additional spaces. This all happens
automatically; you never need to insert spaces manually...

 I like it because I get the best of both worlds: the only thing
 against using tabs-only-indentation is that wrapping long lines can be
 quite ugly, while space-only-indentation allows for beautifying it
 somewhat by lining up the columns to match.

Did you try to open your code files with another editor, which has a
different length for tabulator chars? It would look quite ugly, I
guess...

-- 
Freedom is always the freedom of dissenters.
  (Rosa Luxemburg)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for python SIP/MGCP stacks

2006-12-30 Thread Anthony Baxter
 I am using python to write a testing tools, currently this tool only
 supports skinny protocol. I am planning to add SIP and MGCP support as well,
 wondering if you have written these protocol stacks before which can be
 leveraged from.

There's two I know of - shtoom and Divmod Sine. The latter is a more
complete implementation of SIP and probably what you want to use.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4.4 vs. 2.3.6

2006-12-30 Thread Anthony Baxter
On 27 Dec 2006 18:02:50 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 My top priority is stability of the interpreter. With that in mind
 which version should I get: 2.4.4, 2.3.6
 or something else.

 I will be using gcc 2.3.2(x86), 3.3(arm) and 3.4.3(arm) to cross
 compile it depending on the (embedded) platform.

I'd recommend 2.4.4 over 2.3.6. 2.4 hasn't got much in the way of
major likely-to-cause-bugs changes over 2.3, and it's had a heck of a
lot more time to have bugs fixed. Once 2.4(.0) came out, work on the
2.3 maintenance series effectively stopped in favour of working on the
2.4 series. There's been a lot of bugs fixed since then that weren't
applied back to 2.3. See the 2.4.4 release notes, available at the
2.4.4 webpage, for more.

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


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki

 MatLab: 14 msec
 Python:  2 msec
 
 For times this small, I wonder if timing comparisons are valid. I do
 NOT think SciPy is in general an order of magnitude faster than Matlab
 for the task typically performed with Matlab.
The algorithm is meant for real-time analysis,
where these kind of differences counts a lot.
I'm also a typical surface programmer
(don't need/want to know what's going inside),
just want to get my analysis done,
and the fact that Python has much more functions available,
means I've to write far less explicit or implicit for loops,
and thus I expect it to look faster for me always.
 
 After taking the first difficult steps into Python,
 all kind of small problems as you already know,
 it nows seems a piece of cake to convert from MatLab to Python.
 (the final programs of MatLab and Python can almost only be
 distinguished by the comment character ;-)

 Especially I like:
 - more relaxed behavior of exceeded the upper limit of a (1-dimensional)
   array
 
 Could you explain what this means? In general, I don't want a
 programming language to be relaxed about exceeding array bounds.
 
Well, I've to admit, that wasn't a very tactic remark, noise is still
an unwanted issue in software.
But in the meanwhile I've reading further and I should replace that by
some other great things:
- the very efficient way, comment is turned into help information
- the (at first sight) very easy, but yet quit powerfull OOPs implemetation.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
 
 I'm not sure about SciPy,

Yes SciPy allows it too !
  but lists in standard Python allow this:
 
 array = [1, 2, 3, 4]
 array[2:5]
 [3, 4]
 
 That's generally a good thing.
 

You're not perhaps by origin an analog engineer ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: per interpreter storage for C extensions

2006-12-30 Thread Robin Becker
Martin v. Löwis wrote:
 Robin Becker schrieb:
 Is there a simple/cheap way for C code to cache these sorts of module
 level globals on a per interpreter basis? Is there even a way to tell
 which interpreter I'm being called in?
 
 There is no cheap way to add to the interpreter state. As Chris Mellon
 explains, you can use PyThreadState_Get()-interp to find the
 interpreter state. I recommend to do the caching only in the
 single-interpreter case (i.e. for the first interpreter).
 
 Notice that comparing interpreter states by identity is somewhat
 dangerous: the interpreter may have been deleted with you still
 holding a pointer to it, and a new interpreter may get allocated
 at the same address, making you believe it is the same interpreter.

I can eliminate most of the problems by not keeping private pointers to 
the cache variables.

What is worrying is that in the extension init we're creating an 
exception and version string etc and holding a pointer to them in C; is 
it safe to use the same exception in different interpeters? Currently 
the exception is added to the module at init time, but my reading of the 
documentation implies that  all interpreters will see that exception as 
it is copied from the first.
-- 
Robin Becker
-- 
http://mail.python.org/mailman/listinfo/python-list


python , Boost and straight (but complex) C code

2006-12-30 Thread Osiris
I have these pieces of C-code (NOT C++ !!) I want to call from Python.
I found Boost.
I have MS Visual Studio 2005 with C++.

is this the idea:
I write the following C source file:

#include iostream
#include stdafx.h

namespace { // Avoid cluttering the global namespace.

int my_int;   /* a global integer: or outside namespace ? */
 double calc ( double f)
 {
my_int = (int) (f/2);
printf( Half of %f is %d\n, f, my_int ); 
return f/2;
 }
 
}

#include boost/python.hpp
using namespace boost::python;

BOOST_PYTHON_MODULE( half )
{
def(calc, calc ); 
}



Which I put in a VC project and compile into a .DLL
This DLL I put somewhere on my disk, where Python 2.4 can find it.
then I write the following Python source:
=
from half import *
calc(34655.0)

et voila ?

Can I acces my_int too, this way ?

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


Re: Scaling pictures

2006-12-30 Thread cyberco
cyberco wrote:
 PIL is certainly a fine option, but I noticed that the scaled images
 (scaled with the ANTIALIAS filter) are not as good as you can get with,
 say, Photoshop. Maybe I'm just expecting too much, but I wish I could
 choose a higher quality rescaling algorithm. PIL still rocks though.

Sorry, I should have checked the facts a little better: you can set the
quality of the compression when saving:


img = Image.open('old.jpg')
img.thumbnail((640,480), Image.ANTIALIAS)
img.save('new.jpg', quality=95)


Now PIL is definitely the way to go. :)

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


Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Osiris
I get, from Visual C++, these linker errors, 8 in total, trying to
build the above C++ source:

C_test.obj : error LNK2019: unresolved external symbol
__declspec(dllimport) void __cdecl
boost::python::detail::init_module(char const *,void
(__cdecl*)(void))
([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]) referenced in
function _inithalf

C_test.obj : error LNK2019: unresolved external symbol
__declspec(dllimport) void __cdecl
boost::python::detail::scope_setattr_doc(char const *,class
boost::python::api::object const ,char const *)
([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@Z)
referenced in function void __cdecl boost::python::defint
(__cdecl*)(float)(char const *,int (__cdecl*)(float))
([EMAIL PROTECTED]@[EMAIL PROTECTED]@boost@@[EMAIL PROTECTED]@Z)

C_test.obj : error LNK2019: unresolved external symbol
__declspec(dllimport) class boost::python::api::object __cdecl
boost::python::objects::function_object(struct
boost::python::objects::py_function const )
([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@123@@Z)
referenced in function class boost::python::api::object __cdecl
boost::python::detail::make_function_auxint (__cdecl*)(float),struct
boost::python::default_call_policies,struct
boost::mpl::vector2int,float (int (__cdecl*)(float),struct
boost::python::default_call_policies const ,struct
boost::mpl::vector2int,float const )
([EMAIL PROTECTED]@[EMAIL PROTECTED]@boost@@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@@[EMAIL PROTECTED]@boost@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@Z)
C_test.obj : error LNK2019: unresolved external symbol
__declspec(dllimport) public: __thiscall
boost::python::objects::py_function_impl_base::py_function_impl_base(void)
([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED])
referenced in function public: __thiscall
boost::python::objects::caller_py_function_implstruct
boost::python::detail::callerint (__cdecl*)(float),struct
boost::python::default_call_policies,struct
boost::mpl::vector2int,float  ::caller_py_function_implstruct
boost::python::detail::callerint (__cdecl*)(float),struct
boost::python::default_call_policies,struct
boost::mpl::vector2int,float  (struct
boost::python::detail::callerint (__cdecl*)(float),struct
boost::python::default_call_policies,struct
boost::mpl::vector2int,float  const )
([EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@boost@@@[EMAIL 
PROTECTED]@boost@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@@Z)
C_test.obj : error LNK2001: unresolved external symbol public:
virtual unsigned int __thiscall
boost::python::objects::py_function_impl_base::max_arity(void)const 
([EMAIL PROTECTED]@[EMAIL PROTECTED]@boost@@UBEIXZ)
C_test.obj : error LNK2019: unresolved external symbol
__declspec(dllimport) public: virtual __thiscall
boost::python::objects::py_function_impl_base::~py_function_impl_base(void)
([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED])
referenced in function public: virtual __thiscall
boost::python::objects::caller_py_function_implstruct
boost::python::detail::callerint (__cdecl*)(float),struct
boost::python::default_call_policies,struct
boost::mpl::vector2int,float  ::~caller_py_function_implstruct
boost::python::detail::callerint (__cdecl*)(float),struct
boost::python::default_call_policies,struct
boost::mpl::vector2int,float  (void)
([EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@boost@@@[EMAIL 
PROTECTED]@boost@@[EMAIL PROTECTED])
C_test.obj : error LNK2019: unresolved external symbol
__declspec(dllimport) struct
boost::python::converter::rvalue_from_python_stage1_data __cdecl
boost::python::converter::rvalue_from_python_stage1(struct _object
*,struct boost::python::converter::registration const )
([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@PAU_object@@[EMAIL 
PROTECTED]@@Z)
referenced in function public: __thiscall
boost::python::converter::arg_rvalue_from_pythonfloat::arg_rvalue_from_pythonfloat(struct
_object *)
([EMAIL PROTECTED]@[EMAIL PROTECTED]@boost@@[EMAIL PROTECTED]@@@Z)
C_test.obj : error LNK2019: unresolved external symbol
__declspec(dllimport) struct boost::python::converter::registration
const  __cdecl boost::python::converter::registry::lookup(struct
boost::python::type_info)
([EMAIL PROTECTED]@[EMAIL PROTECTED]@boost@@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@@Z)
referenced in function struct boost::python::converter::registration
const  __cdecl
boost::python::converter::detail::registry_lookupfloat const volatile
(float const volatile  (__cdecl*)(void))
([EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL 
PROTECTED]@[EMAIL PROTECTED])
C:\Documents and Settings\Erik\My Documents\Visual Studio
2005\Projects\C_test\Debug\C_test.dll : fatal error LNK1120: 8
unresolved externals
-- 

Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Sebastian 'lunar' Wiesner
Osiris [EMAIL PROTECTED] typed

 I have these pieces of C-code (NOT C++ !!) I want to call from Python.
 I found Boost.
 I have MS Visual Studio 2005 with C++.
 
 is this the idea:
 I write the following C source file:
 
 #include iostream

iostream is a C++ header file...

 #include stdafx.h
 
 namespace { // Avoid cluttering the global namespace.

C doesn't know about namespaces. They are a C++ thing, too.
 
 int my_int;   /* a global integer: or outside namespace ? */
  double calc ( double f)
  {
 my_int = (int) (f/2);
 printf( Half of %f is %d\n, f, my_int );

You include a C++ IO header, but use traditional C IO functions here.
Either you use C++ streams here, or you replace iostream with
stdio.h.

 return f/2;
  }
  
 }
 
 #include boost/python.hpp
 using namespace boost::python;
 
 BOOST_PYTHON_MODULE( half )
 {
 def(calc, calc );
 }
 
 
 
 Which I put in a VC project and compile into a .DLL
 This DLL I put somewhere on my disk, where Python 2.4 can find it.
 then I write the following Python source:
 =
 from half import *
 calc(34655.0)
 
 et voila ?
 
 Can I acces my_int too, this way ?

May be... Didn't you try it?
It may also be, that you have to create a PyObject first...

-- 
Freedom is always the freedom of dissenters.
  (Rosa Luxemburg)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Mathias Panzenboeck
A other great thing: With rpy you have R bindings for python.
So you have the power of R and the easy syntax and big standard lib of python! 
:)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Installing python.org distro over ActivePython?

2006-12-30 Thread Tilde_karthik
I tried too and works sweet. only dont try to run it in pythomWin
Karthik

Tom Plunket wrote:
 Hey gang-

 I just ran into the fabled Secure Sockets not enabled in ActivePython,
 and the ActiveState FAQ says I should just grab _ssl.pyd from
 somewhere, offering up the python.org distribution as a possible
 source.

 I'm on 2.4 at this time, and python.org has what appears to be a
 considerably newer release than ActiveState in the first place, so I was
 wondering if I could just install this entire package right over the
 ActiveState installation, and everything would Just Work?
 
 thanks,
 -tom!
 
 --

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


Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Osiris
Visual C++ build log at:

http://213.10.133.192/BuildLog.htm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 3107 Function Annotations for review and comment

2006-12-30 Thread Diez B. Roggisch
BJörn Lindqvist wrote:

 On 12/29/06, Tony Lownds [EMAIL PROTECTED] wrote:
 Rationale
 =

 Because Python's 2.x series lacks a standard way of annotating a
 function's parameters and return values (e.g., with information about
 what type a function's return value should be), a variety of tools
 and libraries have appeared to fill this gap [#tailexamp]_.  Some
 utilise the decorators introduced in PEP 318, while others parse a
 function's docstring, looking for annotations there.

 This PEP aims to provide a single, standard way of specifying this
 information, reducing the confusion caused by the wide variation in
 mechanism and syntax that has existed until this point.
 
 I think this rationale is very lacking and to weak for such a big
 change to Python. I definitely like to see it expanded.
 
 The reference links to two small libraries implementing type checking
 using decorators and doc strings. None of which to seem to be very
 popular in the Python community. Surely, those two libraries *alone*
 can't be enough of a motivation for this? To me, it is far from
 self-evident what purpose function annotations would serve.
 
 I also wonder why a very obtrusive syntax addition is needed when it
 clearly is possible to annotate functions in today's Python. Why is
 syntax better than just adding a function annotation decorator to the
 standard library?
 
 @annotate(a = int, b = dict, c = int)
 def foo(a, b, c = 5):
 ...
 
 Are decorators to ugly?

I prefer the proposed syntax - it is much more concise and. modeled after
well-known declaration syntaxes in other languages. Additionally, it spares
us the doubled parameter list as your example above - and that is important
here I'd say.

Typing is a difficult and controversial subject. However, sooner or later
python will grow JIT-compilers that will take advantage of such
declarations, and I think it is better to have one accepted way of doing it
hardwired than several concurring self-baked implementations.

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

Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
Mathias Panzenboeck wrote:
 A other great thing: With rpy you have R bindings for python.

forgive my ignorance, what's R, rpy ?
Or is only relevant for Linux users ?

cheers
Stef

 So you have the power of R and the easy syntax and big standard lib of 
 python! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Wow, Python much faster than MatLab

2006-12-30 Thread Doran, Harold
R is the open-source implementation of the S language developed at Bell
laboratories. It is a statistical programming language that is becoming
the de facto standard among statisticians. Rpy is what allows an
interface between python and the R language.

Harold 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On 
 Behalf Of Stef Mientki
 Sent: Saturday, December 30, 2006 9:24 AM
 To: python-list@python.org
 Subject: Re: Wow, Python much faster than MatLab
 
 Mathias Panzenboeck wrote:
  A other great thing: With rpy you have R bindings for python.
 
 forgive my ignorance, what's R, rpy ?
 Or is only relevant for Linux users ?
 
 cheers
 Stef
 
  So you have the power of R and the easy syntax and big 
 standard lib of 
  python! :)
 --
 http://mail.python.org/mailman/listinfo/python-list
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: per interpreter storage for C extensions

2006-12-30 Thread Martin v. Löwis
Robin Becker schrieb:
 What is worrying is that in the extension init we're creating an
 exception and version string etc and holding a pointer to them in C; is
 it safe to use the same exception in different interpeters? 

It is safe as long as the base exception classes are also shared across
interpreters, otherwise, the hierarchical exception matching will break.
The builtin exceptions are all global (i.e. shared across
interpreters) (I believe).

In any case, it looks like that the multiple interpreters feature of
Python is just broken.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


can't find a suitable application server

2006-12-30 Thread krishnakant Mane
hello,
I have read about zope and found it very good.
but right now I am a bit confused about one project I have just procured.
it is supposed to be a simple 3 tear application.  the front end will
be a thin client which we will develop using wxpython.
We are using MySQL for the database and I need to find out a suitable
application server where I can do just the following.
1. write my business logic which will actually be the workhorse.
2.  send data to the thin client in form of either text or lists or
tuples as required.  I want my thin client just to take the data and
recieve the data.
3.  an application server that will process data coming from the thing
client.  this layer will fire the queries etc.
4.  send the processed results in the forms mentioned in point number
2 (sorry if I am redundent).
I thought zope is too heavy and complex for this task and zope is
generally used in places where the data is too dynamic and the system
very complex.
I am any ways using MySQL for the rdbms which is more than sufficient
so no need for a object oriented database like what zope has.
can any one suggest me what to do?
right now I get an impression that I must create sockets and send and
receave data through that socket to the thin client and put the actual
business logic on a seperate machine or on the database server what
ever.
thanking all.
Krishnakant.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can't find a suitable application server

2006-12-30 Thread Diez B. Roggisch
krishnakant Mane wrote:

 hello,
 I have read about zope and found it very good.
 but right now I am a bit confused about one project I have just procured.
 it is supposed to be a simple 3 tear application.  the front end will
 be a thin client which we will develop using wxpython.
 We are using MySQL for the database and I need to find out a suitable
 application server where I can do just the following.
 1. write my business logic which will actually be the workhorse.
 2.  send data to the thin client in form of either text or lists or
 tuples as required.  I want my thin client just to take the data and
 recieve the data.
 3.  an application server that will process data coming from the thing
 client.  this layer will fire the queries etc.
 4.  send the processed results in the forms mentioned in point number
 2 (sorry if I am redundent).
 I thought zope is too heavy and complex for this task and zope is
 generally used in places where the data is too dynamic and the system
 very complex.
 I am any ways using MySQL for the rdbms which is more than sufficient
 so no need for a object oriented database like what zope has.
 can any one suggest me what to do?
 right now I get an impression that I must create sockets and send and
 receave data through that socket to the thin client and put the actual
 business logic on a seperate machine or on the database server what
 ever.

Use Pyro. It will make your server appear as a simple python object. It also
comes with a name-service for look up of your actual server.

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


Re: PEP 3107 Function Annotations for review and comment

2006-12-30 Thread John Roth
BJörn Lindqvist wrote:
 On 12/29/06, Tony Lownds [EMAIL PROTECTED] wrote:
  Rationale
  =
 
  Because Python's 2.x series lacks a standard way of annotating a
  function's parameters and return values (e.g., with information about
  what type a function's return value should be), a variety of tools
  and libraries have appeared to fill this gap [#tailexamp]_.  Some
  utilise the decorators introduced in PEP 318, while others parse a
  function's docstring, looking for annotations there.
 
  This PEP aims to provide a single, standard way of specifying this
  information, reducing the confusion caused by the wide variation in
  mechanism and syntax that has existed until this point.

 I think this rationale is very lacking and to weak for such a big
 change to Python. I definitely like to see it expanded.

 The reference links to two small libraries implementing type checking
 using decorators and doc strings. None of which to seem to be very
 popular in the Python community. Surely, those two libraries *alone*
 can't be enough of a motivation for this? To me, it is far from
 self-evident what purpose function annotations would serve.

 I also wonder why a very obtrusive syntax addition is needed when it
 clearly is possible to annotate functions in today's Python. Why is
 syntax better than just adding a function annotation decorator to the
 standard library?

 @annotate(a = int, b = dict, c = int)
 def foo(a, b, c = 5):
 ...

 Are decorators too ugly?

 --
 mvh Björn

The problem I have with it is that it doesn't solve the problem
I've got, and I can see some user requests to use it rather than
the metadata solution I've got now in Python FIT. Neither do
decorators, by the way.

So, what are the problems I see?

First, it only handles functions/methods. Python FIT needs
metadata on properties and assignable/readable attributes
of all kinds. So in no sense is it a replacement. Parenthetically,
neither is the decorator facility, and for exactly the same reason.

Second, it has the potential to make reading the function
header difficult. In the languages I'm familiar with, static type
declarations are a very few, somewhat well chosen words.
In this proposal, it can be a general expression. In Python
FIT, that could well turn into a full blown dictionary with
multiple keys.

Third, it's half of a proposal. Type checking isn't the only use
for metadata about functions/methods, classes, properties
and other objects, and the notion that there are only going to
be a small number of non-intersecting libraries out there is
an abdication of responsibility to think this thing through.

I should note that there are quite a few packages out there
that use some form of annotation, be they comments
(like Ned Bachelder's coverage analyzer and the two
lint packages I'm aware of), docstrings, decorators or
auxilliary dictionarys (like Python FIT, and a possible
Python version of Naked Objects). They include a
fair number of documentation packages.

On a positive note, what I'd like is something similar to
Java's Javadoc, but a bit looser. It could be a comment
convention like Javadoc, but one that the compiler recognizes
and stashes in the compiled .pyc / .pyo file. Or it could have
different syntax. What is SHOULDN'T have is a mandatory tie
to function/method syntax.

Combined with a convention to identify which annotation
belongs to who, it could be a quite useful mechanism.
I, for one, have no difficulty with the notion of using someone
else's annotations if I can identify them unambiguously.

John Roth
Python FIT

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


Re: some OT: how to solve this kind of problem in our program?

2006-12-30 Thread mark . dufour
[EMAIL PROTECTED] wrote:
 Using Psyco this version is much faster, you can test it on your PC
 compared to the other one (the whole running time, Psyco compilation
 too):

FWIW, the CVS version of Shed Skin optimizes this exact program a bit
further than Psyco:

Psyco:   0.66 s


Shed Skin: 0.30 s


Thanks,
Mark Dufour.
-- Shed Skin author, http://mark.dufour.googlepages.com

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


Re: Easiest way to print from XP/DOS.

2006-12-30 Thread jim-on-linux


Thanks, 
The client is in a one printer office.  If the 
output file is opened with note and then sent to 
the printer everything is fine but it defeats the 
purpose of the utility.  Also tried   lpt1  but 
the same results.

I'm trying to find out if this was some  change in 
xp from previous versions, or is there something 
abnormal going on.  I'm trying to avoid setting 
up an xp machine for one client.


jim-on-linux

 


On Saturday 30 December 2006 03:05, Tim Roberts 
wrote:
 jim-on-linux [EMAIL PROTECTED] wrote:
 Did you run from a file or type in from
  keyboard?
 
 When the client runs the utility program  the
 output file is built but nothing prints and no
 messages appear. When I typed from keyboard on
  an xp pro at c:\, I got the message.
 
 Is it possible that  virus detector or some
 self.defense software is interacting?

 It is quite possible that they simply do not
 have a printer hooked up to their computer's
 parallel port.  If all of your printers are
 from network shares, then the special file
 prn will not go anywhere.

 Typing to prn is a dreadful way to do
 printing on Windows. --
 Tim Roberts, [EMAIL PROTECTED]
 Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: No way to set a timeout in urllib.

2006-12-30 Thread skip

John If you're looking for a Summer of Code project, ...

I'm not.  I'm about 25 years out of grad school. ;-)

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


Re: Easiest way to print from XP/DOS.

2006-12-30 Thread jim-on-linux

Thanks,
However, using note to print is a problem. First, 
because note adds a header( file name etc.)  to 
the printed output that is not acceptable.  Next, 
the number of files is 200 to 300 per day.  The 
idea of the utility is to eliminate the operator.

But, if you have a virus detector that stops the 
operation then I think I may have to install the 
program as opposed to unzipping and running the 
exe file.

  


On Saturday 30 December 2006 01:33, Tom Plunker 
wrote:
 jim-on-linux wrote:
  When the client runs the utility program  the
  output file is built but nothing prints and
  no messages appear.

 If the file has a '.txt' extension, you could
 try os.system'ing start filename, which'll
 make the file pop open with notepad (or
 whatever happens to be associated with TXT
 files), from which the user would need to press
 Ctrl-P to make it print.

  Is it possible that  virus detector or some
  self.defense software is interacting?

 Quite.  I run firewall software on my PC that
 alerts me when a program is trying to launch
 another program.  The message that it gives is
 not entirely unlike the one you gave me.

 To diagnose further, you could have the victim
 send you a screenshot to see what's really
 going on.  With Outlook, it's as easy as
 hitting the Print Screen button (when the
 message is visible) and pasting the clipboard
 into an email.  Alternatively, they paste into
 MS Paint, save the bitmap somewhere, and mail
 that to you.

 Good luck,
 -tom!

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


Re: PEP 3107 Function Annotations for review and comment

2006-12-30 Thread Tim Smith

here's a potentially nifty way of adding decorators to input args for python:

  def a(int(arg1), arg2, tuple(arg3)):
#arg1 is an int (or was converted to an int)
#arg2's type is not known (ie this decoration is optional)
#arg3 is a tuple (may have been a list coming in, but is now a tuple)
pass

this would add optional conversion of input arguments to desired types
(you could drop the parens, making it more like standard type syntax, but I put 
them there to intone that the int() method will be called on every arg1 coming 
in, and so on)

this would also add ability to write your own conversion functions to handle 
type checking as arguments come into a function

should add little to no overhead (as you are likely doing this manually like so 
if desired:
  def a(arg1, arg2, arg3):
arg1 = int(arg1)
arg3 = tuple(arg3)
pass

addendum:
  any type conversion method should throw ValueError on failure (this would 
allow python to catch this error and throw a new exception (InputArgError) or 
something

so this:
  def a(int(arg1), arg2, tuple(arg3)):
pass

would more or less translate to this:
  def a(arg1, arg2, arg3):
try:
  arg1 = int(arg1)
  arg3 = tuple(arg3)
except ValueError:
  raise InputArgError(what went wrong)
pass

it would likely be desired to create some extra builtin functions like:
  convdict, convlist, convtuple, that if input is already this type, will 
return the input unmodified, (as opposed to calling a constructor on dict, 
list, tuple to create a whole new object (copying all the data))

another nice side effect of this is it adds the ability to call by value 
instead of by reference:
  def a(list(b)):
pass #call by value

  def a(convlist(b)):
pass #call by reference (unless input type wasn't list)

 -- Tim



-- On 12/30/06 John Roth [EMAIL PROTECTED] wrote:

 BJörn Lindqvist wrote:
  On 12/29/06, Tony Lownds [EMAIL PROTECTED] wrote:
   Rationale
   =
  
   Because Python's 2.x series lacks a standard way of annotating a
   function's parameters and return values (e.g., with information about
   what type a function's return value should be), a variety of tools
   and libraries have appeared to fill this gap [#tailexamp]_.  Some
   utilise the decorators introduced in PEP 318, while others parse a
   function's docstring, looking for annotations there.
  
   This PEP aims to provide a single, standard way of specifying this
   information, reducing the confusion caused by the wide variation in
   mechanism and syntax that has existed until this point.
 
  I think this rationale is very lacking and to weak for such a big
  change to Python. I definitely like to see it expanded.
 
  The reference links to two small libraries implementing type checking
  using decorators and doc strings. None of which to seem to be very
  popular in the Python community. Surely, those two libraries *alone*
  can't be enough of a motivation for this? To me, it is far from
  self-evident what purpose function annotations would serve.
 
  I also wonder why a very obtrusive syntax addition is needed when it
  clearly is possible to annotate functions in today's Python. Why is
  syntax better than just adding a function annotation decorator to the
  standard library?
 
  @annotate(a = int, b = dict, c = int)
  def foo(a, b, c = 5):
  ...
 
  Are decorators too ugly?
 
  --
  mvh Björn
 
 The problem I have with it is that it doesn't solve the problem
 I've got, and I can see some user requests to use it rather than
 the metadata solution I've got now in Python FIT. Neither do
 decorators, by the way.
 
 So, what are the problems I see?
 
 First, it only handles functions/methods. Python FIT needs
 metadata on properties and assignable/readable attributes
 of all kinds. So in no sense is it a replacement. Parenthetically,
 neither is the decorator facility, and for exactly the same reason.
 
 Second, it has the potential to make reading the function
 header difficult. In the languages I'm familiar with, static type
 declarations are a very few, somewhat well chosen words.
 In this proposal, it can be a general expression. In Python
 FIT, that could well turn into a full blown dictionary with
 multiple keys.
 
 Third, it's half of a proposal. Type checking isn't the only use
 for metadata about functions/methods, classes, properties
 and other objects, and the notion that there are only going to
 be a small number of non-intersecting libraries out there is
 an abdication of responsibility to think this thing through.
 
 I should note that there are quite a few packages out there
 that use some form of annotation, be they comments
 (like Ned Bachelder's coverage analyzer and the two
 lint packages I'm aware of), docstrings, decorators or
 auxilliary dictionarys (like Python FIT, and a possible
 Python version of Naked Objects). They include a
 fair number of documentation packages.
 
 On a positive note, what I'd like is 

Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
Doran, Harold wrote:
 R is the open-source implementation of the S language developed at Bell
 laboratories. It is a statistical programming language that is becoming
 the de facto standard among statisticians.
Thanks for the information
I always thought that SPSS or SAS where thé standards.
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Managing a queue of subprocesses?

2006-12-30 Thread cypher543
That was a very good answer, and it sure sounds like it would work.
However, I failed at implementing it. :( My updated runQueue() function
is:

def runQueue(self):
self.buildProcess = None
count = 1 # current position in the queue
while True:
if self.buildProcess is None:
self.execute(self.cmdQueue[count][2], 
self.cmdQueue[count][0],
self.cmdQueue[count][1])
count = count + 1
else:
# I'm not really sure what to put here

I pretty sure I did all of that wrong. ;) Also, how exactly would I
redirect stderr to another place?

On Dec 30, 12:22 am, Tom Plunket [EMAIL PROTECTED] wrote:
 cypher543 wrote:
  self.buildPID = subprocess.Popen(buildCmd, stdout = subprocess.PIPE, stderr 
  = subprocess.STDOUT)Instead of calling it self.buildPID, you might just 
  call it
 self.buildProcess or something.  It's actually a Popen object that gets
 returned.

 So yes you can do what you want:

 __init__ self.buildProcess to None.  Then, in execute(), if
 (self.buildProcess is None) or (self.buildProcess.poll() is not None)
 start the next process.

 You've got to wait for one process to end before starting the next one,
 it's really that easy.  So, don't just go ahead and fire them all
 instantly.  Possibly what you want to do instead is have runQueue() do
 the check somehow that there's no active process running.

 What I would do, have runQueue() check to see if self.buildProcess is
 None.  If it is None, fire the next process in the queue.  If it isn't
 None, then check to see if it's ended.  If it has ended, then set
 self.buildProcess to None.  Next UI update the next step in the queue
 gets done.  Mind that you'll have to modify the queue as you go, e.g.
 self.queue = self.queue[1:].

 Finally, consider piping stderr separately, and direct its output to a
 different window in your GUI.  You could even make that window pop open
 on demand, if errors occur.
 
 good luck,
 -tom!
 
 --

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


Re: How to suppress the output of an external module ?

2006-12-30 Thread Scott David Daniels
MRAB wrote:
 Scott David Daniels wrote:
 [EMAIL PROTECTED] wrote:
 In Windows the null device is, strictly speaking, nul or nul:, not
 nul.txt, but the latter appears to work too.

Although I find the windows design and reasoning to be a mistake, I
believe the use of file names NUL, PRN, and CON (at least) are diverted
to the corresponding device (data sink, printer, console) regardless of
directory and/or extension.  The idea, I believe, was that too many
programs take a name from the user and slap the extension they intend to
use on the end, and even put a directory on the front.  So, the OS
ignores those parts and switches to the chosen device.  I use .txt for
two reasons: to remind me to avoid those names, and to indicate I am
doing straight text output.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Starting a child process and getting its stdout?

2006-12-30 Thread cypher543
Yes, I did try your example. But, after talking on the #python IRC
channel, I realized that it wasn't the process that was blocking, it
was my GUI. I had to fire an event using gobject.io_add_watch()
whenever data was received from the child process. The event then read
from the process and added a line to my gtk.TextView.

Thank you for your suggestions, though.

On Dec 30, 12:12 am, Tom Plunket [EMAIL PROTECTED] wrote:
 Gabriel Genellina wrote:
  Did you *actually* tried what Tom Plunket posted? Two tiny chars make
  a difference.The sad irony is that before taking off for vacation I was 
  struggling at
 work with the same problem in some sense.  I couldn't figure out why for
 some processes I got all of the output right away and for others it all
 got queued up 'til the process ended.  Working out a simple example for
 this thread showed the light: my calling of my_process.stdout.read() was
 blocking 'til EOF.  Oops.
 
 -tom!
 
 --

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


Re: Easiest way to print from XP/DOS.

2006-12-30 Thread [EMAIL PROTECTED]

jim-on-linux wrote:
 Thanks,
 The client is in a one printer office.  If the
 output file is opened with note and then sent to
 the printer everything is fine but it defeats the
 purpose of the utility.  Also tried   lpt1  but
 the same results.

This may not help, but it worked once for me
although I don't remember the exact circumstances.

If the printer is connected to the pc, give it a sharename,
such as \\mypc\hpprinter. Then do a redirect of an lpt
port to that sharename: net use LPT2: \\mypc\hpprinter.

This indirect routing through the network driver back to
the local hardware port seems silly, but it did fix a
program that couldn't directly access the hardware.


 I'm trying to find out if this was some  change in
 xp from previous versions, or is there something
 abnormal going on.  I'm trying to avoid setting
 up an xp machine for one client.


 jim-on-linux




 On Saturday 30 December 2006 03:05, Tim Roberts
 wrote:
  jim-on-linux [EMAIL PROTECTED] wrote:
  Did you run from a file or type in from
   keyboard?
  
  When the client runs the utility program  the
  output file is built but nothing prints and no
  messages appear. When I typed from keyboard on
   an xp pro at c:\, I got the message.
  
  Is it possible that  virus detector or some
  self.defense software is interacting?
 
  It is quite possible that they simply do not
  have a printer hooked up to their computer's
  parallel port.  If all of your printers are
  from network shares, then the special file
  prn will not go anywhere.
 
  Typing to prn is a dreadful way to do
  printing on Windows. --
  Tim Roberts, [EMAIL PROTECTED]
  Providenza  Boekelheide, Inc.

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


Chris Akre

2006-12-30 Thread Neil Agron
Chris,
If my name is familiar, please contact me.
-Neil-- 
http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 Function Annotations for review and comment

2006-12-30 Thread Tony Lownds
 First, it only handles functions/methods. Python FIT needs
 metadata on properties and assignable/readable attributes
 of all kinds. So in no sense is it a replacement. Parenthetically,
 neither is the decorator facility, and for exactly the same reason.


I can't argue against docstrings and maybe annotations on attributes,
I'd like them myself. That should be a separate PEP because the scope
of this one is Function Annotations.

The syntax for function annotations has been much more thoroughly
discussed than for annotations on attributes. See Guido's blog and
other references in the PEP.

 Second, it has the potential to make reading the function
 header difficult. In the languages I'm familiar with, static type
 declarations are a very few, somewhat well chosen words.
 In this proposal, it can be a general expression. In Python
 FIT, that could well turn into a full blown dictionary with
 multiple keys.

Any code can be hard to read. Having the annotation be a general
expression lets authors use normal code factoring to make the
function header more readable. For instance, one can change this:

def f(x: some_really_long_expression):
   ...


to this:

t_X = some_really_long_expression
def f(x: t_X):
...

 Third, it's half of a proposal. Type checking isn't the only use
 for metadata about functions/methods, classes, properties
 and other objects, and the notion that there are only going to
 be a small number of non-intersecting libraries out there is
 an abdication of responsibility to think this thing through.


That comes from this paragraph from the PEP:

There is no worry that these libraries will assign semantics at
random, or that a variety of libraries will appear, each with
varying semantics and interpretations of what, say, a tuple of
strings means. The difficulty inherent in writing annotation
interpreting libraries will keep their number low and their
authorship in the hands of people who, frankly, know what they're
doing.

Perhaps you are right and intersecting libraries will become an issue.
Designing a solution in advance of the problems being evident seems
risky to me. What if the solution invented in a vacuum really is more
of a hindrance?

There is a clear intersection between documentation packages and
type-checking or type-coercing libraries. Documentation libraries can
just use repr(annotation), possibly with a little bit of special  
casing to
represent classes and types better.

I'm not sure there will be an important use for overlap of different  
type-checking
or type-coercing libraries within the same module. What else could  
intersect and
why can't the intersecting pieces develop an solution when it arises?

More feedback from the community on this point (whether the PEP needs to
take responsibility for interoperability) would be nice.

Thanks for the feedback from everyone so far,
-Tony



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


Re: bad marshal data in site.py in fresh 2.5 install win

2006-12-30 Thread TiNo
Good question...

I am now on a different computer, one that has never heard of Python,
so no env vars are set. Again, this gives (my memory stick is now
F:\):

--
F:\Python25python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# F:\Python25\lib\site.pyc matches F:\Python25\lib\site.py
import site # precompiled from F:\Python25\lib\site.pyc
# F:\Python25\lib\os.pyc matches F:\Python25\lib\os.py
import os # precompiled from F:\Python25\lib\os.pyc
import nt # builtin
# F:\Python25\lib\ntpath.pyc matches F:\Python25\lib\ntpath.py
import ntpath # precompiled from F:\Python25\lib\ntpath.pyc
# F:\Python25\lib\stat.pyc matches F:\Python25\lib\stat.py
import stat # precompiled from F:\Python25\lib\stat.pyc
# F:\Python25\lib\UserDict.pyc matches F:\Python25\lib\UserDict.py
import UserDict # precompiled from F:\Python25\lib\UserDict.pyc
# F:\Python25\lib\copy_reg.pyc matches F:\Python25\lib\copy_reg.py
import copy_reg # precompiled from F:\Python25\lib\copy_reg.pyc
# F:\Python25\lib\types.pyc matches F:\Python25\lib\types.py
import types # precompiled from F:\Python25\lib\types.pyc
import _types # builtin
# zipimport: found 74 names in F:\Python25\lib\site-packages\setuptools-0.6c3-py
2.5.egg
# F:\Python25\lib\locale.pyc matches F:\Python25\lib\locale.py
import locale # precompiled from F:\Python25\lib\locale.pyc
import encodings # directory F:\Python25\lib\encodings
# F:\Python25\lib\encodings\__init__.pyc matches F:\Python25\lib\encodings\__ini
t__.py
import encodings # precompiled from F:\Python25\lib\encodings\__init__.pyc
# F:\Python25\lib\codecs.pyc matches F:\Python25\lib\codecs.py
import codecs # precompiled from F:\Python25\lib\codecs.pyc
import _codecs # builtin
# F:\Python25\lib\encodings\aliases.pyc matches F:\Python25\lib\encodings\aliase
s.py
'import site' failed; traceback:
Traceback (most recent call last):
  File F:\Python25\lib\site.py, line 415, in module
main()
  File F:\Python25\lib\site.py, line 406, in main
aliasmbcs()
  File F:\Python25\lib\site.py, line 356, in aliasmbcs
import locale, codecs
  File F:\Python25\lib\locale.py, line 14, in module
import sys, encodings, encodings.aliases
  File F:\Python25\lib\encodings\__init__.py, line 32, in module
from encodings import aliases
ValueError: bad marshal data
# F:\Python25\lib\warnings.pyc matches F:\Python25\lib\warnings.py
import warnings # precompiled from F:\Python25\lib\warnings.pyc
# F:\Python25\lib\linecache.pyc matches F:\Python25\lib\linecache.py
import linecache # precompiled from F:\Python25\lib\linecache.pyc
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win
32
Type help, copyright, credits or license for more information.

---

??

also removed site.pyc, and run it again, but with the same result.


2006/12/29, Martin v. Löwis [EMAIL PROTECTED]:
 TiNo schrieb:
  # G:\Python25\lib\encodings\aliases.pyc matches
 [...]
   File F:\Python25\lib\encodings\__init__.py, line 32, in module
 
  What can I do about this?

 Where does F:\Python25 come from?

 If you have set any PYTHON* environment variables (e.g. PYTHONPATH),
 unset them.

 Regards,
 Martin

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


Re: I want to see all the variables

2006-12-30 Thread johnf
Steven D'Aprano wrote:


 
 There are three other underscore conventions in use:
 
 (1) Objects with a single leading underscore like _attribute are private
 by convention, but Python doesn't enforce it. Starting an object with a
 single underscore is like writing # Private! Don't touch! after it.
 
 (2) By convention, if you want to create a name that is the same as a
 built-in object without shadowing (hiding) the built-in, put a single
 trailing underscore after it like file_. That's just a style convention
 though, you are free to call it FiLE ,or anything else, if you prefer.
 
 (3) Last but not least, class attributes with two leading and trailing
 underscores are considered special but public, like __init__ and __repr__.
 It is probably a bad idea to invent your own.
 
 
 
Very detailed.  But I was attempting to debug some code which subclassed
other code. I got a traceback that something like no
mySubClass.__source.query() did not exist.  The superclass had something
like myClass.__source.query(sql) which worked
but mySubClass.__source.query(sql) did not work.  So I tried to debug
using dir(myClass.__source) and got an error.  And I also got error when
I dir(mySubClass.__source. So how could I have debugged the problem if
dir() will not display information on the __source?  I hope that explains
my issue.

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


find login name of user?

2006-12-30 Thread rattan
Is there a function/module to find the login name of the user under
UNIX environment?

-ishwar

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


Re: find login name of user?

2006-12-30 Thread karel

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Is there a function/module to find the login name of the user under
 UNIX environment?

who
who am i
finger
id 


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


Re: find login name of user?

2006-12-30 Thread rattan

karel wrote:
 [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Is there a function/module to find the login name of the user under
  UNIX environment?

 who
 who am i
 finger
 id

I was talking about under python environment.

-ishwar

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


Re: find login name of user?

2006-12-30 Thread Uwe Hoffmann
[EMAIL PROTECTED] schrieb:
 Is there a function/module to find the login name of the user under
 UNIX environment?


http://docs.python.org/lib/os-procinfo.html

http://docs.python.org/lib/module-pwd.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread John J. Lee
Stef Mientki [EMAIL PROTECTED] writes:

 Mathias Panzenboeck wrote:
  A other great thing: With rpy you have R bindings for python.
 
 forgive my ignorance, what's R, rpy ?
 Or is only relevant for Linux users ?
[...]

R is a language / environment for statistical programming.  RPy is a
Python interface to let you use R from Python.  I think they both run
on both Windows and Linux.

http://www.r-project.org/

http://rpy.sourceforge.net/


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


Re: find login name of user?

2006-12-30 Thread karel

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 karel wrote:
 [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Is there a function/module to find the login name of the user under
  UNIX environment?

 who
 who am i
 finger
 id

 I was talking about under python environment.

Ah! Thanks for enlightening me.
Apologies for misunderstanding. 


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


Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Erik Max Francis
Osiris wrote:

 I have these pieces of C-code (NOT C++ !!) I want to call from Python.
 I found Boost.
 I have MS Visual Studio 2005 with C++.
 
 is this the idea:
 I write the following C source file:
 
 #include iostream
 #include stdafx.h
 
 namespace { // Avoid cluttering the global namespace.

iostream and namespaces are both most definitely C++ features, not C.

-- 
Erik Max Francis  [EMAIL PROTECTED]  http://www.alcyone.com/max/
  San Jose, CA, USA  37 20 N 121 53 W  AIM, Y!M erikmaxfrancis
   It's almost like / I didn't even have a choice
-- India Arie
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread John J. Lee
Stef Mientki [EMAIL PROTECTED] writes:

 Doran, Harold wrote:
  R is the open-source implementation of the S language developed at Bell
  laboratories. It is a statistical programming language that is becoming
  the de facto standard among statisticians.
 Thanks for the information
 I always thought that SPSS or SAS where thé standards.
 Stef

The 'SS' in SPSS stands for Social Science, IIRC.  Looking at the lack
of mention of that on their website, though, and the prominent use of
the E word there, they have obviously grown out of (or want to grow
out of) their original niche.

Googling, SAS's market seems to be mostly in the business / financial
worlds.

No doubt R's community differs from those, though I don't know exactly
how.  From the long list of free software available for it, it sure
seems popular with some people:

http://www.stats.bris.ac.uk/R/


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

Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Roman Yakovenko
On 12/30/06, Osiris [EMAIL PROTECTED] wrote:
 Visual C++ build log at:

 http://213.10.133.192/BuildLog.htm

It is better to ask Boost.Python related questions on it mailing list:
http://mail.python.org/mailman/listinfo/c++-sig/

You should add to the link line boost_python.lib, thus you will eliminate
unresolved reference symbol errors. If you did not build Boost.Python
next page( http://boost.org/libs/python/doc/building.html ) contains pretty
good explanation how to do this.

http://boost.org/libs/python/doc/v2/scope.html - here you will find example how
to expose my_int variable to Python. my_int has type int, so C++ code will not
see changes to the variable that are done from Python. You will have to write
set_my_int( x ) function to achieve this.

If you are new to Boost.Python try to use Py++ - the code generator for
the library. The Py++ GUI( http://tinyurl.com/ycwvwo ) will help you
to start\learn Boost.Python.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: No way to set a timeout in urllib.

2006-12-30 Thread John J. Lee
John Nagle [EMAIL PROTECTED] writes:

 There's no way to set a timeout if you use urllib to open a URL.
 HTTP, which urllib uses, supports this, but the functionality
 is lost at the urllib level.
 
 It's not available via class URLopener or FancyURLopener, either.
 
 There is a non-thread-safe workaround from 2003 at
 
 http://mail.python.org/pipermail/python-bugs-list/2003-September/020405.html
 
 but it was rejected as a feature at
 
 https://sourceforge.net/tracker/?func=detailatid=105470aid=803634group_id=5470
 
 without anything better going in.  Despite this, current documentation
 recommends that approach:
 
 http://svn.python.org/projects/python/trunk/Doc/howto/urllib2.rst

And...?  What specifically are you complaining about?

Just as a matter of fact (I'm not grumpy about it): I see from your
message that you already know that there is not a shortage of people
who spot the lack of this kind of feature.  The shortage is of people
who will actually do the job of adding the feature -- most
importantly, people who will contribute high quality patches,
including tests and docs, and people who will review other people's
patches.


 Someone proposed to fix this
 
 http://mail.python.org/pipermail/python-dev/2006-July/066967.html
 
 but was discouraged from doing so.
[...]

While it might be discouraging to be confronted with tiresome
realities of schedules and resources, those are the realities.

The flip side is that you can make a real difference by putting in
some work.

Looking forward to your patch :-)


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


Re: find login name of user?

2006-12-30 Thread Martin P. Hellwig
Uwe Hoffmann wrote:
 [EMAIL PROTECTED] schrieb:
 Is there a function/module to find the login name of the user under
 UNIX environment?
 
 
 http://docs.python.org/lib/os-procinfo.html
 
 http://docs.python.org/lib/module-pwd.html

Speaking of that, is there any reason why there isn't any syntactic 
sugar that gives the illusion of platform neutral fetching of the user name?

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


Re: DOS, UNIX and tabs

2006-12-30 Thread Paul McNett
Sebastian 'lunar' Wiesner wrote:
 Paul McNett [EMAIL PROTECTED] typed
 
 Steven D'Aprano wrote:
 But I think we all agree that mixing tabs and spaces is A Very Bad
 Thing.
 I like mixing tabs and spaces, actually. Tabs for indentation, and
 additional spaces to make the code look pretty. Somebody please tell
 me why this is bad and I'll stop.

 class Apple(object):
 def contrived_example_function(self, argument1, argument2,
 argument3, argument4):
 print hello, world

 Apparently, emacs in python mode follows this convention, too.
 
 That doesn't seem like a standard settings to me. I can't remember
 changing the indentation settings for python, nonetheless my gnu emacs
 uses four spaces for indentation. Placing wrapped lines into ordered
 columns is done by inserting additional spaces. This all happens
 automatically; you never need to insert spaces manually...

I never tried emacs, but somebody once told me that if you have set
indentation-by-tab, it will indent with tabs but insert additional
spaces in wrapped lines to look pretty.


 I like it because I get the best of both worlds: the only thing
 against using tabs-only-indentation is that wrapping long lines can be
 quite ugly, while space-only-indentation allows for beautifying it
 somewhat by lining up the columns to match.
 
 Did you try to open your code files with another editor, which has a
 different length for tabulator chars? It would look quite ugly, I
 guess...

Actually, no. Everyone can choose their own number of spaces-per-tab and
it'll look right, as long as everyone uses a monospace font.

-- 
pkm ~ http://paulmcnett.com


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


Re: xml bug?

2006-12-30 Thread Imbaud Pierre
Martin v. Löwis a écrit :
 Imbaud Pierre schrieb:
 
- how do I spot the version of a given library? There is a __version__
  attribute of the module, is that it?
 
 
 Contrary to what others have said: for modules included in the standard
 library (and if using these modules, rather than using PyXML), you
 should use sys.version_info to identify a version.
 
 
- How do I access to a given library buglist? Maybe this one is known,
  about to be fixed, it would then be useless to report it.
 
 
 Others have already pointed you to SF.
 
 
- How do I report bugs, on a standard lib?
 
 
 Likewise.
 
 
- I tried to copy the lib somewhere, put it BEFORE the official lib in
  the path (that is:sys.path), the stack shown by the traceback
  still shows the original files being used. Is there a special
  mechanism bypassing the sys.path search, for standard libs? (I may
  be wrong on this, it seems hard to believe...)
 
 
 Which lib? minidom.py? Well, you are likely importing
 xml.dom.minidom, not minidom. So adding another minidom.py
 to a directory in sys.path won't help.
 
 Regards,
 Martin
I did import xml!
Maybe my mistake came from copying the whole tree from the standard
lib: comprising .pyc, .pyo... maybe the .pyc contained references to
previous sources?
Got rid of these, did reload ALL the modules, then exited/re-entered
the interpreter (ipython, btw...), and it eventually accessed the new
modules...

Btw, I pushed debugging further, the bug seem to stem from C code,
hence nothing easy to fix... Ill indeed submit a bug.
Thanks for your help! I obviously screamed for help before being
helpless, apologies...

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


Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Osiris
On Sat, 30 Dec 2006 13:19:28 -0800, Erik Max Francis [EMAIL PROTECTED]
wrote:

Osiris wrote:

 I have these pieces of C-code (NOT C++ !!) I want to call from Python.
 I found Boost.
 I have MS Visual Studio 2005 with C++.
 
 is this the idea:
 I write the following C source file:
 
 #include iostream
 #include stdafx.h
 
 namespace { // Avoid cluttering the global namespace.

iostream and namespaces are both most definitely C++ features, not C.

yes, but C can be compiled with a C++ compiler,  One can put C code in
C++ source Boost should not complain... should it ?
Boost text is all about C++.. so... C should not be a problem...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread gblais
R is the free version of the S language.  S-PLUS is a commercial version. 
Both are targeted at statisticians per se.  Their strengths are in
exploratory data analysis (in my opinion).

SAS has many statistical featues, and is phenomenally well-documented and
supported.  One of its great strengths is the robustness of its data model
-- very well suited to large sizes, repetitive inputs, industrial-strength
data processing with a statistics slant.  Well over 200 SAS books,for
example.

I think of SAS and R as being like airliners and helicopters -- airlines get
the job done, and well, as long as it's well-defined and nearly the same job
all the time.  Helicopters can go anywhere, do anything, but a moment's
inattention leads to a crash.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Erik Max Francis
Osiris wrote:

 yes, but C can be compiled with a C++ compiler,  One can put C code in
 C++ source Boost should not complain... should it ?
 Boost text is all about C++.. so... C should not be a problem...

That you're dealing with a `boost` namespace below clearly indicates 
that you're dealing with C++ code throughout, not C, contrary to what 
you had claimed.  C and C++ are not the same language.

-- 
Erik Max Francis  [EMAIL PROTECTED]  http://www.alcyone.com/max/
  San Jose, CA, USA  37 20 N 121 53 W  AIM, Y!M erikmaxfrancis
   The enemy of my enemy is my friend.
-- (an Arab proverb)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
 I think of SAS and R as being like airliners and helicopters -- 
I like that comparison,...
.. Airplanes are inherent stable,
.. Helicopters are inherent not-stable ;-)

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Christophe Cavalaria
Osiris wrote:

 On Sat, 30 Dec 2006 13:19:28 -0800, Erik Max Francis [EMAIL PROTECTED]
 wrote:
 
Osiris wrote:

 I have these pieces of C-code (NOT C++ !!) I want to call from Python.
 I found Boost.
 I have MS Visual Studio 2005 with C++.
 
 is this the idea:
 I write the following C source file:
 
 #include iostream
 #include stdafx.h
 
 namespace { // Avoid cluttering the global namespace.

iostream and namespaces are both most definitely C++ features, not C.
 
 yes, but C can be compiled with a C++ compiler,  One can put C code in
 C++ source Boost should not complain... should it ?
 Boost text is all about C++.. so... C should not be a problem...

Not all C code can be compiled by a C++ compiler. And anyway, this is
definitively NOT C code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Progress Box or Bar in Windows

2006-12-30 Thread tubby
Hi guys,

I have a Python script that I've prettied-up for Windows users by adding 
things like shell.SHBrowseForFolder and win32gui.MessageBox, etc. In 
short, it looks like this:

1. Pretty window where user can browse for folder. (instead of typing 
path into cmd prompt)

2. win32gui.MessageBox informing user the script will now begin.

3.

4. win32gui.MessageBox informing user the script has finished.

I left 3 blank. This is where I'd like to use some sort of progress 
indicator (a box that says 'processing 3 of 30 files... 4 of 30, etc' or 
a progress bar that moves across the screen as the script does its job. 
Any ideas on how to do this quickly and easily (less than 20 lines of code)?

I'd prefer to stick with the win32 extensions, but I'd be willing to use 
TK too if that would be simpler... and it looks like TK would be much 
simpler :)

Thanks!

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


Re: Why does Python never add itself to the Windows path?

2006-12-30 Thread Ben Sizer
Martin v. Löwis wrote:

 Ben Sizer schrieb:
  I've installed several different versions of Python across several
  different versions of MS Windows, and not a single time was the Python
  directory or the Scripts subdirectory added to the PATH environment
  variable. Every time, I've had to go through and add this by hand, to
  have something resembling a usable Python installation. No such
  problems on Linux, whether it be Mandrake/Mandriva, Fedora Core, or
  Kubuntu. So why is the Windows install half-crippled by default?

 For several reasons:
 1. Python can be used just fine without being on PATH. Python
scripts run fine both when double-clicked and when invoked in
the command line, and if you want to use an interactive
interpreter, you can find it readily on the Start menu.

Yet many scripts and applications require parameters, or to be executed
from a certain directory. For example, setup.py. Or the various
turbogears scripts. Or easy_install.

 2. Many windows users (including myself) dislike setup routines that
manipulate PATH.

My opinion is that this is not as big a problem as some may feel that
it is. Unlike Unix systems, the PATH variable is rarely used. Most
applications are launched via the Start Menu, which uses absolute
paths, or via file associations, also done via absolute paths. The
chance of a naming collision only really arises when you start using
the command line, which most people don't do.

However, among those who will use the command line, are some people new
to Python, who will come across instructions like this:

http://docs.python.org/inst/standard-install.html

As described in section 1.2, building and installing a module
distribution using the Distutils is usually one simple command:

python setup.py install

On Unix, you'd run this command from a shell prompt; on Windows, you
have to open a command prompt window (``DOS box'') and do it there; 

Pretty much none of the instructions in that part of the docs will work
without you altering your path beforehand. Python's cross-platform
nature means people rightly expect the same instructions to work on
Linux and Windows from a standard installation. Right now, they don't.

 if Python is to be found in PATH, it
should rather be installed to a directory that is known to live
on PATH (or where CreateProcess searches, anyway, such
as system32). So if the installer had such a feature, it should
be optional, and it should default to off.

It's a lot more anti-social to install to system32 than to modify the
PATH variable. How easy is it to temporarily undo an installation to a
system directory like that? What if you still want Python in your path
but with less precedence than some other user directory?

 3. Most importantly: it is difficult to implement, and nobody has
contributed code to make it work.

There appears to be a freely-available binary at this address that may
suffice:
http://legroom.net/modules.php?op=modloadname=Open_Sourcefile=indexpage=softwareapp=modpath

-- 
Ben Sizer

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

Question concerning this list

2006-12-30 Thread Thomas Ploch
Hello fellow pythonists,

I have a question concerning posting code on this list.

I want to post source code of a module, which is a homework for
university (yes yes, I know, please read on...).

It is a web crawler (which I will *never* let out into the wide world)
which uses regular expressions (and yes, I know, thats not good, too). I
have finished it (as far as I can), but since I need a good mark to
actually finish the course, I am wondering if I can post the code, and I
am wondering if anyone of you can review it and give me possible hints
on how to improve things.

So is this O.K.? Or is this a blatantly idiotic idea?

I hope I am not the idiot of the month right now...

Thanks in advance,
Thomas

P.S.:

I might give some of my Christmas chocolate away as a donation to this
list... :-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Ramon Diaz-Uriarte
On 12/31/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 R is the free version of the S language.  S-PLUS is a commercial version.
 Both are targeted at statisticians per se.  Their strengths are in
 exploratory data analysis (in my opinion).

 SAS has many statistical featues, and is phenomenally well-documented and
 supported.  One of its great strengths is the robustness of its data model
 -- very well suited to large sizes, repetitive inputs, industrial-strength
 data processing with a statistics slant.  Well over 200 SAS books,for
 example.

 I think of SAS and R as being like airliners and helicopters -- airlines get
 the job done, and well, as long as it's well-defined and nearly the same job
 all the time.  Helicopters can go anywhere, do anything, but a moment's
 inattention leads to a crash.
 --

inattention leading to a crash? I don't get it. I used SAS for about 3
or 4 years, and have used S-Plus and then R for 10 years (R for 8
years now). I've never noticed inattention leading to a crash. I've
noticed I cannot get away in R without a careful definition of what I
want (which is good), and the immediate interactivity of R is very
helpful with mistakes. And of course, programming in R is, well,
programming in a reasonable language. Programming in SAS is ... well,
programming in SAS (which is about as fun as programming in SPSS).

(Another email somehow suggested that the stability/instability
analogy of airplanes vs. helicopters does apply to SAS vs. R. Again, I
don't really get it. Sure, SAS is very stable. But so is R ---one
common complaint is getting seg faults because package whatever has
memory leaks, but that is not R's fault, but rather the package's
fault).

But then, this might start looking a lot like a flame war, which is
actually rather off-topic for this list.


Anyway, for a Python programmer, picking up R should be fairly easy.
And rpy is really a great way of getting R and Python to talk to each
other. We do this sort of thing quite a bit on our applications.

And yes, R is definitely available for both Linux and Windows (and
Mac), has excellent support from several editors in those platforms
(e.g., emacs + ess, tinn-R, etc), and seems to be becoming a de facto
standard at least in statistical research and is extremely popular in
bioinformatics and among statisticians who do bioinformatics (look at
bioconductor.org).


Ramon


-- 
Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question concerning this list

2006-12-30 Thread Steven D'Aprano
On Sun, 31 Dec 2006 02:03:34 +0100, Thomas Ploch wrote:

 Hello fellow pythonists,
 
 I have a question concerning posting code on this list.
 
 I want to post source code of a module, which is a homework for
 university (yes yes, I know, please read on...).

So long as you understand your university's policy on collaborations.


 
 It is a web crawler (which I will *never* let out into the wide world)

If you post it on Usenet, you will have let it out into the wide world.
People will see it. Some of those people will download it. Some of them
will run it. And some of them will run it, uncontrolled, on the WWW.

Out of curiosity, if your web crawler isn't going to be used on the web,
what were you intending to use it on?



 which uses regular expressions (and yes, I know, thats not good, too).

Regexes are just a tool. Sometimes they are the right tool for the job.
Sometimes they aren't.



 I have finished it (as far as I can), but since I need a good mark to
 actually finish the course, I am wondering if I can post the code, and I
 am wondering if anyone of you can review it and give me possible hints
 on how to improve things.

That would be collaborating. What's your university's policy on
collaborating? Are you allowed to do so, if you give credit? Is it
forbidden?

It probably isn't a good idea to post a great big chunk of code and expect
people to read it all. If you have more specific questions than how can
I make this better?, that would be good. Unless the code is fairly
short, it might be better to just post a few extracted functions and see
what people say about them, and then you can extend that to the rest of
your code.



-- 
Steven.

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


Re: I want to see all the variables

2006-12-30 Thread Rene Fleschenberg
johnf wrote:
 Very detailed.  But I was attempting to debug some code which subclassed
 other code. I got a traceback that something like no
 mySubClass.__source.query() did not exist.  

By (strong) convention, __ means not to be accessed from outside the
class, not even from subclasses. The author of the original class does
not want you to access that attribute.

 The superclass had something
 like myClass.__source.query(sql) which worked
 but mySubClass.__source.query(sql) did not work.  So I tried to debug
 using dir(myClass.__source) and got an error.  

dir(myClass._myClass__source) should work, as should
dir(mySubClass._myClass__source) and mySubClass._myClass__source.

But remember that it is usually really bad style to do this and that
there is probably a reason why the author of myClass does not want you
to do that. If myClass was written by yourself, simply do not use __.
Only use __ when you really know why you are doing it. Otherwise, just
use _.
See also: http://docs.python.org/ref/atom-identifiers.html

 And I also got error when
 I dir(mySubClass.__source. So how could I have debugged the problem if
 dir() will not display information on the __source?  I hope that explains
 my issue.

A simple dir() on myClass could have given you a hint on what happens
with __source.

-- 
René
OpenPGP key id: 0x63B1F5DB
JID: [EMAIL PROTECTED]



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: I want to see all the variables

2006-12-30 Thread Steven D'Aprano
On Sat, 30 Dec 2006 11:08:10 -0800, johnf wrote:

 Very detailed.  But I was attempting to debug some code which subclassed
 other code. I got a traceback that something like no
 mySubClass.__source.query() did not exist.  The superclass had something
 like myClass.__source.query(sql) which worked
 but mySubClass.__source.query(sql) did not work.

That's right, exactly as expected.

As I said before, Python mangles the name of double-leading underscore
class attributes. So when the developer of myClass wrote 

myClass.__source.query(sql)

at compile time Python changes that to

myClass._myClass__source.query(sql)


When you write mySubClass.__source.query() it doesn't work because there
is no attribute __source. You need to change that to _myClass__source
-- even when it appears in mySubClass.


 So I tried to debug
 using dir(myClass.__source) and got an error. And I also got error when
 I dir(mySubClass.__source. So how could I have debugged the problem if
 dir() will not display information on the __source?  I hope that explains
 my issue.

This isn't actually a problem with dir -- although dir does sometimes hide
methods, this isn't one of those cases. This is a case of you not knowing
that Python mangles the name of __attributes. What you should have done is
call dir(myClass), in which case you almost certainly would have seen
_myClass__source listed.



-- 
Steven.

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


Re: I want to see all the variables

2006-12-30 Thread Steven D'Aprano
On Sun, 31 Dec 2006 03:39:52 +0100, Rene Fleschenberg wrote:

 johnf wrote:
 Very detailed.  But I was attempting to debug some code which subclassed
 other code. I got a traceback that something like no
 mySubClass.__source.query() did not exist.  
 
 By (strong) convention, __ means not to be accessed from outside the
 class, not even from subclasses. The author of the original class does
 not want you to access that attribute.

What does the author of the original class know about *my* needs and
requirements? It may turn out that accessing his private attributes is
exactly what I need to solve my problem.

I'm with the Python philosophy on this one: post all the Don't Touch
This warning signs you like, but if somebody really wants to access my
private attributes, to do something I never even imagined, they should be
allowed to. If they break something, well, that's their fault, not mine.
I'm 100% in favour of language features which protect people from
*accidentally* shooting themselves in the foot, but if somebody wants to,
who am I to say they mustn't?



-- 
Steven.

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


Re: Wow, Python much faster than MatLab

2006-12-30 Thread sturlamolden

Stef Mientki wrote:

 I always thought that SPSS or SAS where thé standards.
 Stef

As far as SPSS is a standard, it is in the field of religious use of
statistical procedures I don't understand (as I'm a math retard), but
hey p0.05 is always significant (and any other value is proof of the
opposite ... I think).

SPSS is often used by scientists that don't understand maths at all,
often within the fields of social sciences, but regrettably also within
biology and medicine. I know of few program that have done so much harm
as SPSS. It's like handing an armed weapon to a child. Generally one
should stay away from the things that one don't understand,
particularly within medicine where a wrong result can have dramatic
consequences. SPSS encourages the opposite. Copy and paste from Excel
to SPSS is regrettably becoming the de-facto standard in applied
statistics. The problem is not the quality of Excel or SPSS, but rather
the (in)competence of those conducting the data analysis. This can and
does regrettably lead to serious misinterpretation of the data, in
either direction. When a paper is submitted, these errors are usually
not caught in the peer review process, as peer review is, well, exactly
what is says: *peer* review.

Thus, SPSS makes it easy to shoot your self in the foot. In my
experience students in social sciences and medicine are currently
thought to do exact that, in universities and colleges all around the
World. And it is particularly dangerous within medical sciences, as
peoples' life and health may be affected by it. I pray God something is
done to prohibit or limit the use of these statistical toys.


Sturla Molden
PhD

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


Re: Question concerning this list

2006-12-30 Thread Thomas Ploch
Steven D'Aprano wrote:
 On Sun, 31 Dec 2006 02:03:34 +0100, Thomas Ploch wrote:
 
 Hello fellow pythonists,

 I have a question concerning posting code on this list.

 I want to post source code of a module, which is a homework for
 university (yes yes, I know, please read on...).
 
 So long as you understand your university's policy on collaborations.

Well, collaborations are wanted by my prof, but I think he actually
meant it in a way of getting students bonding with each other and
establishing social contacts. He just said that he will reject copy 
paste stuff and works that actually have nothing to do with the topic
(when we were laughing, he said we couldn't imagine what sometimes is
handed in).

 It is a web crawler (which I will *never* let out into the wide world)
 
 If you post it on Usenet, you will have let it out into the wide world.
 People will see it. Some of those people will download it. Some of them
 will run it. And some of them will run it, uncontrolled, on the WWW.
 
 Out of curiosity, if your web crawler isn't going to be used on the web,
 what were you intending to use it on?

It's a final homework, as I mentioned above, and it shouldn't be used
anywhere but our university server to test it (unless timing of requests
(i.e. only two fetches per second), handling of 'robots.txt' is
implemented). But you are right with the Usenet thing, havn't thought
about this actually, so I won't post the whole portion of the code.

 which uses regular expressions (and yes, I know, thats not good, too).
 
 Regexes are just a tool. Sometimes they are the right tool for the job.
 Sometimes they aren't.

Alright, my prof said '... to process documents written in structural
markup languages using regular expressions is a no-no.' (Because of
nested Elements? Can't remember) So I think he wants us to use regexes
to learn them. He is pointing to HTMLParser though.

 I have finished it (as far as I can), but since I need a good mark to
 actually finish the course, I am wondering if I can post the code, and I
 am wondering if anyone of you can review it and give me possible hints
 on how to improve things.


 It probably isn't a good idea to post a great big chunk of code and expect
 people to read it all. If you have more specific questions than how can
 I make this better?, that would be good. Unless the code is fairly
 short, it might be better to just post a few extracted functions and see
 what people say about them, and then you can extend that to the rest of
 your code.

You are probably right. For me it boils down to these problems:
- Implementing a stack for large queues of documents which is faster
than list.pop(index) (Is there a lib for this?)
- Getting Handlers for different MIME/ContentTypes and specify callbacks
only for specific Content-Types / MIME-Types (a lot of work and complex
checks)
- Handle different encodings right.

I will follow your suggestions and post my code concerning specifically
these problems, and not the whole chunk.

Thanks,
Thomas


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


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Wensui Liu
Sturla,

I am working in the healthcare and seeing people loves to use excel /
spss as database or statistical tool without know what he/she is
doing. However, that is not the fault of excel/spss itself but of
people who is using it. Things, even include SAS/R, would look stupid,
when it has been misused.

In the hospitals, people don't pray God. They pray MD. :-)

On 30 Dec 2006 19:09:59 -0800, sturlamolden [EMAIL PROTECTED] wrote:

 Stef Mientki wrote:

  I always thought that SPSS or SAS where thé standards.
  Stef

 As far as SPSS is a standard, it is in the field of religious use of
 statistical procedures I don't understand (as I'm a math retard), but
 hey p0.05 is always significant (and any other value is proof of the
 opposite ... I think).

 SPSS is often used by scientists that don't understand maths at all,
 often within the fields of social sciences, but regrettably also within
 biology and medicine. I know of few program that have done so much harm
 as SPSS. It's like handing an armed weapon to a child. Generally one
 should stay away from the things that one don't understand,
 particularly within medicine where a wrong result can have dramatic
 consequences. SPSS encourages the opposite. Copy and paste from Excel
 to SPSS is regrettably becoming the de-facto standard in applied
 statistics. The problem is not the quality of Excel or SPSS, but rather
 the (in)competence of those conducting the data analysis. This can and
 does regrettably lead to serious misinterpretation of the data, in
 either direction. When a paper is submitted, these errors are usually
 not caught in the peer review process, as peer review is, well, exactly
 what is says: *peer* review.

 Thus, SPSS makes it easy to shoot your self in the foot. In my
 experience students in social sciences and medicine are currently
 thought to do exact that, in universities and colleges all around the
 World. And it is particularly dangerous within medical sciences, as
 peoples' life and health may be affected by it. I pray God something is
 done to prohibit or limit the use of these statistical toys.


 Sturla Molden
 PhD

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



-- 
WenSui Liu
A lousy statistician who happens to know a little programming
(http://spaces.msn.com/statcompute/blog)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread sturlamolden

Stef Mientki wrote:

 MatLab: 14 msec
 Python:  2 msec

I have the same experience. NumPy is usually faster than Matlab. But it
very much depends on how the code is structured.

I wonder if it is possible to improve the performance of NumPy by
having its fundamental types in the language, instead of depending on
operator overloading. For example, in NumPy, a statement like

array3[:] = array1[:] + array2[:]

allocates an intermediate array that is not needed. This is because the
operator overloading cannot know if it's evaluating a part of a larger
statement like

array1[:] = (array1[:] + array2[:]) * (array3[:] + array4[:])

If arrays had been a part of the language, as it is in Matlab and
Fortran 95, the compiler could see this and avoid intermediate storage,
as well as looping over the data only once. This is one of the main
reasons why Fortran is better than C++ for scientific computing. I.e.
instead of

for (i=0; in; i++)
  array1[i] = (array1[i] + array2[i]) * (array3[i] + array4[i]);

one actually gets something like three intermediates and four loops:

tmp1 = malloc(n*sizeof(whatever));
for (i=0; in; i++)
   tmp1[i] = array1[i] + array2[i];
tmp2 = malloc(n*sizeof(whatever));
for (i=0; in; i++)
   tmp2[i] = array3[i] + array4[i];
tmp3 = malloc(n*sizeof(whatever));
for (i=0; in; i++)
   tmp3[i] = tmp1[i] + tmp2[i];
free(tmp1);
free(tmp2);
for (i=0; in; i++)
  array1[i]  = tmp3[i];
free(tmp3);

In C++ this is actually further bloated by constructor, destructor and
copyconstructor calls.
Why one should use Fortran over C++ is obvious. But it also applies to
NumPy, and also to the issue of Numpy vs. Matlab, as Matlab know about
arrays and has a compiler that can deal with this, whilst NumPy depends
on bloated operator overloading. On the other hand, Matlab is
fundamentally impaired on function calls and array slicing compared
with NumPy (basically copies are created instead of views). Thus, which
is faster - Matlab or NumPy - very much depends on how the code is
written.

Now for my question: operator overloading is (as shown) not the
solution to efficient scientific computing. It creates serious bloat
where it is undesired. Can NumPy's performance be improved by adding
the array types to the Python language it self? Or are the dynamic
nature of Python preventing this?

Sturla Molden

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


Re: Wow, Python much faster than MatLab

2006-12-30 Thread sturlamolden

Wensui Liu wrote:

 doing. However, that is not the fault of excel/spss itself but of
 people who is using it.

Yes and no. I think SPSS makes it too tempting. Like children playing
with fire, they may not even know it's dangerous. You can do an GLM in
SPSS by just filling out a form - but how many social scientists or MDs
know anything about general linear models?

The command line interface of MySQL, SAS, Matlab and R makes an
excellent deterrent. All statistical tool can be misused. But the
difference is accidental and deliberate misuse. Anyone can naviagte a
GUI, but you need to know you want to do an ANOVA before you can think
of typing anova on the command line.

You mentioned use of Excel as database. That is another example,
although it has more to do with data security and integrity, and
sometimes protection of privacy. Many companies have banned the use of
Microsoft Access, as employees were building their own mock up
databases - thus migrating these Access databases to an even worse
solution (Excel). 

Sturla Molden

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


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Robert Kern
sturlamolden wrote:
 array3[:] = array1[:] + array2[:]

OT, but why are you slicing array1 and array2? All that does is create new array
objects pointing to the same data.

 Now for my question: operator overloading is (as shown) not the
 solution to efficient scientific computing. It creates serious bloat
 where it is undesired. Can NumPy's performance be improved by adding
 the array types to the Python language it self? Or are the dynamic
 nature of Python preventing this?

Pretty much. Making the array types builtin rather than from a third party
module doesn't really change anything. However, if type inferencing tools like
psyco are taught about numpy arrays like they are already taught about ints,
then one could do make it avoid temporaries.

-- 
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


looking for a better way to call a file.

2006-12-30 Thread [EMAIL PROTECTED]
I have been auto-generating .bat files and then running
os.startfile('whatever.bat').  I don't
seem to be having much luck when I try other methods.  All of a sudden
I am stuck in a
situation where I need the program that is calling to end and a new
program to start (because otherwise I get several uneeded copies).

csoundgrid4.csgrid(arrg1,  ;sco_header, filename)

with this by executing the main function

os3.execvp('python', 'csoundgrid4.py', arrg1,  ;sco_header,
filename)

and the program just ends.  I would also be glad to get rid of all the
bats that I generate when I
run an external program like csound.  The command line I run is
somthing like

csound play.orc play.sco

I haven't had much luck using os.startfile with arguments

Hopefully this is an easy question and any help would be apreaceated
(befour my computer gets rabies)

http://www.dexrow.com

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


Re: Why does Python never add itself to the Windows path?

2006-12-30 Thread vbgunz
Ben Sizer wrote:
 I've installed several different versions of Python across several
 different versions of MS Windows, and not a single time was the Python
 directory or the Scripts subdirectory added to the PATH environment
 variable.

I don't understand what all the fuss is about. Add a single page to the
installer and on it, have 3 radio buttons. The choices could be add to
path (recommended), add to path with version, do not add to path
(not recommended). On a brand new installation or if the user is
upgrading, add to path (recommended) should automatically be
selected. If the user is downgrading, add to path with version could
be the default selection? If a user truly does not want the Python
installation to touch the path, they'll know to select do not add to
path (not recommended) and it's the end of the story, everyone is
happy... It doesn't even have to be like this *but* why not help add
the install to the path?

I haven't used Windows in quite a while but I've done several
installations across some of the family boxes and some inside some
virtual machines and every time I tried launching python through a
console I temporarily got stunned with an error. I just forget and wish
the install could at least remind me. No problem, I know how to add the
path so no biggie at all. Some if not most python documentation assumes
Python is on the path... Anyhow, I don't get why it doesn't apply by
default in some way on Windows even if at the least it could be a
simple reminder or tip to do so.

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


Re: find login name of user?

2006-12-30 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:

 Is there a function/module to find the login name of the user under
 UNIX environment?

Note that there isn't really an important concept of login name under *NIX
systems. There is the current process UID and GID, effective UID and GID
and so on, but these are just numbers, not names.

The OS doesn't remember anywhere the actual name that you used to login
with; this is conventionally saved in the USER environment variable, but
this is purely for informational purposes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: a question on python dict

2006-12-30 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Tim
Peters wrote:

 You should also note that copying a dict key or value (no matter of
 what type) consists in its entirety of copying one machine address (a
 4- or 8-byte pointer, depending on platform).

Actually, no. It also consists of updating reference counts as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


[ python-Feature Requests-1191964 ] asynchronous Subprocess

2006-12-30 Thread SourceForge.net
Feature Requests item #1191964, was opened at 2005-04-28 20:40
Message generated for change (Comment added) made by o
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=355470aid=1191964group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Josiah Carlson (josiahcarlson)
Assigned to: Peter Åstrand (astrand)
Summary: asynchronous Subprocess

Initial Comment:
It would be terribly nice if the Popen class in the
subprocess module would allow a programmer to easily
say send some data right now (if I have some to send)
and receive whatever information is available right
now.  Essentially the equivalent of
asyncore.loop(count=1), only that it returns the data
received, instead of placing it in a buffer.

Why would this functionality be useful?  Currently,
when using the subprocess module with pipes, the
interaction with a pipe is limited to send data if
desired, close the subprocess' stdin, read all output
from the subprocess' stdout,  

Certainly one can pull the pipes out of the Popen
instance, and perform the necessary functions on posix
systems (with select or poll), but the additional magic
on WIndows is a little less obvious (but still possible).

There is a post by Paul Du Bois with an example using
win32pipe.PeekNamedPipe:
http://groups-beta.google.com/group/comp.lang.python/msg/115e9332cc1ca09d?hl=en

And a message from Neil Hodgeson stating that
PeekNamedPipe works on anonymous pipes:
http://mail.python.org/pipermail/python-dev/2000-May/004200.html


With this modification, creating Expect-like modules
for any platform, as well as embedded shells inside any
GUI with a text input widget, becomes easy.  Heck, even
Idle could use it rather than a socket for its
interactive interpreter.

--

Comment By: Benjamin (o)
Date: 2006-12-30 21:45

Message:
Logged In: YES 
user_id=1680023
Originator: NO

I would also like to see this feature. I'm using Josiah Carlson's recipe
for the time being. I'm agnostic about whether the asynchronicity is a
mode or just a case of using different functions. However, if the former
is chosen, then one should be able to switch modes at will, because
sometimes I want blocking and sometimes I don't.

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-09-21 20:55

Message:
Logged In: YES 
user_id=341410

I've implemented this as a subclass of subprocess.Popen in
the Python cookbook, available here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-09-21 20:51

Message:
Logged In: YES 
user_id=341410

I've implemented this as a subclass of subprocess.Popen in
the Python cookbook, available here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554

Essentially this is a request for inclusion in the standard
library for Python 2.5 .

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-06-26 19:47

Message:
Logged In: YES 
user_id=341410

How about if subprocesses have 3 new methods, send(input),
recv(maxlen), and recv_stderr(maxlen).

send(input) would perform like socket.send(), sending as
much as it currently can, returning the number of bytes sent.
recv(maxlen) and recv_stderr(maxlen) would recieve up to the
provided number of bytes from the stdout or stderr pipes
respectively.

I currently have an implementation of the above on Windows
and posix.  I include the context diff against revision 1.20
of subprocess.py in current CVS.

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-05-29 00:15

Message:
Logged In: YES 
user_id=341410

I suppose I should mention one side-effect of all this.  It
requires three more functions from pywin32 be included in
the _subprocess driver; win32file.ReadFile,
win32file.WriteFile, and win32pipe.PeekNamedPipe .  Read and
Peek are for reading data from stdout and stderr, and Write
is for the support for partial writes to stdin.

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-05-28 23:22

Message:
Logged In: YES 
user_id=341410

I've got a version of subprocess that has this functionality
with pywin32.  Making it work on *nix systems with usable
select is trivial.

About the only question is whether the functionality is
desireable, and if so, what kind of API is reasonable.

Perhaps adding an optional argument 'wait_for_completion' to
the communicate method, which defaults to True 

[ python-Feature Requests-1191964 ] asynchronous Subprocess

2006-12-30 Thread SourceForge.net
Feature Requests item #1191964, was opened at 2005-04-28 13:40
Message generated for change (Comment added) made by josiahcarlson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=355470aid=1191964group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Josiah Carlson (josiahcarlson)
Assigned to: Peter Åstrand (astrand)
Summary: asynchronous Subprocess

Initial Comment:
It would be terribly nice if the Popen class in the
subprocess module would allow a programmer to easily
say send some data right now (if I have some to send)
and receive whatever information is available right
now.  Essentially the equivalent of
asyncore.loop(count=1), only that it returns the data
received, instead of placing it in a buffer.

Why would this functionality be useful?  Currently,
when using the subprocess module with pipes, the
interaction with a pipe is limited to send data if
desired, close the subprocess' stdin, read all output
from the subprocess' stdout,  

Certainly one can pull the pipes out of the Popen
instance, and perform the necessary functions on posix
systems (with select or poll), but the additional magic
on WIndows is a little less obvious (but still possible).

There is a post by Paul Du Bois with an example using
win32pipe.PeekNamedPipe:
http://groups-beta.google.com/group/comp.lang.python/msg/115e9332cc1ca09d?hl=en

And a message from Neil Hodgeson stating that
PeekNamedPipe works on anonymous pipes:
http://mail.python.org/pipermail/python-dev/2000-May/004200.html


With this modification, creating Expect-like modules
for any platform, as well as embedded shells inside any
GUI with a text input widget, becomes easy.  Heck, even
Idle could use it rather than a socket for its
interactive interpreter.

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2006-12-30 15:21

Message:
Logged In: YES 
user_id=341410
Originator: YES

The way subprocess is currently written, if you were to use a blocking
semantic, you would no longer be able to use an asynchronous semantic
afterwards (it will read the result until there is nothing more to read). 
Note that this is the case whether it is mode or method based.

--

Comment By: Benjamin (o)
Date: 2006-12-30 13:45

Message:
Logged In: YES 
user_id=1680023
Originator: NO

I would also like to see this feature. I'm using Josiah Carlson's recipe
for the time being. I'm agnostic about whether the asynchronicity is a
mode or just a case of using different functions. However, if the former
is chosen, then one should be able to switch modes at will, because
sometimes I want blocking and sometimes I don't.

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-09-21 13:55

Message:
Logged In: YES 
user_id=341410

I've implemented this as a subclass of subprocess.Popen in
the Python cookbook, available here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-09-21 13:51

Message:
Logged In: YES 
user_id=341410

I've implemented this as a subclass of subprocess.Popen in
the Python cookbook, available here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554

Essentially this is a request for inclusion in the standard
library for Python 2.5 .

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-06-26 12:47

Message:
Logged In: YES 
user_id=341410

How about if subprocesses have 3 new methods, send(input),
recv(maxlen), and recv_stderr(maxlen).

send(input) would perform like socket.send(), sending as
much as it currently can, returning the number of bytes sent.
recv(maxlen) and recv_stderr(maxlen) would recieve up to the
provided number of bytes from the stdout or stderr pipes
respectively.

I currently have an implementation of the above on Windows
and posix.  I include the context diff against revision 1.20
of subprocess.py in current CVS.

--

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-05-28 17:15

Message:
Logged In: YES 
user_id=341410

I suppose I should mention one side-effect of all this.  It
requires three more functions from pywin32 be included in
the _subprocess driver; win32file.ReadFile,
win32file.WriteFile, and win32pipe.PeekNamedPipe .  Read and
Peek are for reading data from stdout and stderr, and Write
is for the support for partial writes to stdin.


[ python-Bugs-1625205 ] sqlite3 documentation omits: close(), commit(), autocommit

2006-12-30 Thread SourceForge.net
Bugs item #1625205, was opened at 2006-12-30 23:34
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1625205group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: kitbyaydemir (kitbyaydemir)
Assigned to: Nobody/Anonymous (nobody)
Summary: sqlite3 documentation omits: close(), commit(), autocommit

Initial Comment:
The Python 2.5 Library documentation (HTML format), Section 13.13 (sqlite3) 
fails to mention several important methods of Connection objects.  
Specifically, the close() and commit() methods.  Considering that autocommit 
mode is not the default, I'm not sure how a user is supposed to figure out that 
they need to call these methods to ensure that changes are reflected on disk.  
(The only reason I discovered these was from 
http://initd.org/tracker/pysqlite/wiki/basicintro .)

Furthermore, Section 13.13.5 mentions the existence of autocommit mode, but 
fails to describe what that mode is and why it might be useful.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detailatid=105470aid=1625205group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com