Re: python coding contest

2006-01-01 Thread Claudio Grondi
Claudio Grondi wrote:
>> Please send me comments, suggestions and ideas.
> 
> 
> Now, after the contest is over I analysed the outcome of it and have 
> come to the conclusion, that there were two major factors which 
> contributed to squeezing of code:
> 
>   (1). usage of available variants for coding of the same thing
>   (2). sqeezing the size of used numeric and string literals
> 
> As (1) leads to less readable cryptic code it makes not much sense from 
> my point of view to dig deeper in that direction. As already mentioned 
> in this thread by Tim Peters ( pointing to 
> http://spoj.sphere.pl/problems/KAMIL/ ) it seems, that Pearl is here the 
> proper language of choice for such kind of problems anyway.
> 
> Trying to improve on (2) belongs in my eyes much more into the area of 
> problems discussed in comp.compression than to problems belonging into 
> comp.lang.python .
> 
> So what is my point? Ok, I will mention it at the end of this post.
> 
> Before that I want to thank the originators of the contest and 
> especially the participants for providing insight into the techniques 
> they have used. I have learned from the contest what lambda expression 
> is good for and how it works  where I failed to grasp it from reading 
> tutorials only.
> 
> I have detected, that it would be a nice thing to have in Python a 
> function able to convert values from binary string to an integer 
> representation as in my eyes both in case of long integer values are 
> more or less the same thing/object. The only difference is probably in 
> the header not in the representation of the actual value in memory - am 
> I right here? Will it make sense to have a string-integer object which 
> value can be used in both contexts as a binary string and a long integer 
> value?
> Is there in Python any simple way to do the same as the following two 
> following functions I have put together today:
> 
> def longIntWithBitsOfBinaryString(stringToConvert):
>   intWithBitsOfBinaryString = 0L
>   for singleChar in stringToConvert:
> intWithBitsOfBinaryString = (intWithBitsOfBinaryString<<8) + 
> ord(singleChar)
>   #:for
>   return intWithBitsOfBinaryString
> #:def longIntWithBitsOfBinaryString(s)
> 
> def binaryStringWithBitsOfLongInt(i):
>   listOfCharsOfStringWithThePackedInt = []
>   exponent = 1
>   while i > 256**exponent: exponent+=1
>   for byteNo in range(0,exponent):
> noOfBitsToShift = byteNo*8
> 
> listOfCharsOfStringWithThePackedInt.append(chr(i>>noOfBitsToShift&0xFF))
>   #:for
>   # reverse (in place) in order to get the highest bits of the integer 
> as leftmost byte
>   listOfCharsOfStringWithThePackedInt.reverse()
>   stringWithThePackedInt = ''.join(listOfCharsOfStringWithThePackedInt)
>   return stringWithThePackedInt
> #:def binaryStringWithBitsOfLongInt(i)
> 
> print "longIntWithBitsOfBinaryString('ABBA') = 
> %i"%longIntWithBitsOfBinaryString('ABBA')
> print 
> "binaryStringWithBitsOfLongInt(longIntWithBitsOfBinaryString('ABBA')) = 
> '%s'"%binaryStringWithBitsOfLongInt(longIntWithBitsOfBinaryString('ABBA'))
> 
> which gives:
> 
> longIntWithBitsOfBinaryString('ABBA') = 1094861377
> binaryStringWithBitsOfLongInt(longIntWithBitsOfBinaryString('ABBA')) = 
> 'ABBA'
> 
> ?
> 
> And now my point I have promised to write about:
> 
> If squeezing code makes it bad code and compressing literals is more or 
> less compression technique and not Python programming, it is maybe a 
> good idea to try to explore what Python distribution provides as data 
> and modules and rewrite the  seven_seg  module, but with following 
> limitations:
> 
> 1. it is not allowed to use any literals in the provided code
> 2. it is not allowed to misuse the names of the identifiers as a kind of 
> literals providing data
> 3. it is not allowed to use modules or files which doesn't come with the 
> Python distribution.
> 
> I have no slightest idea if it is possible to program a  seven_seg 
> module under such conditions. It could be a sign, that it would be a 
> very interesting challenge worth to get involved into or a sign I have 
> no slightest idea about Python and programming.
> 
> What do you all think about it?
> 
> Claudio
After some coding trials, it turned out to be quite easy (almost 
trivial) to overcome the problem of not beeing allowed to use any 
literals in the script code, but I suppose, that I am not alone with not 
seeing directly how to code it, so it is maybe a good exercise for a 
Python beginner (like me) to cope a bit with it.
Knowing this I am curious if it is also co

Re: python coding contest

2005-12-31 Thread Claudio Grondi
> Please send me comments, suggestions and ideas.

Now, after the contest is over I analysed the outcome of it and have 
come to the conclusion, that there were two major factors which 
contributed to squeezing of code:

   (1). usage of available variants for coding of the same thing
   (2). sqeezing the size of used numeric and string literals

As (1) leads to less readable cryptic code it makes not much sense from 
my point of view to dig deeper in that direction. As already mentioned 
in this thread by Tim Peters ( pointing to 
http://spoj.sphere.pl/problems/KAMIL/ ) it seems, that Pearl is here the 
proper language of choice for such kind of problems anyway.

Trying to improve on (2) belongs in my eyes much more into the area of 
problems discussed in comp.compression than to problems belonging into 
comp.lang.python .

So what is my point? Ok, I will mention it at the end of this post.

Before that I want to thank the originators of the contest and 
especially the participants for providing insight into the techniques 
they have used. I have learned from the contest what lambda expression 
is good for and how it works  where I failed to grasp it from reading 
tutorials only.

I have detected, that it would be a nice thing to have in Python a 
function able to convert values from binary string to an integer 
representation as in my eyes both in case of long integer values are 
more or less the same thing/object. The only difference is probably in 
the header not in the representation of the actual value in memory - am 
I right here? Will it make sense to have a string-integer object which 
value can be used in both contexts as a binary string and a long integer 
value?
Is there in Python any simple way to do the same as the following two 
following functions I have put together today:

def longIntWithBitsOfBinaryString(stringToConvert):
   intWithBitsOfBinaryString = 0L
   for singleChar in stringToConvert:
 intWithBitsOfBinaryString = (intWithBitsOfBinaryString<<8) + 
ord(singleChar)
   #:for
   return intWithBitsOfBinaryString
#:def longIntWithBitsOfBinaryString(s)

def binaryStringWithBitsOfLongInt(i):
   listOfCharsOfStringWithThePackedInt = []
   exponent = 1
   while i > 256**exponent: exponent+=1
   for byteNo in range(0,exponent):
 noOfBitsToShift = byteNo*8
 
listOfCharsOfStringWithThePackedInt.append(chr(i>>noOfBitsToShift&0xFF))
   #:for
   # reverse (in place) in order to get the highest bits of the integer 
as leftmost byte
   listOfCharsOfStringWithThePackedInt.reverse()
   stringWithThePackedInt = ''.join(listOfCharsOfStringWithThePackedInt)
   return stringWithThePackedInt
#:def binaryStringWithBitsOfLongInt(i)

print "longIntWithBitsOfBinaryString('ABBA') = 
%i"%longIntWithBitsOfBinaryString('ABBA')
print 
"binaryStringWithBitsOfLongInt(longIntWithBitsOfBinaryString('ABBA')) = 
'%s'"%binaryStringWithBitsOfLongInt(longIntWithBitsOfBinaryString('ABBA'))

which gives:

longIntWithBitsOfBinaryString('ABBA') = 1094861377
binaryStringWithBitsOfLongInt(longIntWithBitsOfBinaryString('ABBA')) = 
'ABBA'

?

And now my point I have promised to write about:

If squeezing code makes it bad code and compressing literals is more or 
less compression technique and not Python programming, it is maybe a 
good idea to try to explore what Python distribution provides as data 
and modules and rewrite the  seven_seg  module, but with following 
limitations:

1. it is not allowed to use any literals in the provided code
2. it is not allowed to misuse the names of the identifiers as a kind of 
literals providing data
3. it is not allowed to use modules or files which doesn't come with the 
Python distribution.

I have no slightest idea if it is possible to program a  seven_seg 
module under such conditions. It could be a sign, that it would be a 
very interesting challenge worth to get involved into or a sign I have 
no slightest idea about Python and programming.

What do you all think about it?

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


Re: python coding contest

2005-12-30 Thread Claudio Grondi
André wrote:
> For the few that might be interested, I will be posting the details of
> a 117 character long solution to the challenge on my blog
> http://aroberge.blogspot.com/.
> 
> Enjoy!
> 
> André
> 
It doesn't work for me as described on that page.
The output is scrumbled. It seems, that the 12 bytes long string ' _ 
|_|_ _| |' is the reason, as the index [11] to it gives '|' not the 
expected '| |'.

There are a total of 24 following 14 bytes strings possible for use in 
coding of indexes to all necessary character triples:

   '   | |_ _ _|_|'
   '   | |_|_ _ _|'
   '   |_ _ _| |_|'
   '   |_ _ _|_| |'
   '   |_| |_ _ _|'
   '   |_|_ _ _| |'
   ' _   | |_ _|_|'
   ' _   | |_|_ _|'
   ' _   |_ _| |_|'
   ' _   |_ _|_| |'
   ' _   |_| |_ _|'
   ' _   |_|_ _| |'
   ' _ _| |_   |_|'
   ' _ _| |_|_   |'
   ' _ _|_   | |_|'
   ' _ _|_   |_| |'
   ' _ _|_| |_   |'
   ' _ _|_|_   | |'
   ' _| |_ _   |_|'
   ' _| |_|_ _   |'
   ' _|_ _   | |_|'
   ' _|_ _   |_| |'
   ' _|_| |_ _   |'
   ' _|_|_ _   | |'

so I tried all which made sense in the context of '0' conversion and 
found out, that it should be the

   ' _   |_|_ _| |'

not the at http://aroberge.blogspot.com/

   ' _ |_|_ _| |'

given one to make the described algorithm work as expected.
Anyway, the code with the two bytes longer string is 117 bytes long, so 
the announcement of a 117 bytes long code keeps what it promises.

Excellent work!

What I wonder about is, how the author arrived at that solution? Trying 
all of the 24 available 14 byte strings to see which one produces the 
coding table which can be used as it was used? Trial-and-error over 
using division, modulo, shifting, masking? What was the path of thought 
to arrive at that? Knowing the solution seems to be of little value if 
not knowing how to arrive at it when a similar problem comes up in the 
future.

Claudio
P.S. By the way: on Windows XP with UltraEdit there was no problem to 
input the special characters. There is an ASCII table and a HEX editor 
mode available for it. Any hints which free editor makes it possible, too?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python coding contest

2005-12-30 Thread Claudio Grondi
[EMAIL PROTECTED] wrote:
> Thomas Heller wrote:
> 
>>X=' _ _ _  |  _| _ |_|_'
>>Y=0x23018F406A3530EC273F008
>>j="".join
>>seven_seg=lambda n:j(j(c)+"\n"for c in zip(*[X[Y>>m+int(d)*9&7::8]for d in n 
>>for m in(6,3,0)]))
> 
> 
> Interesting bit:
> 
> Although there are more 3-char combinations when you read vertically,
> they compact better.
> 
> If A=" ", B="_" and C="|", this 12 char string contains al possible
> combinations:
> 
> BBBABAAACACC
> 
> which is 2 chars shorter than the best for horizontal combinations:
> 
> ABAAACBABCBCAC
> 
> Still, I don't think this vertical idea can go below 123 or 124, but
> it's good :-)
> 
> Now I wonder what the 119 solution is!
> 
I suppose the known 120 solution twisted to work with a one byte shorter 
string as you already found it out providing one example of it above, 
right?  :-)

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


Re: python coding contest

2005-12-29 Thread Claudio Grondi
Simon Hengel wrote:
> Hello,
> we are hosting a python coding contest an we even managed to provide a
> price for the winner...
> 
> http://pycontest.net/
> 
> The contest is coincidentally held during the 22c3 and we will be
> present there.
> 
> https://events.ccc.de/congress/2005/wiki/Python_coding_contest
> 
> Please send me comments, suggestions and ideas.
> 
> Have fun,
> 

It seems, that the site had some trouble to stay online and especially 
to provide the ranking today.

I am a bit dissapointed, that my idea of not duplicating, but utilizing 
the efforts others put into solving the job (titled by the submitter ID 
'TheParasite') which resulted in a submission of a 15 Bytes large full 
functional module was evaluated as having a 'syntax error' problem and 
was placed in the ranking at the position according to the size of the 
331 byte large .zip archive it was put into along with some necessary 
installation instructions.

By the way: trying to submit along with the module complete installation 
instructions and comments failed because there is a 345 bytes limit for 
size of allowed uploads.

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


Re: python coding contest

2005-12-28 Thread Claudio Grondi
Simon Hengel wrote:
> Hello,
> we are hosting a python coding contest an we even managed to provide a
> price for the winner...
> 
> http://pycontest.net/
> 
> The contest is coincidentally held during the 22c3 and we will be
> present there.
> 
> https://events.ccc.de/congress/2005/wiki/Python_coding_contest
> 
> Please send me comments, suggestions and ideas.
> 
> Have fun,
> 

A funny thing happened to me.

   The http://www.pycontest.net/ site was down for some minutes because :

   "A problem occurred in a Python script. "

it seems, that

   'some clever cheat'

has crashed it.

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


Re: python coding contest

2005-12-27 Thread Claudio Grondi
[EMAIL PROTECTED] wrote:
> I now have a version which passes the test suite in 32 bytes  grin>
> 
> -T.
> 
After I have posted the statement, that I have one with 39 bytes, I had 
the 32 version five minutes later, but thougt that instead of posting it 
I can maybe use it as entry on the contest ... Now this hope is over and 
as the 32 bytes are the lowest possible limit I can currently think of 
the dream of winning the contest seems to be over.

Anyone below 32 bytes?

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


Re: python coding contest

2005-12-26 Thread Claudio Grondi
Peter Otten wrote:
> Simon Hengel wrote:
> 
> 
>>>Is it necessary to keep the input parameter as 'input'? Reducing that to
>>>a single character drops the length of a program by at least 8
>>>characters. Technically it changes the interface of the function, so
>>>it's a little bogus, but test.py doesn't check. (Personally I prefer
>>>that if be illegal, but if it's legal I'll have to do it).
>>
>>You may change input to something more short, like x. Everything that
>>passes the test, has a good chance to be accepted.
> 
> 
> How good is "good" for
> 
> import test_vectors
> seven_seg = test_vectors.test_vectors.get
> 
> or code using the test suite in general?
> 
> Peter
> 
This started to remind myself about the story of the contest where the 
shortest program beeing able to output own source was the job to code.
The jury had a big trouble to justify why not give the prize to the one 
who posted an empty file ...

I am currently at 39 bytes following the requirements and the principle 
given above (my module passes the test). Anyone able to beat that?

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


Re: Wingide is a beautiful application

2005-12-22 Thread Claudio Grondi
[EMAIL PROTECTED] wrote:
>>I don't like, that one of the latest UltraEdit releases
>>was buggy causing 100%CPU load and 2MByte of harddisk
>>data traffic beeing idle, so I am looking for an alternative
>>for years, but instead of finding it I was forced lately
>>to spend money again on renewing my license.
> 
> 
> Have you tried the Zeus for Windows programmers editor:
> 
>http://www.zeusedit.com
> 
> Zeus is closed source, but it is also very stable, comes
> with support for Python and you can even write Zeus
> scripts using Python.
> 
> Like all software it also has bugs, but when a bug is
> reported it is fixed ASAP and a free patch is then
> offered for download.
> 
> Jussi Jumppanen
> Author: Zeus for Windows
> 

I was not aware of Zeus, so thank you for telling me about it.

I gave Zeus a try and it passed loading of a large (100 MByte) text file 
(many other text editors fail here). It looks at the first glance quite 
good, but I am a bit lost because of so many different menu items.

Compared to UltraEdit/SPE I am missing the column mode I extensively use 
in my everyday work (rectangular select/copy/paste is there) and the 
autocompletion of any input word as e.g. a very long variable names I 
have defined in preceeding text.

I was not yet able to find how to change the font in the text area and 
how to get rid of the italics used for displaying strings. In UltraEdit 
  I can choose any font in any style available on the system for the 
text area and in the syntax highlighting I can use bold/italics style.
Configuration of colors and keyboard keys seem to be there, macro 
recording/playing, too. The line numbering has a small delay behind the 
displayed text what is a bit annoying (but only when going to the end of 
the 100 MByte file), but sure not a problem. Code folding for Python is 
there, but I run into the problem of not folding the code of a Python 
class.

I have not put much time into the evaluation yet, but my impression is, 
that it is a professional editor, focused on supporting programming and 
compilation of C programs, but probably with not sufficient support for 
Python specifics, except the Python syntax in writing macros, where 
access to the edit window is got with 'import zeus' and the macro itself 
is just Python code using the imported module and working on the opened 
text.

In my eyes with $40 for a license a worth to be evaluated professional 
editor, but not for me because of lack(?) of the column mode and not 
(yet?) found possibility to select a font for the in the editing area 
displayed text.

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


Re: Please enlighten me about PyPy

2005-12-22 Thread Claudio Grondi
Steve Holden wrote:
> Kevin Yuan wrote:
> 
>>
>>
>> 21 Dec 2005 19:33:20 -0800, Luis M. González <[EMAIL PROTECTED] 
>> >:
>>
>> ... ...
>> This implementation requires a minimal core, writen in a restricted
>> subset of python called "rpython". This subset avoids many of the 
>> most
>> dynamic aspects of python, making it easier to authomatically 
>> translate
>> it to C through a tool that uses top-notch type inference techniques.
>>
>>
>> Why not directly write the minimal core in C?
>>
>>
> Because then you'd have to maintain it in C. This way, once you have the 
> first working translator you can translate it into C to improve its 
> performance, and use it to translate the *next* working translator, and 
> so on. Consequently your maintenance work is done on the Python code 
> rather than hand-translated C.
> 
> Fairly standard bootstrapping technique, though it's sometimes difficult 
> to appreciate the problems involved in writing a compiler for language X 
> in X itself. Typical is the fact that the compiler for version m has to 
> be written in version (m-1), for example :-)
> 
> used-to-do-that-stuff-for-a-living-ly y'rs  - steve

I am glad someone asked the question about PyPy, because I need same 
enlightenment. Reading what has been written up to now I would like to 
present here my current understanding to get eventually corrected when 
got something the wrong way.

Do I understand it right, that :

Translating Python code to C for compilation is the way to avoid the 
necessity to write a Python compiler as a hand-coded Assembler code for 
each platform (i.e. Operating System / Processor combination)?

This hand-coding is already done by the people providing a C-compiler 
for a platform and it can be assumed, that a C-compiler is always 
available, so why dig that deep, when in practice it could be sufficient 
to begin at the abstraction level of a C-compiler and not hand-coded 
Assembler?

Sticking to ANSI C/C++ will make it possible to become multi platform 
without the necessity of writing own pieces of hand-coded Assembler for 
each platform what is usually already done by others providing that 
platform and the C compiler for it.

So to use PyPy for creating a Python based Operating System where e.g. 
IDLE replaces the usual command line interface and Tkinter becomes the 
core of the GUI, it will be sufficient to replace the step of 
translation to C code and compilation using a C compiler by an in 
Assembler hand-coded Python compiler for each specific platform?

The expectation to become faster than CPython with the PyPy approach I 
understand as a hope, that creating another Python engine architecture 
(i.e. hierarchy of software pieces/modules the entire Python scripting 
engine consist of) can lead to improvements not possible when sticking 
to the given architecture in the current CPython implementation. After 
it has been demonstrated the PyPy can be faster than the current CPython 
implementation it will be sure possible to totally rewrite the CPython 
implementation to achieve same speed by changing the architecture of the 
elementary modules.
Is this maybe what causes confusion in understanding the expectation 
that PyPy can come along with a speed improvement over CPython? The 
fact, that another architecture of elementary modules can lead to speed 
improvement and the fact, that it can sure be also then implemented in 
the CPython approach to achieve the same speed, but would need a total 
rewrite of CPython i.e. duplication of the PyPy effort?

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


Re: Wanted: binary of OpenCV Python extension module for Windows

2005-12-21 Thread Claudio Grondi
Claudio Grondi wrote:
> 
> OpenCV means Intel® Open Source Computer Vision Library. It is a 
> collection of C functions and a few C++ classes that implement some 
> popular Image Processing and Computer Vision algorithms.
> OpenCV library is mainly aimed at real time computer vision.  Some 
> example areas would be Human-Computer Interaction (HCI); Object 
> Identification, Segmentation and Recognition; Face Recognition; Gesture 
> Recognition; Motion Tracking, Ego Motion, Motion Understanding; 
> Structure From Motion (SFM);  and Mobile Robotics:
> 
> Overview:
>   http://www.intel.com/technology/computing/opencv/overview.htm
> Download:
> 
> http://heanet.dl.sourceforge.net/sourceforge/opencvlibrary/chopencv-2.3.0-win.zip
>  
> 
> 
> OpenCV provides a Python wrapper in
>  OpenCV\interfaces\swig\python\
> directory, but I have no idea how to turn it into a Windows binary yet.
> 
> I have downloaded SWIG, but it creates files which are already in the 
> directory, so it was the wrong idea. Probably I have to compile the 
> _cv.cpp as a DLL, but my MS .NET 2003 Visual C++ compiler throws tons of 
> error messages at me when I create an empty project, telling it should 
> create an DLL out of _cv.cpp and then try to compile it.
> 
> It would be so nice to have this Computer Vision Library as extension 
> module in my modules library.
> 
> Any hints how to achieve it?
> 
> Claudio

For your information:

The conclusion from contacting the authors of the Python wrapper for 
OpenCV is, that there is currently only support for Linux, but no for 
the Windows platform available.
The
http://heanet.dl.sourceforge.net/sourceforge/opencvlibrary/chopencv-2.3.0-win.zip
dowload is outdated, so anyone willing to dig into this deeper should 
access the CVS repository for the latest additions and changes.
Anyone interested in this subject and especially in the available 
distutils setup script (fails to build the Python wrapper on Windows 
with .NET 2003) from the CVS is welcome to contact me per email.

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


Re: ANNOUNCE; Try python beta

2005-12-19 Thread Claudio Grondi
Mike Meyer wrote:
> Ok, I've given it the interface I want, and made it less of an
> attractive nuisance.
> 
> http://www.mired.org/home/mwm/try_python/ is now ready for people to
> play with. There's no tutorial information on it yet, that's the next
> thing to do. However, I won't be able to work on it for a while, so if
> you want to make suggestions about what that should look like, all
> such suggestions will be given proper consideration.
> 
> >> 1+1
SyntaxError: unexpected EOF while parsing (line 1)

It does work for me in FireFox and Netscape:
 >>> 1+1
2

but in Opera I get:
 >>> 1+1
祓瑮硡牅潲㩲甠敮灸捥整⁤佅⁆桷汩⁥慰獲湩⁧氨湩⁥⤱>>>


I am most curious about the last one with no idea how it comes?

Maybe the subject of your posting should be changed to:

Try my skills in processing form requests from different Internet browser?

Claudio

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

Re: How can I load python script into Html ??

2005-12-19 Thread Claudio Grondi
PatPoul wrote:
> Yes I register Python script.
> I see in your exemple that you use file extention pys.
> That was why my exemple does'nt work.
> 
> Thanks !
> 
> Patrick Poulin
> 

In this context I have a question:

How can the registering of the Python scripting engine be easily and 
completely removed? (i.e. how can I get rid of it when already registered?)

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


Re: Wingide is a beautiful application

2005-12-19 Thread Claudio Grondi
BartlebyScrivener wrote:
> Go to Options. Near the bottom, it will say "Edit Init.File"  Click on
> it.
Done. A completely new file was created.
> 
> Make an entry on a separate line near the top as follows
> 
> (require 'python-mode)
> 
> Then save the init file.
Have copy/pasted to it including braces

(require 'python-mode)

No effect on reopening emacs, except:
"
(1) (initialization/error) An error has occurred while loading 
c:\Dokumente und Einstellungen\Admin\.xemacs\init.el:

Cannot open load file: python-mode

To ensure normal operation, you should investigate the cause of the 
error in your initialization file and remove it.  Use the `-debug-init' 
option to XEmacs to view a complete error backtrace.
"



To summarize my evaluation of XEmacs here:
   - nothing valuable for Python script development out of the box or 
easy achievable in its Windows version.

XEmacs is out from beeing considered an option for someone looking for 
an editor helping him doing his Python scripting.



My final conclusions (I am tired now of evaluating):

The only worth to consider freeware option to Wingide on Windows seems 
to be SPE (or other Scintilla based free editors with the disadvantage 
of not having specific support for Python scripting).

The best not free overall text editing tool on Windows is UltraEdit, but 
for someone interested in an editor for the limited purpose of editing 
Python scripts Wingide in its Personal Version is probably actual a much 
better choice (and multiplatform).

As closing words I would like to encourage anyone to start using
SPE ( http://pythonide.stani.be )
and contribute to its development making it beside IDLE a further 
standard editor for Python scripting having the potential to become one 
day a serious competitor to Wing. Why? Just because I decided to start 
using it and am eager to see it improving.

Claudio

> 
> When you open files with a .py extension xemacs should automatically go
> into "python mode"
> 
> If you read the init.el file it will teach you a little about how to
> configure it. If you don't care about that and only want a python
> editor, then just add the line above.
> 
> rpd
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wingide is a beautiful application

2005-12-19 Thread Claudio Grondi
BartlebyScrivener wrote:
> If you're on Windows XP why not try Xemacs? That's free and does syntax
> highlighting etc. Doesn't have a problem with large files and so on.
> 
> rpd
> 
Installed:
http://ftp.dk.xemacs.org/pub/emacs/xemacs/binaries/win32/InnoSetup/XEmacs%20Setup%2021.4.18-1.exe

Requesting help file I have got a plain text window with following text:

Copyright (c) 1985, 1996 Free Software Foundation, Inc. See end for 
conditions.

You are looking at the Emacs tutorial.

Emacs commands generally involve the CONTROL key (sometimes labelled
CTRL or CTL) or the META key.  On some keyboards, the META key is
labelled ALT or EDIT or something else (for example, on Sun keyboards,
the diamond key to the left of the spacebar is META).  If you have no
META key, you can use ESC instead.  Rather than write out META or
CONTROL each time we want you to prefix a character, we'll use the
following abbreviations:

  C-  means hold the CONTROL key while typing the character 
  Thus, C-f would be: hold the CONTROL key and type f.
  M-  means hold the META key down while typing .  If there
  is no META key, type , release it, then type the
  character .

Important note: to end the Emacs session, type C-x C-c.  (Two characters.)
The characters ">>" at the left margin indicate directions for you to
try using a command.

...

Out of the box after installation of
http://ftp.dk.xemacs.org/pub/emacs/xemacs/binaries/win32/InnoSetup/XEmacs%20Setup%2021.4.18-1.exe
gives me an editor window, but
- no syntax highlighting for edited Python file (no idea how to get it)
- no line numbering (a menu item is there, but clicking on it doesn't 
change anything)
- no ruler (a menu item is there, but clicking has no effect)
- [CTRL]+MouseSelection results in some editing action I don't 
understand ...

I know emacx from the ancient time of computer technology, but I have 
never made to learn how to control it.
By the way: I was a keyboard fan years ago, but now I would be glad to 
have some basic typing capability on my mouse, because most of the time 
I am moving the mouse, not typing much text on a keyboard even editing 
scripts.

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


Re: Wingide is a beautiful application

2005-12-18 Thread Claudio Grondi
Sybren Stuvel wrote:
> Claudio Grondi enlightened us with:
> 
>>With [Strg]-[End] I went to the end of the file where I wanted to
>>continue editing, but the syntax highlighting told me there is no
>>code but only a comment. I checked it and found out, that Vim is
>>apparently not able to do proper highlighting when jumping to the
>>end of the file not going through other parts of the code before.
> 
> 
> Vim does check parts of the buffer it hasn't displayed, but it only
> goes back so much. Or would you rather have Vim check the entire
> buffer every time you change it?
> 
> 
>>Going back to the point where triple quotes comment begun (quite in
>>the middle of the file) and back to the end did the trick to get
>>proper highlighting again.
> 
> 
> Apparently you quoted so much that Vim didn't go all the way back to
> check.
> 
> 
>>Apparently Vim syntax highlighting analyses only the code it has
>>already 'seen' within the editing window. This is not what I expect
>>from a mature editor.
> 
> 
> Well, the problem is in your head, not with the editor. It uses sane
> defaults to keep things fast. If you quote such a large amount of
> text, wouldn't it be better to just store it in a text file? You could
> also use the fact that Python joins consecutive string constants and
> quote each paragraph:
> 
> """Some text.
> blablabla
> """
> """
> Some more text blabla
> """
> 
> It'll result in some more quotes, but when running your program it's
> the same, and VIM will be able to highlight it just fine.
The file I was editing was just 22 KByte large having 450 lines, so you 
try here to explain to me, that for speed reasons Vim has to cut it into 
pieces? Stani SPE based on Scintilla does it right, UltraEdit does it 
right, Wing does it right, so what, are we now on a 1 MHz computer with 
128 KByte of memory for all the system and program files what would make 
such approach necessary?
I want my file highlighted in a right way all the time and if it is too 
large to be highlighted I want the editor to give a warning - yes, the 
problem in my head is, that I don't accept bad and buggy software. I 
have edited enough files with the line oriented vi to know what I am 
speaking about.

> 
> 
>>I have stopped here, because I found this problem after three
>>seconds of using it, so imagine how much other problems will become
>>apparent after using it three hours, right?
> 
> 
> Wrong. I have used Vim for years, and only found a few minor issues,
> nothing more.
Let us know about them, so that we know it too.

> 
> 
>>Vim similar as Wing has no [View] menu entry one can use for
>>changing the text appearance in any reasonable Windows program, so
>>the ancient Unix/Linux is still there with the system font as
>>default setting for displaying text... It looks as I were in a DOS
>>box, not in a text editor on Windows.
> 
> 
> I can do "Edit -> Select font" just fine...
> 
> 
>>Loading a 100 MByte large file into this editor which pretends to be
>>able to edit files of any size results in an Error.
> 
> 
> Never had problems with that.
But this is what I have experienced. Are you on a *nix system?
I speak here about Microsoft Windows XP SP 2 on a 3GByte RAM equipped 
Pentium 4 and Cream-Vim installed by
http://heanet.dl.sourceforge.net/sourceforge/cream/cream-0-33-1-gvim-6-3-90-1.exe
 
.
>>I was not able to find how to do rectangular select/paste
> 
> Control+V to do block selects. After that, just paste.
> 
>>and there was no code folding for Python script code available.
> 
> Yes there is - I'm using it.
But is does not work out of the box for me with the download I have 
mentioned and I was not able to fix it as I tried.
> 
> 
>>It was just waste of my time to try it out again.
> 
> This is true for most things in life: If you go in with a negative
> attitude and draw the wrong conclusions, you will only find what you
> expected to find.
> 
> Sybren
Yes, I see your point, but with the increasing speed of the hardware and 
better software quality it is now possible to choose tools which are 
easy to use and don't have a steep learning curve. Best, I don't need 
any tutorial at all and can go with it directly. I am used to Microsoft 
Windows way of designing user interfaces, so I expect software running 
on Windows to provide what I am used to.
The times where the user had to adopt to the software are over. Now 
there are all preconditions available making it possible to adopt the 
software to the user.

What other editing tools have you already e

Re: Wingide is a beautiful application

2005-12-18 Thread Claudio Grondi
[EMAIL PROTECTED] wrote:
> Claudio Grondi wrote:
> 
>>The only thing what makes a difference to me is, that Wing 'understands'
>>Python code what results in features not available elsewhere (e.g. go to
>>definition).
> 
> 
> This is something that pretty much any reasonable programming editor
> will get you.  Vim and emacs both do it.
> 
> I get the feeling that a ot of people working with heavy IDEs don't
> realize how capable vim/emacs are, so I'll give a brief rundown of what
> my Vim environment does for me.  (I do Python web development)--if you
> don't like the Vi keybindings, the Cream package is Vim that behaves
> like a regular modeless editor but with all of vim's power (and a nice
> embedded Python interpreter for writing extensions):

I have tried Vim already multiple times in the past and it had always 
problems. But what was in the past must not stay this way forever, so I 
have got the latest download at
 
http://heanet.dl.sourceforge.net/sourceforge/cream/cream-0-33-1-gvim-6-3-90-1.exe

and installed it loading my current Python file.

With [Strg]-[End] I went to the end of the file where I wanted to 
continue editing, but the syntax highlighting told me there is no code 
but only a comment. I checked it and found out, that Vim is apparently 
not able to do proper highlighting when jumping to the end of the file 
not going through other parts of the code before.
Going back to the point where triple quotes comment begun (quite in the 
middle of the file) and back to the end did the trick to get proper 
highlighting again.
Apparently Vim syntax highlighting analyses only the code it has already 
'seen' within the editing window. This is not what I expect from a 
mature editor.
I have stopped here, because I found this problem after three seconds of 
using it, so imagine how much other problems will become apparent after 
using it three hours, right?
Vim similar as Wing has no [View] menu entry one can use for changing 
the text appearance in any reasonable Windows program, so the ancient 
Unix/Linux is still there with the system font as default setting for 
displaying text... It looks as I were in a DOS box, not in a text editor 
on Windows.
Loading a 100 MByte large file into this editor which pretends to be 
able to edit files of any size results in an Error.
I was not able to find how to do rectangular select/paste and there was 
no code folding for Python script code available.

Sorry, also this time still valid: Vim on Windows "no thank's".

I was just waste of my time to try it out again.

Claudio

> 
> 1. Python syntax checking: as I'm typing along, if I input a syntax
> error then the line is immediately highlighted in red.  Useful for
> catching brainos like:
> if a=1:
> (which will highlight in red when I hit enter, point out that I need ==
> instead of =).
> 2. Normal tag-jump stuff: Ctrl-click on a function/method call (or
> class or whatever) will jump to the function/method/class definition
> (Ctrl-T works as well if you don't like clicking).  It keeps a stack of
> visited files so you can drill down through your call stack and then
> pop back up to where you came from.
> 3. Python class browsing stuff: A Class menu shows the parent and child
> classes of the one you're currently in, and all the methods of the
> current class; selecting any of the above jumps to the appropriate file
> and line.
> 4. Interactive documentation stuff: When I type an open-paren, it looks
> to see what the prior keyword is and displays help for it in the status
> line (preferring Python documentation, then docstrings, then comments
> before the function/method/class definition).  Even if there's no
> help/comments, it'll show the arguments that the function takes.  So
> if, say, I type:
> 
> cmp(
> 
> then the status line displays:
> 
> cmp(x, y) Compare the two objects X and Y and return an integer
> according to ...
> 
> If I hit F1 it'll show the full help text.  Often the arguments are
> enough, and I find the status-line display a lot less intrusive than
> many on-the-fly help systems I've seen.
> 
> 5. A client menu selects which client I want to work in (so, say, I get
> a bug report for Client A, I select them from the menu).  The Class
> menu and other functions respect this (if I'm in the generic Company
> class, the Class menu will list Client A's Company subclass before the
> subclasses of other companies; if I jump to the Company definition,
> it'll go to Company A's client-specific version).  It also restarts
> development httpd servers on the current machine running with conf
> files appropriate to that client.
> 6. Full version control integration, including side-by-side diff
> viewi

Re: Wingide is a beautiful application

2005-12-17 Thread Claudio Grondi
vinjvinj wrote:
> I haven't used an IDE in a long time but gave wing ide a try because
> I wanted the same development platform on Linux and Windows.
> 
> I'm currently using Ultraedit and it works fine but needed something
> more portable as I'm moving my main platform over to Ubuntu.
This is also where I intend to go, except going for Wing, which is in my 
eyes currently no alternative to Ultra Edit as an overall text editor on 
Windows ( I am tired of using two or more editors at the same time as I 
do when working with Microsoft Visual C++ and want the features of both 
Ultra Edit and the Visual Studio IDE ).

- Wing does not have a ruler showing the current column
- Wing has a slow graphics output on Windows (also on Linux?)
- Wing GUI needs adaptation to its logic (e.g. there is no view menue 
item). I have to admit, that Ultra Edit GUI is also not good, so both 
need some adaptation efforts from the user.
- Wing does not support column mode (as you already said)
- Wing text editing is based on Scintilla and there are many other 
powerful and free editors built upon Scintilla available.
- Wing does not support HTML editing by providing separate HTML toolbar 
as the last versions of UltraEdit do.

The only thing what makes a difference to me is, that Wing 'understands' 
Python code what results in features not available elsewhere (e.g. go to 
definition). I don't know if UltraEdit in its Studio version does 
similar things - I suppose it does, but I will be surprized if also for 
Python - is there anyone who works with it?

The problem with deciding to use Wing on Linux is, that I am switching 
to Linux because of its Open Source at no cost feature, so I don't 
actually want to spend any money on proprietary software using Linux. 
But because there is no Ultra Edit on Linux it can happen, that I have 
to reconsider my attitude when actually fully on Linux. But this will 
maybe be never the case, as Windows appears to me as a much more 
powerful system and Linux comes in only in order to save money (when it 
is possible to use Python/Linux for running ready developed Python 
applications) on on multiple Windows licenses in case of using more than 
one PC.

Why do you go for Ubuntu, not for Mandriva if you are ready to pay money 
beeing on Linux?

  I first
> tried jedit and was reasonably happy with it but it felt slow and it
> did not have a native look and feel to it. It was really hard on the
> eyes.
> 
> I was impressed! The UI has completely changed since the last time I
> gave it a spin. It's much more useable and beautiful on the eyes. My
> productivity has gone up for sure and would highly recomend it to
> anyone else. not to mention you'll be supporting python as well.
> 
> Things I like about wingide:
> - Ability to double click on the project plan and it hides and you
> double click on it and it becomes visable again.
> - Ability to double click on the debug/python shell plan and it hides
> and you double click on it and it becomes visable again.
> - Auto completion is very powerful and well implemented.
> - Open the file that a function was defined through the context menu
> - Keyboard mapping for vi and emacs
> - Always having a python shell available
> - An integrated debugger.
> - Running in debug mode was significantly faster than any other
> debugger I have used.
> - Auto indent mode is vary useful.
> - The space manager. Notifies you if a file contains spaces and tabs
> and then converts all tabs into spaces.
> - Ability to debug my cherrypy and turbogears application
> 
> Things that could use improvement:
> - The block mode Ability to work with text files in block mode where
> you can highlight any block in the file. Wingide implementation is
> reasonable but not like Ultraedit's or jedit's
As Wing uses Scintilla I don't expect it to support column mode before 
Scintilla does.
What about editing large (100 MByte and more) text files? I have 
uninstalled Wing already, but I suppose, that it will run into problems 
when loading large files what I have experienced longer time ago using 
Scintilla.

Claudio
> 
> Does anyone know what gui toolkit wingide uses? it really is one of the
> best applications I've seen for some time and it's a great way to
> support python.
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Wanted: binary of OpenCV Python extension module for Windows

2005-12-16 Thread Claudio Grondi

OpenCV means Intel® Open Source Computer Vision Library. It is a 
collection of C functions and a few C++ classes that implement some 
popular Image Processing and Computer Vision algorithms.
OpenCV library is mainly aimed at real time computer vision.  Some 
example areas would be Human-Computer Interaction (HCI); Object 
Identification, Segmentation and Recognition; Face Recognition; Gesture 
Recognition; Motion Tracking, Ego Motion, Motion Understanding; 
Structure From Motion (SFM);  and Mobile Robotics:

Overview:
   http://www.intel.com/technology/computing/opencv/overview.htm
Download:
 
http://heanet.dl.sourceforge.net/sourceforge/opencvlibrary/chopencv-2.3.0-win.zip

OpenCV provides a Python wrapper in
  OpenCV\interfaces\swig\python\
directory, but I have no idea how to turn it into a Windows binary yet.

I have downloaded SWIG, but it creates files which are already in the 
directory, so it was the wrong idea. Probably I have to compile the 
_cv.cpp as a DLL, but my MS .NET 2003 Visual C++ compiler throws tons of 
error messages at me when I create an empty project, telling it should 
create an DLL out of _cv.cpp and then try to compile it.

It would be so nice to have this Computer Vision Library as extension 
module in my modules library.

Any hints how to achieve it?

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


Re: I want a Python Puppy !

2005-12-13 Thread Claudio Grondi
Paul Rubin wrote:
> Claudio Grondi <[EMAIL PROTECTED]> writes:
> 
>>Currently Ubuntu is my favorite, because it seems to be at the moment
>>the only Linux distribution supporting already Python 2.4.2 out of the
>>box,
> 
> 
> Are you seriously saying that whatever distro came out most recently
> (and therefore have the latest Python version) gets to be your
> favorite?  You're going to have to change favorites practically every
> week.

> 
> I'm currently using Fedora Core 4 which comes with Python 2.4.1.  I
> won't exactly say FC4 is my favorite, but it's what I'm used to.  I've
> also been wanting to check out Ubuntu and Gentoo, but slight
> coincidences of the release schedule shouldn't be that big a deal in
> choosing between them.

I have currently no evidence at hand to present here, but I mean, that 
which Python version is distributed is not necessary depending on the 
release date of the Linux distribution.

Yes, I am seriously saying, that at the moment, the Linux distro which 
gives me Python 2.4.2 and compatibility with my current machine out of 
the box is what I will start with. Beeing a Linux greenhorn this is a 
very practical way to keep the decision process as short as possible. 
There are in my eyes some more reasons speaking for Ubuntu, but they are 
currently secondary and therefore not worth to mention.

Gentoo and Ubuntu address very different needs, so it should be quite 
easy to choose between them - as I understand it currently it is that 
way: if you are a Linux expert and want to tune your Linux distribution 
easily to own needs and machine go for Gentoo, if you like the idea of 
"Linux for Human Beings" and are ready to get involved go for Ubuntu.

I personally would be very happy to start with a Python Puppy Linux, 
because I love the idea to have all the applications I need available 
directly in RAM, but is seems that there is no distro which gives this 
out of the box to me and there is no support from Python experts for it 
as I conclude from (missing any really useful) postings to this thread 
up to now (except my own replies ;-).

Probably best would be to wait until PyPy or similar efforts result in a 
  Python Operating System with Tk GUI for Desktop and Idle as console, 
so that there will be no need to decide which OS to choose, but I don't 
like to wait that long.

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


Re: I want a Python Puppy !

2005-12-13 Thread Claudio Grondi
Magnus Lycka wrote:
> Claudio Grondi wrote:
> 
>> I have just discovered the existance of Puppy Linux which is a 
>> complete operating  system with a suite of GUI apps,  only about 50 - 
>> 60M booting directly off the CDROM ( http://www.puppylinux.org ).
>>
>> This approach appears to me very Pythonic, so it were a nice thing to 
>> have a full featured Puppy Linux Live CD prepared for Python programming.
>>
>> Have someone already breed a Python Puppy and is so kind to share a 
>> copy of it with me?
> 
> 
> I think the Ubuntu Live CD has a lot of Python thingies, but it's
> much bigger than 50-60MB. That hardly matters if you intend to use
> a CD, but it might not fit on a cheap USB memory...

Ubuntu Live CD comes directly with Python 2.4.2. Ubuntu was able to use 
  mainboards (ASUS P4P800-SE) onboard sound out of the box and to write 
files to USB stick. I have some trouble to understand how Python works 
on it because it is not organized as on Windows (e.g. there is no [Lib] 
directory under the [Python2.4] one) and I failed to start Idle (can't 
access idlelib) after a longer time of searching for a  file to start 
it. At least the Python command line runs when I type  \>python  in the 
console window and some of the Tkinter examples run too.
Compared to Suse installation DVD full packed with data, Ubuntu Linux is 
limited to a CD - I don't have enough experience to tell if it good or 
bad, but it seems, that Ubuntu supports less software packages then 
Suse. Does it matter, when one has the option to install software by 
compiling source code distributions?

Currently Ubuntu is my favorite, because it seems to be at the moment 
the only Linux distribution supporting already Python 2.4.2 out of the 
box, so maybe it is worth to dig deeper into it for the purpose of 
installing it on a harddrive. Anyone here who uses Ubuntu for developing 
larger Python projects?

Inbetween I was also told 
(http://www.murga.org/~puppy/viewtopic.php?t=4612), that Python for 
Puppy Linux "is available in the grafpup package repositories (try 
googling grafpup). Install it as an alien package using pupget.", so 
there seems to be Python 2.4.2 
(ftp://grafpup.com/packages/python-2.4r2.tar.gz) support in Puppy Linux.

But that is not what I was looking for - it can only serve as a starting 
point for building a Python Puppy Live CD/DVD distribution myself. 
Probably I have much to try and learn before I can start on it and 
succeed, so "I want a Python Puppy" is still open for beeing provided.

My vision is to have a Python Puppy DVD, i.e. 4 GByte of files with the 
entire Python environment and another software tools I could use on 
almost any PC to continue work on Python projects stored on an USB 
stick. This would make my programming environment mobile without the 
need of carrying a notebook/laptop with me (a DVD and a USB stick should 
be enough to be mobile in the todays world, where it is so easy to get 
access to a PC).

I can only hardly believe, that there is none Puppy Linux derived 
Python distribution with most of the important extension modules already 
available out of the box completed to a nice package with Gimp, 
Firefox/Thunderbird, Open Office, etc., so please let me know about it 
helping this way to avoid reinventing the wheel.

I am surprized, that the Puppy kind of Linux distribution seems not to 
be popular among the users of comp.lang.python, so maybe someone can 
explain to me why it is that way to calm down my fascination before I 
put too much efforts into it in order to discover, that it is maybe a 
dead end.

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


Re: I want a Python Puppy !

2005-12-12 Thread Claudio Grondi
Paul Boddie wrote:
> Claudio Grondi wrote:
> 
>>I have just discovered the existance of Puppy Linux which is a complete
>>operating  system with a suite of GUI apps,  only about 50 - 60M booting
>>directly off the CDROM ( http://www.puppylinux.org ).
> 
> 
> This isn't really Python-related, but I thought that Puppy Linux would
> be even more interesting if it could use CD-RW media wisely (so that
> you don't fill up a CD-R disc and then have to burn the image and the
> latest contents onto another one, but can instead create new sessions
> and then choose to erase and rewrite them later) or even CD-MRW (so
> that you can write back to the disc as if it were a normal drive).
> Perhaps someone has delivered one or the other of these things since I
> last checked.
> 
> Paul
I know, that the latest Puppy Linux can save done settings to the CD-RW 
using multisessions (but it didn't work with my DVD drive as I tried it, 
maybe LG is a not a very common one, so it is not supported), but sure 
it would be better if it could utilize InCD format or DVD RAMs (I 
haven't tried it that way yet - at least I haven't read yet, that it 
supports such kind of things). Check out http://puptrix.org for derived 
packages (as GrafPup) if you are interested in latest achievements.
Puppy Linux should be also able to install new packages and it seems, 
that GrafPup download site provides Python 2.4.2
( ftp://grafpup.com/packages/python-2.4r2.tar.gz ) for its version of 
Puppy Linux.

As a Linux newbie I am not eager to try it all myself from the very 
beginning. I tried already Gentoo Linux (too difficult to setup for a 
beginner), Suse Linux (Python 2.4.1 but on a Live CD without Tkinter), 
Knoppix (Python 2.3 with Tkinter, but failed to access my USB port), 
Pollix (failed to start at all). In the past I have evaluated Mandrake 
(now Mandriva) which compared to Suse and Debian was my favorite Linux 
distro, but I don't like the fact they went more commercial, so I have 
left it currently out from consideration. On the list of Linux distros 
still to check out is Ubuntu.
Puppy Linux is much faster than any other Linux distro, because of 
holding of all of the available packages in RAM what makes it very 
interesting for me (having 3 GByte of RAM on my system).

 From this experience I am fascinated by Puppy Linux as an OS in a 
similar way as I was evaluating Python as a programming language, so I 
have got the feeling they belong somehow together.

I am in the process of migrating my Python related programming 
activities from Windows to Linux, so what I want from a Linux 
distribution is, that I can use Python 2.4.2 with all its sattelite 
modules on it as I do it now on Windows making Python a kind of 
interface to the OS. This way I can start to work on Linux knowing 
nothing (or at least not much) about Linux itself using it only for 
Python scripting (and then learn step by step the Linux specifics if 
necessary - I have already some very old and very basic Unix skills for 
the beginning as e.g. knowing about ls -l and the necessity of mounting 
of drives).
Currently it seems, that the answer is a full installation of Suse 
Linux, but I would be much happier with Puppy Linux if it would provide 
a Python scripting development environment out of the box.

I can imagine, that a release of an as .iso file downloadable Puppy 
Python Linux Live CD along with a Python release can be a very 
interesting option from a point of view of providing an easy way for 
evaluating the power of Python scripting language.

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


Re: I want a Python Puppy !

2005-12-12 Thread Claudio Grondi
Diez B. Roggisch wrote:
> Claudio Grondi schrieb:
> 
>> I have just discovered the existance of Puppy Linux which is a 
>> complete operating  system with a suite of GUI apps,  only about 50 - 
>> 60M booting directly off the CDROM ( http://www.puppylinux.org ).
>>
>> This approach appears to me very Pythonic, so it were a nice thing to 
>> have a full featured Puppy Linux Live CD prepared for Python programming.
>>
>> Have someone already breed a Python Puppy and is so kind to share a 
>> copy of it with me?
> 
> 
> AFAIK Knoppix comes with python. And lots of other stuff.
> 
> Diez
Knoppix failed to access my USB ports and it comes with Python 2.3 and I 
am using already Python 2.4.2 .

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


I want a Python Puppy !

2005-12-12 Thread Claudio Grondi
I have just discovered the existance of Puppy Linux which is a complete 
operating  system with a suite of GUI apps,  only about 50 - 60M booting 
directly off the CDROM ( http://www.puppylinux.org ).

This approach appears to me very Pythonic, so it were a nice thing to 
have a full featured Puppy Linux Live CD prepared for Python programming.

Have someone already breed a Python Puppy and is so kind to share a copy 
of it with me?

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


Re: PythonMagick on Windows

2005-12-05 Thread Claudio Grondi
Adam Endicott wrote:
> Claudio Grondi wrote:
> 
>>Why is PIL *(Python Image Library) not suitable to do the graphics?
>>
>>http://www.pythonware.com/products/pil/
>>
>>Claudio
> 
> 
> I am using PIL for some other things, but what I need ImageMagick for
> is to convert a PDF into a series of jpegs (one per page). Its the only
> tool I've found to do this at a good enough resolution.
> 

What about GraphicsMagick. The package seems to be not very easy to use
even if a COM ActiveX object is available for Windows and there is an
executable with command line interface, but the documentation is poor.
Originally derived from ImageMagick 5.5.2 it is available at:
   http://www.graphicsmagick.org/

I would be glad to hear how to do convert a PDF into a series of jpegs
if it will become possible using it.

PythonMagick interface to ImageMagick seems to be no more supported and
if I remember it right, there was shortly a thread about it not really
helping to work with it on Python 2.4.2 - that is how I came to know
about GraphicsMagick.

Hope GraphicsMagick can what ImageMagick could, so this hint turns out 
useful.

Claudio

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


Re: PythonMagick on Windows

2005-12-05 Thread Claudio Grondi
Adam Endicott wrote:
> Does anyone know anything about PythonMagick? I've got a project that
> could use ImageMagick, so I went looking around for PythonMagick, and
> I'm a bit lost.
> 
> I was able to download the PythonMagick source from the ImageMagick
> site, but I'm on Windows and don't have the ability to compile it. I
> found reference to a windows installer for PythonMagick on the wxPython
> wiki, but the links take me to procoders.net, which seems to have
> abandoned the project (at least I couldn't find anything to download).
> 
> So what's the state of this project?
> 
> Actually, I'm wondering if I would gain anything by using PythonMagick
> anyway. I'm going to be distributing a py2exe created executable that
> needs to do some image manipulation. Would I still need ImageMagick
> seperately installed on the client machine to use PythonMagick anyway?
> Or could it all be self contained? If I'd need to install ImageMagick
> on client machines anyway, I guess I can just use the commandline
> interface to ImageMagick from Python.
> 
> Thoughts/suggestions?
> 
Why is PIL *(Python Image Library) not suitable to do the graphics?

http://www.pythonware.com/products/pil/

Claudio

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


Re: Compiling Guppy-PE extension modules

2005-12-02 Thread Claudio Grondi

"Sverker Nilsson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> "Claudio Grondi" <[EMAIL PROTECTED]> wrote:
>
> > but the problem with sets.c remains:
> >
> > C:\VisualC++NET2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /G7 /GX
> > /DNDEBUG -IE:\Python24\include -IE:\Python24\PC /Tcsrc/sets/sets.c
> > /Fobuild\temp.win32-2.4\Re
> > lease\src/sets/sets.obj
> > sets.c
> > src\sets\sets.c(68) : error C2099: initializer is not a constant
> > src\sets\sets.c(68) : warning C4047: 'initializing' : 'PyTypeObject *'
> > differs in levels of indirection from 'NyHeapDef_SizeGetter'
> > src\sets\sets.c(69) : error C2099: initializer is not a constant
> > src\sets\sets.c(69) : warning C4028: formal parameter 1 different from
> > declaration
> > src\sets\sets.c(70) : error C2099: initializer is not a constant
> > src\sets\sets.c(70) : warning C4047: 'initializing' : 'PyTypeObject *'
> > differs in levels of indirection from 'int (__cdecl *)(PyObject *)'
> > src\sets\sets.c(70) : warning C4028: formal parameter 1 different from
> > declaration
> > src\sets\sets.c(70) : warning C4028: formal parameter 1 different from
> > declaration
> > error: command 'E:\VisualC++NET2003\Vc7\bin\cl.exe' failed with exit
status
> > 2
> >
> > The MSDN help gives a simple example of code raising compiler error
C2099:
> > // C2099.c
> > int j;
> > int *p;
> > j = *p;   // C2099, *p is not a constant
> >
> > The example code shows to me, that there is a good reason  compiler
> > generates an error in that case.
> > j = *p; leads to an assignment of a random (and therefore maybe leading
to a
> > non deterministic crash of the executable during runtime) value to a
> > variable, what can't be intended in a deterministic program.
>
> This is confusing, because the problem of the example code is not that
> *p is not constant but rather that p is undefined aka uninitialized.
>
> Humm..
>
> Compiling the following program:
>
> #include 
> int main(void) {
> int j;
> int *p;
> j = *p;
> printf("%d\n",j); /* Makes sure the optimizer doesnt remove the
> previous code */
> return 0;
> }
>
> with
>
> gcc -O3 -Wall main.c
>
> gives me:
>
> main.c: In function `main':
> main.c:4: warning: `p' might be used uninitialized in this function
>
> (And I get a Segmentation fault from running the executable.)
>
> The -Wall flag enables, umm, as it is saying 'all' warnings
> though perhaps not really all, and this flag + others is used
> by the compilation command generated by distutils when
> building with gcc.
>
> I don't see any warnings when building Guppy.
>
> So there should be no case (as easy to discover) as that in the
> example.
>
> So I am confused.
>
> I was beginning to wonder if we were talking about the same file/code.
> This code is from sets.c lines 66..71
>
> static NyHeapDef nysets_heapdefs[] = {
> {0, &NyMutBitSet_Type, (NyHeapDef_SizeGetter) mutbitset_indisize},
> {0, &NyCplBitSet_Type, 0, cplbitset_traverse},
> {0, &NyNodeSet_Type, nodeset_indisize,  nodeset_traverse,
> nodeset_relate},
> {0}
> };
The code in my sets.c file is lines 67..72:
static NyHeapDef nysets_heapdefs[] = {
{0, &NyMutBitSet_Type, (NyHeapDef_SizeGetter) mutbitset_indisize},
{0, &NyCplBitSet_Type, 0, cplbitset_traverse},
{0, &NyNodeSet_Type, nodeset_indisize,  nodeset_traverse,
nodeset_relate},
{0}
};

Maybe you can explain what this declaration is good for and where the
identifiers are defined, so that I have a chance to fix it myself?
Currently I have no idea where to start and what is wrong with it.
It seems, that the only one not declared identifier is NyHeapDef_SizeGetter,
but this does not help because if I preceede the code with
extern NyHeapDef_SizeGetter
I get:

src\sets\sets.c(68) : warning C4091: 'extern ' : ignored on left of 'int
(__cdecl *)(PyObject *)' when no variable is declared
src\sets\sets.c(78) : error C2099: initializer is not a constant
src\sets\sets.c(78) : warning C4047: 'initializing' : 'PyTypeObject *'
differs in levels of indirection from 'NyHeapDef_SizeGetter'
src\sets\sets.c(79) : error C2099: initializer is not a constant
src\sets\sets.c(79) : warning C4028: formal parameter 1 different from
declaration
src\sets\sets.c(80) : error C2099: initializer is not a constant
src\sets\sets.c(80) : warning C4047: 'initializing' : 'PyTypeObject *'
differs in levels of indirection from 'in

Re: Is there no compression support for large sized strings in Python?

2005-12-02 Thread Claudio Grondi

"Gerald Klix" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Did you consider the mmap library?
> Perhaps it is possible to avoid to hold these big stings in memory.
> BTW: AFAIK it is not possible in 32bit windows for an ordinary programm
> to allocate more than 2 GB. That restriction comes from the jurrasic
> MIPS-Processors, that reserved the upper 2 GB for the OS.
>
> HTH,
> Gerald

>>> objMmap = mmap.mmap(fHdl,os.fstat(fHdl)[6])

Traceback (most recent call last):
  File "", line 1, in -toplevel-
objMmap = mmap.mmap(fHdl,os.fstat(fHdl)[6])
OverflowError: memory mapped size is too large (limited by C int)
>>> os.fstat(fHdl)[6]
4498001104L

Max. allowed value is here 256*256*256*128-1
i.e. 2147483647

'jurrasic' lets greet us also in Python.

The only existing 'workaround' seem to be,
to go for a 64 bit machine with a 64 bit Python version.

No other known way?
Can the Python code not be adjusted, so that C long long is used instead of
C int?

 Claudio


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


Can Python by design handle adress space larger than 2 GByte?

2005-12-01 Thread Claudio Grondi
> the string type uses the ob_size field to hold the string length, and
> ob_size is an integer:
>
> $ more Include/object.h
> ...
> int ob_size; /* Number of items in variable part */

If this is what you mean,

#define PyObject_VAR_HEAD  \
 PyObject_HEAD   \
 int ob_size; /* Number of items in variable part */

and if I understand it the proper way
(i.e. that all Python types are derived from Python objects)
also the unlimited size integers are limited to integers which
fit into 2 GByte memory, right?
And also a list or dictionary are not designed to have
more than 2 Giga of elements, etc.

So the question which still remains open is, can Python by design
handle adress space larger than 2 GByte?

I can't check it out myself beeing on a Windows system which
limits already a single process to this address space.
With lists I hit the memory limit at around:
  python -c "print len(280*1024*1024*[None])"
(where the required memory for this list is larger or
equal around 1.15 GByte - on Windows 2000, Pentium4,
with  3GByte RAM and Python 2.4.2).

Claudio


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


Re: Compiling Guppy-PE extension modules

2005-12-01 Thread Claudio Grondi
> I have made a new version now, 0.1.1 .
> It compiles cleanly with gcc -pedantic .

but the problem with sets.c remains:

C:\VisualC++NET2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /G7 /GX
/DNDEBUG -IE:\Python24\include -IE:\Python24\PC /Tcsrc/sets/sets.c
/Fobuild\temp.win32-2.4\Re
lease\src/sets/sets.obj
sets.c
src\sets\sets.c(68) : error C2099: initializer is not a constant
src\sets\sets.c(68) : warning C4047: 'initializing' : 'PyTypeObject *'
differs in levels of indirection from 'NyHeapDef_SizeGetter'
src\sets\sets.c(69) : error C2099: initializer is not a constant
src\sets\sets.c(69) : warning C4028: formal parameter 1 different from
declaration
src\sets\sets.c(70) : error C2099: initializer is not a constant
src\sets\sets.c(70) : warning C4047: 'initializing' : 'PyTypeObject *'
differs in levels of indirection from 'int (__cdecl *)(PyObject *)'
src\sets\sets.c(70) : warning C4028: formal parameter 1 different from
declaration
src\sets\sets.c(70) : warning C4028: formal parameter 1 different from
declaration
error: command 'E:\VisualC++NET2003\Vc7\bin\cl.exe' failed with exit status
2

The MSDN help gives a simple example of code raising compiler error C2099:
// C2099.c
int j;
int *p;
j = *p;   // C2099, *p is not a constant

The example code shows to me, that there is a good reason  compiler
generates an error in that case.
j = *p; leads to an assignment of a random (and therefore maybe leading to a
non deterministic crash of the executable during runtime) value to a
variable, what can't be intended in a deterministic program.

Hope this helps.

Claudio


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


Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi

"Harald Karner" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > Anyone on a big Linux machine able to do e.g. :
> >   \>python -c "print len('m' * 2500*1024*1024)"
> > or even more without a memory error?
>
> I tried on a Sun with 16GB Ram (Python 2.3.2)
> seems like 2GB is the limit for string size:
>
>  > python -c "print len('m' * 2048*1024*1024)"
> Traceback (most recent call last):
>File "", line 1, in ?
> OverflowError: repeated string is too long
>
>  > python -c "print len('m' * ((2048*1024*1024)-1))"
> 2147483647

In this context I am very curious how many of such
2 GByte strings is it possible to create within a
single Python process?
i.e. at which of the following lines executed
as one script is there a memory error?

dataStringA = 'A'*((2048*1024*1024)-1) #  2 GByte
dataStringB = 'B'*((2048*1024*1024)-1) #  4 GByte
dataStringC = 'C'*((2048*1024*1024)-1) #  6 GByte
dataStringD = 'D'*((2048*1024*1024)-1) #  8 GByte
dataStringE = 'E'*((2048*1024*1024)-1) # 10 GByte
dataStringF = 'F'*((2048*1024*1024)-1) # 12 GByte
dataStringG = 'G'*((2048*1024*1024)-1) # 14 GByte

let 2 GByte for the system on a 16 GByte machine ... ;-)

Claudio


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


Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
I was also able to create a 1GB string on a different system (Linux 2.4.x,
32-bit Dual Intel Xeon, 8GB RAM, python 2.2).
$ python -c 'print len("m" * 1024*1024*1024)'
1073741824
I agree with another poster that you may be hitting Windows limitations
rather
than Python ones, but I am certainly not familiar with the details of
Windows
memory allocation.
Jeff
--

Here my experience with hunting after the memory limit exactly the way Jeff
did it (Windows 2000, Intel Pentium4, 3GB RAM, Python 2.4.2):

\>python -c "print len('m' * 1024*1024*1024)"
1073741824

\>python -c "print len('m' * 1136*1024*1024)"
1191182336

\>python -c "print len('m' * 1236*1024*1024)"
Traceback (most recent call last):
  File "", line 1, in ?
MemoryError

Anyone on a big Linux machine able to do e.g. :
  \>python -c "print len('m' * 2500*1024*1024)"
or even more without a memory error?

I suppose, that on the Dual Intel Xeon, even with 8 GByte RAM the upper
limit for available memory will be not larger than 4 GByte.
Can someone point me to an Intel compatible PC which is able to provide more
than 4 GByte RAM to Python?

Claudio



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


Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi

"Fredrik Lundh" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
>
> > What started as a simple test if it is better to load uncompressed data
> > directly from the harddisk or
> > load compressed data and uncompress it (Windows XP SP 2, Pentium4  3.0
GHz
> > system with 3 GByte RAM)
> > seems to show that none of the in Python available compression libraries
> > really works for large sized
> > (i.e. 500 MByte) strings.
> >
> > Test the provided code and see yourself.
> >
> > At least on my system:
> >  zlib fails to decompress raising a memory error
> >  pylzma fails to decompress running endlessly consuming 99% of CPU time
> >  bz2 fails to compress running endlessly consuming 99% of CPU time
> >
> > The same works with a 10 MByte string without any problem.
> >
> > So what? Is there no compression support for large sized strings in
Python?
>
> you're probably measuring windows' memory managment rather than the com-
> pression libraries themselves (Python delegates all memory allocations
>256 bytes
> to the system).
>
> I suggest using incremental (streaming) processing instead; from what I
can tell,
> all three libraries support that.
>
> 

Have solved the problem with bz2 compression the way Frederic suggested:

fObj = file(r'd:\strSize500MBCompressed.bz2', 'wb')
import bz2
objBZ2Compressor = bz2.BZ2Compressor()
lstCompressBz2 = []
for indx in range(0, len(strSize500MB), 1048576):
  lowerIndx = indx
  upperIndx = indx+1048576
  if(upperIndx > len(strSize500MB)): upperIndx = len(strSize500MB)

lstCompressBz2.append(objBZ2Compressor.compress(strSize500MB[lowerIndx:upper
Indx]))
#:for
lstCompressBz2.append(objBZ2Compressor.flush())
strSize500MBCompressed = ''.join(lstCompressBz2)
fObj.write(strSize500MBCompressed)
fObj.close()

:-)

so I suppose, that the decompression problems can also be solved that way,
but  :

This still doesn't for me answer the question what the core of the problem
was, how to avoid it and what are the memory request limits which should be
considered when working with large strings?
Is it actually so, that on other systems than Windows 2000/XP there is no
problem with the original code I have provided?
Maybe a good reason to go for Linux instead of Windows? Does e.g. Suse or
Mandriva Linux have also a memory limit a single Python process can use?
Please let me know about your experience.

Claudio


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


Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
What started as a simple test if it is better to load uncompressed data
directly from the harddisk or
load compressed data and uncompress it (Windows XP SP 2, Pentium4  3.0 GHz
system with 3 GByte RAM)
seems to show that none of the in Python available compression libraries
really works for large sized
(i.e. 500 MByte) strings.

Test the provided code and see yourself.

At least on my system:
  zlib fails to decompress raising a memory error
  pylzma fails to decompress running endlessly consuming 99% of CPU time
  bz2 fails to compress running endlessly consuming 99% of CPU time

The same works with a 10 MByte string without any problem.

So what? Is there no compression support for large sized strings in Python?
Am I doing something the wrong way here?
Is there any and if yes, what is the theoretical upper limit of string size
which can be processed by each of the compression libraries?

The only limit I know about is 2 GByte for the python.exe process itself,
but this seems not to be the actual problem in this case.
There are also some other strange effects when trying to create large
strings using following code:
m = 'm'*1048576
# str1024MB = 1024*m # fails with memory error, but:
str512MB_01 = 512*m # works ok
# str512MB_02 = 512*m # fails with memory error, but:
str256MB_01 = 256*m # works ok
str256MB_02 = 256*m # works ok
etc. . etc. and so on
down to allocation of each single MB in separate string to push python.exe
to the experienced upper limit
of memory reported by Windows task manager available to python.exe of
2.065.352 KByte.
Is the question why did the str1024MB = 1024*m instruction fail,
when the memory is apparently there and the target size of 1 GByte can be
achieved
out of the scope of this discussion thread, or is this the same problem
causing
the compression libraries to fail? Why is no memory error raised then?

Any hints towards understanding what is going on and why and/or towards a
workaround are welcome.

Claudio


# HDvsArchiveUnpackingSpeed_WriteFiles.py

strSize10MB = '1234567890'*1048576 # 10 MB
strSize500MB = 50*strSize10MB
fObj = file(r'c:\strSize500MB.dat', 'wb')
fObj.write(strSize500MB)
fObj.close()

fObj = file(r'c:\strSize500MBCompressed.zlib', 'wb')
import zlib
strSize500MBCompressed = zlib.compress(strSize500MB)
fObj.write(strSize500MBCompressed)
fObj.close()

fObj = file(r'c:\strSize500MBCompressed.pylzma', 'wb')
import pylzma
strSize500MBCompressed = pylzma.compress(strSize500MB)
fObj.write(strSize500MBCompressed)
fObj.close()

fObj = file(r'c:\strSize500MBCompressed.bz2', 'wb')
import bz2
strSize500MBCompressed = bz2.compress(strSize500MB)
fObj.write(strSize500MBCompressed)
fObj.close()

print
print '  Created files: '
print '%s \n%s \n%s \n%s' %(
   r'c:\strSize500MB.dat'
  ,r'c:\strSize500MBCompressed.zlib'
  ,r'c:\strSize500MBCompressed.pylzma'
  ,r'c:\strSize500MBCompressed.bz2'
)

raw_input(' EXIT with Enter /> ')


# HDvsArchiveUnpackingSpeed_TestSpeed.py
import time

startTime = time.clock()
fObj = file(r'c:\strSize500MB.dat', 'rb')
strSize500MB = fObj.read()
fObj.close()
print
print '  loading uncompressed data from file: %7.3f
seconds'%(time.clock()-startTime,)

startTime = time.clock()
fObj = file(r'c:\strSize500MBCompressed.zlib', 'rb')
strSize500MBCompressed = fObj.read()
fObj.close()
print
print 'loading compressed data from file: %7.3f
seconds'%(time.clock()-startTime,)
import zlib
try:
  startTime = time.clock()
  strSize500MB = zlib.decompress(strSize500MBCompressed)
  print 'decompressing zlib data:   %7.3f
seconds'%(time.clock()-startTime,)
except:
  print 'decompressing zlib data FAILED'


startTime = time.clock()
fObj = file(r'c:\strSize500MBCompressed.pylzma', 'rb')
strSize500MBCompressed = fObj.read()
fObj.close()
print
print 'loading compressed data from file: %7.3f
seconds'%(time.clock()-startTime,)
import pylzma
try:
  startTime = time.clock()
  strSize500MB = pylzma.decompress(strSize500MBCompressed)
  print 'decompressing pylzma data: %7.3f
seconds'%(time.clock()-startTime,)
except:
  print 'decompressing pylzma data FAILED'


startTime = time.clock()
fObj = file(r'c:\strSize500MBCompressed.bz2', 'rb')
strSize500MBCompressed = fObj.read()
fObj.close()
print
print 'loading compressed data from file: %7.3f
seconds'%(time.clock()-startTime,)
import bz2
try:
  startTime = time.clock()
  strSize500MB = bz2.decompress(strSize500MBCompressed)
  print 'decompressing bz2 data:%7.3f
seconds'%(time.clock()-startTime,)
except:
  print 'decompressing bz2 data FAILED'

raw_input(' EXIT with Enter /> ')


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


Re: Compiling Guppy-PE extension modules

2005-11-29 Thread Claudio Grondi

"Sverker Nilsson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I have been informed that Guppy-PE (http://guppy-pe.sourceforge.net)
> has failed to compile its extension modules with a Microsoft .NET 2003
> compiler under Windows 2000.
>
> [To the person who informed me about this in an email per 27 Nov:
> Thanks for your message.
> I couldn't reply to you because your email address bounced my
> mail.]
>
> One of the problems, seems to be string constants in the C source that
> contain newlines. I am using GCC on Linux so, I missed this with the
> standard warning options. Compiling with -pedantic reveals 'a lot' of
> places where this is a problem.
>
> I could fix this but it takes some work and it makes the source code
> less readable so I was wondering ...
>
> Is this a common problem? Or maybe it is just the compiler version
> mentioned that doesn't handle it?
>
> Does someone know of some switch to enable the Microsoft compiler to
> accept strings with newlines?
>
> If so, the setup could perhaps be made to pass this switch to the
> compiler when building under Windows.
>
> Or else,..
>
> somebody knows about a script to convert the files to the format the
> Microsoft compiler wants? I guess the build compilation could then be
> setup to pipe them through this or otherwise convert the files as
> needed.
>
> Otherwise, I guess I'll just have to hand-hack around this problem,
> write a conversion script, or whatever. I will see.
>
> Sorry for any inconvenience so far.
>
> Regards,
>
> Sverker Nilsson
>
> PS. I know it's not ANSI-correct but why do we have to work to make
> our source codes less clear?
>

Thank you for posting to comp.lang.python .

Beside the problem with the multiline strings in sets.c I was getting also:

src\sets\sets.c(70) : error C2099: initializer is not a constant
src\sets\sets.c(71) : error C2099: initializer is not a constant
src\sets\sets.c(71) : warning C4028: formal parameter 1 different from
declaration
src\sets\sets.c(72) : error C2099: initializer is not a constant
src\sets\sets.c(72) : warning C4047: 'initializing' : 'PyTypeObject *'
differs in levels of indirection from 'int (__cdecl *)(PyObject *)'
src\sets\sets.c(72) : warning C4028: formal parameter 1 different from
declaration
error: command 'E:\VisualC++NET2003\Vc7\bin\cl.exe'
failed with exit status 2

Anyone here who succeeded to compile and use this module with
Python 2.4.2 on Windows 2000/XP? Please share your experience.

Claudio




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


Re: Call OCX from python?

2005-11-29 Thread Claudio Grondi

"JustSomeGuy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
>
> "Claudio Grondi" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > "JustSomeGuy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > news:[EMAIL PROTECTED]
> > > Hi I have a commercial OCX that I want to use in
> > > my python application.  How do I call OCXs from
> > > python?
> > > TIA
> >
> > import win32com.client
> > axOCX =
> >
>
win32com.client.Dispatch("RegistryEntryForThisOCXin[VersionIndependentProgID
> > ]section")
> > retVal = axOCX.methodOfThisOCX(param1, param2)
> > value = axOCX.attributeOfThisOCX
> >
> > Claudio
> >
> >
>
> Thank you Claudio...
> Can you explain the RegistryEntryForThisOcxin[VersionIndependentProgID]
> I don't know what I should use here..

An ActiveX component (e.g. an OCX) requires to be registered before it can
be used. Usually this is done when the component is installed. If you know
the file name of the OCX start the registry editor running the command:
regedit ([Start] -> Execute -> regedit). Then search for the file name of
the OCX in the registry. One of the hits should lead you to a registry key
where you find on same hierarchy level the [VersionIndependentProgID] entry.
The name there is what you should use in the win32com.client.Dispatch() as
parameter.
To give an example let's assume you want to use the WSHOM.OCX which is
usually on any Windows system. Looking in the registry for WSHOM.OCX leads
you (probably the second hit) to the key [InProcServer32] in the
{72C24DD5-D70A-438B-8A42-98424B88AFB8} entry. Here you find also the key
[VersionIndependentProgID] with the standard value of WScript.Shell. You
should exactly know the methods and their parameter to be able to use the
OCX, see the code below :

# Raise a Yes/No/Abort dialog box provided by WSHOM.OCX:

import win32com.client
axWshShell = win32com.client.Dispatch("WScript.Shell") # WSHOM.OCX

axWshShell_Popup_Icon_Critical =   16
axWshShell_Popup_Button_AbortRetryIgnore   =2
axWshShell_Popup_NoAutoclose   =0

intRetVal = axWshShell.Popup(
### Raise a message box:
   " The Popup() Text" + "\n" +
   "",
   axWshShell_Popup_NoAutoclose,
   " The Popup() Title:",
   axWshShell_Popup_Icon_Critical + axWshShell_Popup_Button_AbortRetryIgnore
)

axWshShell_Popup_Clicked_Abort =3  # [Abort]  button
axWshShell_Popup_Clicked_Retry =4  # [Retry]  button
axWshShell_Popup_Clicked_Ignore=5  # [Ignore] button

if(intRetVal ==  axWshShell_Popup_Clicked_Abort):
  print 'Abort clicked, return value = %i'%(intRetVal,)

if(intRetVal ==  axWshShell_Popup_Clicked_Retry):
  print 'Retry clicked, return value = %i'%(intRetVal,)

if(intRetVal ==  axWshShell_Popup_Clicked_Ignore):
  print 'Ignore clicked, return value = %i'%(intRetVal,)


To make this example complete, here an excerpt from the registry :

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\InProcServer
32]
@="E:\\WINNT\\system32\\wshom.ocx"
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{72C24DD5-D70A-438B-8A42-98424B88AFB8}\VersionIndep
endentProgID]
@="WScript.Shell"


Claudio
P.S. if you face problems with return values or parameter values, one of
reasons can be, that OCXses work always with Unicode strings and you haven't
taken it into consideration.


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


Re: How to get started in GUI Programming?

2005-11-27 Thread Claudio Grondi

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I am trying to learn GUI programming in Python, but have to confess I
> am finding it difficult.
>
> I am not an experienced programmer - just someone who from time to
> time writes small programs for my use.  Over the years I have moved
> from GWBASIC to QBASIC to Visual Basic, and now trying to move across
> to a Linux platform.  Python seems to be the best compromise between
> the limitations of command line basic programming and the total
> incomprehensibility of C.
>
> Googling around it seems the best GUI is either Tkinter or PyGtk.  I
> found a book which recommended PyGtk, as it had a graphical design
> option,  Glade.  Coming from a VB background I latched onto that and
> bought the book (Beginning Python, Wrox), but it was a disappointment
> (or more accurately a complete waste of money) - there was
> insufficient detail in the text.
>
> I've found the tutorial and reference manual on the PyGtk web site,
> but although I've made some progress, I keep reaching points where I
> have insufficient background to understand them. Currently I'm stuck
> on dialog boxes (the code seems immensely complex for the equivalent of
>   MsgBox("Do you really want to do this ",vbYesNo) and I haven't
> got it to work properly yet) and loading graphical images in anything
> other than their original size, but every new step brings another
> struggle
>
> I've seen reference to a Tkinter book - something like 'Python
> and Tkinter Programming' but it seems to be out of print and
> unavailable.
>
> Can anyone offer any suggestions as to the least painful way forwards?
>

>From what you write I conclude, that it is maybe a very good idea to stay
with Visual Basic and use it to create the appropriate ActiveX components
you need in Python and then register them to use it from Python. This way
you can 'marry' what you have already created in Visual Basic easily with
Python.
>From what I currently know, there is no 100% cross-platform solution for GUI
related tasks, because each platform has own specifics which usually are
very interesting for use in own programming and that kills as a consequence
the cross-platform usage.

# For example a Yes/No/Abort dialog box can be achieved using the WSHOM.OCX
available in Windows as follows:

import win32com.client
axWshShell = win32com.client.Dispatch("WScript.Shell") # WSHOM.OCX

axWshShell_Popup_Icon_Critical =   16
axWshShell_Popup_Button_AbortRetryIgnore   =2
axWshShell_Popup_NoAutoclose   =0

intRetVal = axWshShell.Popup(
### Raise a message box:
   " The Popup() Text" + "\n" +
   "",
   axWshShell_Popup_NoAutoclose,
   " The Popup() Title:",
   axWshShell_Popup_Icon_Critical + axWshShell_Popup_Button_AbortRetryIgnore
)

axWshShell_Popup_Clicked_Abort =3  # [Abort]  button
axWshShell_Popup_Clicked_Retry =4  # [Retry]  button
axWshShell_Popup_Clicked_Ignore=5  # [Ignore] button

if(intRetVal ==  axWshShell_Popup_Clicked_Abort):
  print 'Abort clicked, return value = %i'%(intRetVal,)

if(intRetVal ==  axWshShell_Popup_Clicked_Retry):
  print 'Retry clicked, return value = %i'%(intRetVal,)

if(intRetVal ==  axWshShell_Popup_Clicked_Ignore):
  print 'Ignore clicked, return value = %i'%(intRetVal,)

Hope this is what are you looking for, isn't it?

Claudio


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


Re: Call OCX from python?

2005-11-26 Thread Claudio Grondi
"JustSomeGuy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi I have a commercial OCX that I want to use in
> my python application.  How do I call OCXs from
> python?
> TIA

import win32com.client
axOCX =
win32com.client.Dispatch("RegistryEntryForThisOCXin[VersionIndependentProgID
]section")
retVal = axOCX.methodOfThisOCX(param1, param2)
value = axOCX.attributeOfThisOCX

Claudio


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


Re: Any royal road to Bezier curves...?

2005-11-21 Thread Claudio Grondi
> http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm
> has a Python example implementation of qubic Bezier curves available.

Here my port to Tkinter (doesn't need PIL)

from Tkinter import *
master = Tk()
objTkCanvas = Canvas(master, width=110, height=180)
objTkCanvas.pack()

def midpoint((x1, y1), (x2, y2)):
  return ((x1+x2)/2, (y1+y2)/2)

MAX_LEVEL = 5
def drawCubicBezierCurveToCanvas(P1, P2, P3, P4, level=1):
  # global MAX_LEVEL
  # global objTkCanvas
  if level == MAX_LEVEL:
objTkCanvas.create_line(P1[0],P1[1],P4[0],P4[1], fill='red', width=1.5)
  else:
L1 = P1
L2 = midpoint(P1, P2)
H  = midpoint(P2, P3)
R3 = midpoint(P3, P4)
R4 = P4
L3 = midpoint(L2, H)
R2 = midpoint(R3, H)
L4 = midpoint(L3, R2)
R1 = L4
drawCubicBezierCurveToCanvas(L1, L2, L3, L4, level+1)
drawCubicBezierCurveToCanvas(R1, R2, R3, R4, level+1)
  #:if/else level == MAX_LEVEL
#:def draw_curve(P1, P2, P3, P4, level=1)

objTkCanvas.create_rectangle(10, 10, 100, 100, fill="yellow")
objTkCanvas.create_line( 10, 20, 100,  20, fill="green")
objTkCanvas.create_line( 10, 30, 100,  30, fill="green")
objTkCanvas.create_line( 10, 40, 100,  40, fill="green")
objTkCanvas.create_line( 10, 50, 100,  50, fill="green")
objTkCanvas.create_line( 10, 60, 100,  60, fill="green")
objTkCanvas.create_line( 10, 70, 100,  70, fill="green")
objTkCanvas.create_line( 10, 80, 100,  80, fill="green")
objTkCanvas.create_line( 10, 90, 100,  90, fill="green")
objTkCanvas.create_line( 20, 10,  20, 100, fill="green")
objTkCanvas.create_line( 30, 10,  30, 100, fill="green")
objTkCanvas.create_line( 40, 10,  40, 100, fill="green")
objTkCanvas.create_line( 50, 10,  50, 100, fill="green")
objTkCanvas.create_line( 60, 10,  60, 100, fill="green")
objTkCanvas.create_line( 70, 10,  70, 100, fill="green")
objTkCanvas.create_line( 80, 10,  80, 100, fill="green")
objTkCanvas.create_line( 90, 10,  90, 100, fill="green")

drawCubicBezierCurveToCanvas((10,10),(100,100),(100,10),(100,100))

objTkCanvas.create_text( 10, 130, anchor='sw', text='Bezier curve:',
font='Arial   10')
objTkCanvas.create_text( 10, 140, anchor='sw', text=' P1=( 10, 10)',
font='Courier  8')
objTkCanvas.create_text( 10, 150, anchor='sw', text=' P2=(100,100)',
font='Courier  8')
objTkCanvas.create_text( 10, 160, anchor='sw', text=' P3=(100, 10)',
font='Courier  8')
objTkCanvas.create_text( 10, 170, anchor='sw', text=' P4=(100,100)',
font='Courier  8')

mainloop() # show the Tkinter window with the diagram of the cubic Bezier
curve


> http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm
>
> has a Python example implementation of qubic Bezier curves available.
>
> Claudio
>
> "Warren Francis" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > I'm fairly new to Python (2-3 months) and I'm trying to figure out a
> simple
> > way to implement Bezier curves...  So far I've tried the following:
> >
> > http://runten.tripod.com/NURBS/
> > ...which won't work because the only compiled binaries are for Windows
> 2000,
> > python 2.1.  I'm on Windows XP (for now), using Python 2.4.  I
downloaded
> > the source distribution, but the header files aren't included, so I'm
not
> > sure how to compile it.
> >
> > It appears there's some bezier functionality in the python that comes
> > Blender... but I'm not savvy enough yet to try and extract whatever
makes
> > beziers work there, to make it work in my general-purpose Python
programs.
> >
> > Basically, I'd like to specify a curved path of an object through space.
> 3D
> > space would be wonderful, but I could jimmy-rig something if I could
just
> > get 2D...  Are bezier curves really what I want after all?
> >
> > Any thoughts would be much appreciated.  I've got some ideas I want to
> test,
> > but if I can't find a simple implementation of curves, I'm going to get
so
> > bogged down in trying to do that part, I'll never get to what I'm
excited
> > about. :-P
> >
> > Warren
> >
> >
>
>


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


Re: Any royal road to Bezier curves...?

2005-11-21 Thread Claudio Grondi
http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm

has a Python example implementation of qubic Bezier curves available.

Claudio

"Warren Francis" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I'm fairly new to Python (2-3 months) and I'm trying to figure out a
simple
> way to implement Bezier curves...  So far I've tried the following:
>
> http://runten.tripod.com/NURBS/
> ...which won't work because the only compiled binaries are for Windows
2000,
> python 2.1.  I'm on Windows XP (for now), using Python 2.4.  I downloaded
> the source distribution, but the header files aren't included, so I'm not
> sure how to compile it.
>
> It appears there's some bezier functionality in the python that comes
> Blender... but I'm not savvy enough yet to try and extract whatever makes
> beziers work there, to make it work in my general-purpose Python programs.
>
> Basically, I'd like to specify a curved path of an object through space.
3D
> space would be wonderful, but I could jimmy-rig something if I could just
> get 2D...  Are bezier curves really what I want after all?
>
> Any thoughts would be much appreciated.  I've got some ideas I want to
test,
> but if I can't find a simple implementation of curves, I'm going to get so
> bogged down in trying to do that part, I'll never get to what I'm excited
> about. :-P
>
> Warren
>
>


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


Re: Announce: PythonD 2.4.2 r 1.0 for DJGPP/DOS/Windows

2005-11-18 Thread Claudio Grondi
I have read the announcement and checked out the homepage, but I am still
missing the point.

May someone explain to me, what PythonD is good for?
In my eyes there is sufficient support for networking and OpenGL in Python,
so why another not compatible version?

Claudio

"bdeck" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hello,
>
> We have uploaded binary and source packages of PythonD 2.4.2 release
> 1.0 for DJGPP/MSDOS/Windows to the 'pythond' page at
> http://www.caddit.net. All PythonD users are encouraged to upgrade.
> There have been many enhancements, including:
>
> Smaller & faster executable size.
>
> Long Filename TSR under DOS and NT 4 is now mandatory!
>
> $DJDIR/site_python is now searched as part of the default path
> (provides room for deeper
> packages under MSDOS 8-directory restriction.
>
> Socket module has been upgraded to Watt-32 2.8 without SSL support.
>
> An additional SSL (OpenSSL-based) library is provided separately.
>
> Better/more stable thread support (library recompile under better env)
>
> Limited-method release of the MS-specific 'msvcrt' module provides
> DOS-specific API:
> getch, getche, kbhit, putch, setmode, ungetch
>
> Some Watt-32 specific socket errnos have been corrected from the 2.2
> release.
>
> The DB module has forked into 2 separate modules: bsddb (3.0+) and
> bsddb185.
> The DOS library has been recompiled based on sleepycat 3.17 release for
> both.
> Use of the 'bsddb' module (not 185) is prefered, although DBEnv will
> not work.
>
> Additional goodies (plenty!) have been provided under the
> lib/python2.4/site-packeges
> directory! Google if you don't know what they do. Dat's all folks!
>
>
#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!
#!#!#!#!
> The Python source itself has greatly improved. From Python website:
> We are pleased to announce the release of Python 2.4, final on November
> 30, 2004. This is a final, stable release, and we can recommend that
> Python users upgrade to this version.
>
> Note: there's a security fix for SimpleXMLRPCServer.py - this fix is
> included in 2.4.1
> Python 2.4 is the result of almost 18 month's worth of work on top of
> Python 2.3 and represents another stage in the careful evolution of
> Python. New language features have been kept to a minimum, many bugs
> have been fixed and a variety of improvements have been made.
>
> Notable changes in Python 2.4 include improvements to the importing of
> modules, function decorators, generator expressions, a number of new
> modules (including subprocess, decimal and cookielib) and a host of bug
> fixes and other improvements. See the (subjective) highlights or the
> detailed release notes for more, or consult Andrew Kuchling's What's
> New In Python for a detailed view of some of the new features of Python
> 2.4.
>
>
>
#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!
#!#!#!#!
> PYTHOND is now on IRC! Go to #pythond on irc.freenode.net!
>
> Thanks
>
> Ben
>



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


Re: How to - import code not in current directory

2005-11-17 Thread Claudio Grondi
This question seems to come up in this newsgroup quite often, so looking
through past threads will sure provide more details.

Here from "Re: how to import a module from a arbitraty path?"
  posted to comp.lang.python by Simon Brunning on May 26, 2005 09:20 :

"
> I have a program which is going to dynamicly load components from some
> arbitrary defined paths. How to do that?

You can locate them with os.walk and fnmatch. Then you can temporarily
add the directory to sys.path, and import using __import__().
"

so this should work in your case:

import sys
sys.path.append("C:\some\other\directory")
import bar

Claudio


"py" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I have a python script that I want to test/debug.  It contains a class
> which extends from some other class which is located in some other
> python file in a different directory.
>
> For example:
>
> [script to test]
> c:\python_code\foo.py
>
> [needed python files]
> c:\some\other\directory\bar.py
>
> ...so I want to test/debug foo.py, which needs bar.py.  foo.py imports
> bar.py ...but in order to test out foo (in the python shell) I normally
> copy bar.py into the same directory as foo.py...but this is painful.
> Is there some way that I can have python know about the directory where
> bar.py is located, like a system variable, etc?  If so, how do I set
> that up?
>
> Thanks.
>


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


Re: How to - import code not in current directory

2005-11-17 Thread Claudio Grondi
"py" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > so this should work in your case:
> >
> > import sys
> > sys.path.append("C:\some\other\directory")
> > import bar
>
> ...that will certainly work.  Only issue is that each time I start up
> foo.py in the python shell I have to retype those three lineskind
> of why I was hoping for a environment variable or path setting that i
> could stick in.
>
> This will do for now...
>
See the recent threads
"IDLE question" and
"newbie - How do I import automatically?"
in THIS newsgroup for further help.

Claudio


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


Re: IDLE question

2005-11-17 Thread Claudio Grondi
<[EMAIL PROTECTED]> wrote
> This works!
>
> Thanks Claudio
I am glad, that the time I put into it was not wasted.

> For complete happiness I would also like to know what's hapening.
> Is there anywhere I can read about PyShell.py.

Not that I would know about (except reading the source code).

Maybe this below is the right place to ask further questions (2004 there was
a discussion about IDLE):
  http://mail.python.org/mailman/listinfo/tutor
but I have to admit, I haven't used this forum myself yet.

>From my experience with learning Python I suppose, that it will be not very
easy to fully understand what is going on in IDLE (i.e. in PyShell.py)
because this probably requires full understanding of the Tkinter interface
and some insight into deep Python internals. Perhaps this is the reason why
noone knowledgable in this area has responded here expecting from a response
more trouble than success?

Claudio


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


Re: IDLE question

2005-11-17 Thread Claudio Grondi
Here a correction of the code snippet:

   console.text.mark_gravity("restart", "left")
# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
time.sleep(0.1)
# (Patch-)
console.showprompt()

# restart subprocess debugger

I have no slightest idea why does it make a difference.
What would make much more sense for me is to wait until
  self.tkconsole.executing
is False
but this resulted in an endless loop ...

Claudio

"Claudio Grondi" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > I did as you suggested, however
> >
> > after I make a new File (File/New Window) and save and then run (F5) I
> > get the following alert
> >
> > The Python Shell is already executing a command; please waith until it
> > is finished
> >
> > I also get the error message
> >
> > Traceback (most recent call last):
> >   File "", line 1, in -toplevel-
> > import os; from path import path
> > ImportError: No module named path
> > >>>
> >
> > Bob
> >
> Sure you have to replace "import os; from path import path"
> with " from btools import *", than you avoid the error message
> but not the problem you have got with the message box.
> A "solution" to the problem with the message box may be as follows:
>
> "
> console.showprompt()
> # restart subprocess debugger
>
> # (-Patch)
> # making additional modules available in IDLE directly after
> re-start of it:
> self.runsource("import os; from path import path")
> time.sleep(0.1)
> # (Patch-)
>
> if debug:
> "
> If 0.1 doesn't work on your system, just increase the value, but this will
> delay the response.
> e.g. 0.001 doesn't work for me, but 0.1 does (Intel Pentium 4 running at
2.8
> GHz).
>
> Claudio
>
>


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


Re: IDLE question

2005-11-17 Thread Claudio Grondi

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I did as you suggested, however
>
> after I make a new File (File/New Window) and save and then run (F5) I
> get the following alert
>
> The Python Shell is already executing a command; please waith until it
> is finished
>
> I also get the error message
>
> Traceback (most recent call last):
>   File "", line 1, in -toplevel-
> import os; from path import path
> ImportError: No module named path
> >>>
>
> Bob
>
Sure you have to replace "import os; from path import path"
with " from btools import *", than you avoid the error message
but not the problem you have got with the message box.
A "solution" to the problem with the message box may be as follows:

"
console.showprompt()
# restart subprocess debugger

# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
time.sleep(0.1)
# (Patch-)

if debug:
"
If 0.1 doesn't work on your system, just increase the value, but this will
delay the response.
e.g. 0.001 doesn't work for me, but 0.1 does (Intel Pentium 4 running at 2.8
GHz).

Claudio


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


Re: IDLE question

2005-11-17 Thread Claudio Grondi
now a patch fixing it I have no good feeling about, but it works:

in PyShell.py in
def restart_subprocess(self):

insert in section:
"
console.showprompt()
# restart subprocess debugger

# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
# (Patch-)

if debug:
"
This will provide the modules also after restart.

Hope this will not crash elsewhere because of unexpected effects of
inserting the runsource() method at that point in the code without any other
commands which are maybe necessary to keep IDLE consistent.

So IDLE experts, HELP PLEASE !!!

Claudio

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Okey I tried what you recommended
>
> My C:\Python24\sitecustomize.py looks like this:
>
> # sitecustomize.py
> import os
> from btools import *
>
> When I enter
> C:\Python24>C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r
> C:\Python24\sitecustomize.py
>
> in commad propmt IDLE starts up and automatically imports 'os' and all
> names from my btools folder. So far so good. But when I hit Ctrl+F6 and
> restart Python Shell both 'os' and names from btools are gone!
>
> When I work with IDLE I typically start a new file (File/New Window)
> and when I have written the code I hit (Ctrl+S) to Save and F5 to run.
> This restarts Python Shell and my names from btools are gone. It's no
> solution if I'm forced to go back to command prompt and enter the long
> sequance again.
>
> Bob
>


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


Re: newbie - How do I import automatically?

2005-11-17 Thread Claudio Grondi
The only difference I can see is,

that you are on Python 2.3.4 and I use Python 2.4.2:
"Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32 - IDLE 1.1.2"

So maybe if you upgrade ... this will become obsolete?

Claudio

"Mikael Olofsson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> [EMAIL PROTECTED] wrote:
> > I tried to do it on my computer (win XP). I put an extra line in
> > PyShell.py
> > [snip]
> > # test
> > sys.modules['__main__'].__dict__['os'] = os
> > [snip]
> > Then when I start idle I get
> >
> > IDLE 1.1.1
> >
> >>>>dir()
> >
> > ['__builtins__', '__doc__', '__name__']
> >
> >
> > So I don't see 'os'
> >
> > Do you see 'os' on your computer. If yes, what could be the difference?
>
> Yes, I do. The following is with IDLE 1.0.3 and Python 2.3.4 on WinXP.
>
> Without the line in PyShell.py:
>
>  IDLE 1.0.3   No Subprocess 
>  >>> dir()
>  ['__builtins__', '__doc__', '__file__', '__name__', 'main']
>
> With the line in PyShell.py:
>
>  IDLE 1.0.3   No Subprocess 
>  >>> dir()
>  ['__builtins__', '__doc__', '__file__', '__name__', 'main', 'os']
>  >>> os
>  
>
> I know nothing about the details of how IDLE work. All I know is what I
> have reported here. I was simply inspired by the following remark from
> Claudio Grondi up-thread:
>
>  > edit the first lines of %SystemDrive%\Python24\Lib\idlelib\PyShell.py
>
> I guess that PyShell.py is imported as a module by IDLE at startup.
>
> One thought, though: Du you have more than one Python installed? If so:
> Could it be that you are editing the wrong PyShell.py?
>
> Regards
> /MiO


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


Re: newbie - How do I import automatically?

2005-11-17 Thread Claudio Grondi
"Mikael Olofsson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> [EMAIL PROTECTED] wrote:
> > I tried to put the line
> > from btools import *
> > in several places in PyShell.py
> > but to now avail. It does not work, IDLE does not execute it???
>
> IDLE definitely executes PyShell.py upon startup, since IDLE does not
> even appear on the screen if there is an error in that file. The
> following seems to work for me, in PyShell.py. After importing both sys
> and os,
>
> sys.modules['__main__'].__dict__['os'] = os
>
> Then, if I start IDLE, the module os is directly available.
>
> HTH
> /MiO


I have put
sys.modules['__main__'].__dict__['os'] = os
at the beginning of PyShell.py :
"
#! /usr/bin/env python

import os
import os.path
import sys

sys.modules['__main__'].__dict__['os'] = os
"

and also here:
"
class ModifiedInterpreter(InteractiveInterpreter):

def __init__(self, tkconsole):
self.tkconsole = tkconsole

sys.modules['__main__'].__dict__['os'] = os
locals = sys.modules['__main__'].__dict__
"

but it does not work ... (why ???)

What happens if you remove the line
sys.modules['__main__'].__dict__['os'] = os
from your PyShell.py?
Will  os  be no more available or is it still there?

Claudio



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


Re: IDLE question

2005-11-17 Thread Claudio Grondi

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor
> sitecustomize.py
>
> How do you then customize in IDLE?
>
> (basically I want to execute the statement
>from btools import *
> each time I restart IDLEs Python Shell)
>
Following works for me:

C:\Python24\pythonw.exe E:\Python24\Lib\idlelib\idle.py -r
E:\Python24\sitecustomize.py

or

C:\Python24\pythonw.exe   E:\Python24\Lib\idlelib\idle.py -c "import os;
from path import path"

content of my sitecustomize.py is:
"
import os
from path import path
"

and both ways of invoking IDLE have the same effect (apparently of faking
execution of not shown input line) of making the modules  os  and the class
path  available at start of IDLE.

My question in this context:
  Can the PyShell.py file in C:\Python24\Lib\idlelib directory be edited
somehow to achieve same effect?

Claudio


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


Re: newbie - How do I import automatically?

2005-11-17 Thread Claudio Grondi
Thanks to "Serge Orlov" for the hint:
   "run C:\Python24\Lib\idlelib>idle.py -h"

Following works for me now
if I start IDLE by following console command:

C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -c "import os;from
path import path"

The IDLE console prompt appears in the second line
(so -c "import os;from path import path"
probably fakes execution of an input line)
and os and path modules are available for usage.

To be honest I don't like this solution and the solution with setting any
environment variable.
I would be much more happy to understand how I can modify PyShell.py or
another script file IDLE uses in order to achieve same effect.

Claudio

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> When I start Python Shell I can see that some names or loaded
> automatically, ready for me to use
>
> >>> dir()
> ['__builtins__', '__doc__', '__name__']
>
> I have written some functions in a file called btools.py. I would like
> to import them automatically when I start up Python shell. Today I must
> do it by hand like this
>
> >>> from btools import *
> >>> dir()
> ['__builtins__', '__doc__', '__name__', 'func1', 'func2', 'func3']
> >>>
>
> Is there a way to do this automatically so that I always have 'func1',
> 'func2' and so on available, without me having to do it by hand?
>
> Bob
>



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


Re: newbie - How do I import automatically?

2005-11-16 Thread Claudio Grondi

Probably you have inbetween already found the 'def runsource(' line in the
PyShell.py , but maybe you still wait for a reply, so here it is:

yes, you put the two lines at the beginning of in PyShell.py existing
runsource() method of the class ModifiedInterpreter(InteractiveInterpreter)

If in my Windows IDLE version the things are different from yours, sorry,
I can't help in that case having no Linux installation available.

Claudio

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Where do I put
>
>  def runsource(self, source):
> if(source == ''):
>source = 'from btools import *'
> "Extend base class method: Stuff the source in the line cache
> first"
> filename = self.stuffsource(source)
>
> Do I put it in Pyshell.py or somewhere else?
>
> Bob
>



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


Re: newbie - How do I import automatically?

2005-11-16 Thread Claudio Grondi
<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:<[EMAIL PROTECTED]>...
> I tried to put the line
> from btools import *
> in several places in PyShell.py
> but to now avail. It does not work, IDLE does not execute it???
> Bob

I have to give up here :-( .

The best solution I am able to come up with is:

def runsource(self, source):

if(source == ''):
   source = 'from btools import *'

"Extend base class method: Stuff the source in the line cache first"
filename = self.stuffsource(source)

which performs 'from btools import *' each time you hit return on the
command line without typing anything in the interpreter.

Maybe someone knowledgable in IDLE can share here a better way how to
initialize IDLE with any code valid in the interpreter itself.
Inbetween the above can maybe serve as workaround.

Claudio


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


Re: newbie - How do I import automatically?

2005-11-16 Thread Claudio Grondi
Just edit the first lines of %SystemDrive%\Python24\Lib\idlelib\PyShell.py
yourself (not tested, but I have customized Idle intitial message using it
and
it worked ok - after new Python installation I overwrite this file with my
own
version to keep this customization.)

Hope this helps.

Claudio

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I also checked in command prompt, and there it works!, but not in IDLE.
> And it's in IDLE that I work all the time. Can anything be done to get
> it to work there?
>
> Bob
>


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


Re: SciPy python 2.4 wintel binaries

2005-11-14 Thread Claudio Grondi
Is
http://heanet.dl.sourceforge.net/sourceforge/scipy/scipy-0.4.3.win32-py2.4.exe

not what are you looking for?

Claudio

"jelle" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi Peter,
>
> I'm aware of the Enthought distribution, which really is my preferred
> 2.3 Python distribution.
> Problem is that many programs I'm working on would require both 2.4 &
> SciPy
>
> What kind of puzzles me is that SciPy.core is available for wintel 2.4,
> is that an indication a full SciPy distribution is coming along?
>
> Cheers,
>
> -jelle
>


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


Re: PySizer 0.1

2005-11-13 Thread Claudio Grondi
A small hint about the Web-site:
At least to me, the links to the documentation as e.g.

http://pysizer.8325.org/doc/auto/home/nick/sizer-trunk/doc/auto/scanner.html
are broken (no big thing, because the distro has it anyway).

Claudio

"Nick Smallbone" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I'd like to announce the first release of PySizer, a memory usage
> profiler for Python code.
> PySizer was written as part of Google's Summer of Code.
>
> The source, documentation and so on are at http://pysizer.8325.org.
> The current release is at
> http://pysizer.8325.org/dist/sizer-0.1.tar.gz.
> The code is kept in a Subversion repository at
> http://codespeak.net/svn/user/nick8325/sizer.
>
> The idea is to take a snapshot of memory use at some time, and then
> use the functions of the profiler to find information about it.
>
> Features
> 
> * You can make a snapshot of all reachable objects at a given time,
>   organised as a tree (well, a graph, since there are cycles).
>
> * For any given object, you can find out how much space it takes up,
>   what objects it references and so on.
>
>   With a patched version of Python, you can also find out what stack of
>   function calls created an object, and what objects were created by
>   each stack of calls.
>
> * You can collect objects into groups. For example, you can group each
>   object according to the module it appears to come from. Then you can
>   treat each module as a single object.
>
> * You can filter objects, find the amount of space used by instances of
>   each type, find objects which appeared from one snapshot to the next,
>   find the biggest objects/types/groups, and so on.
>
> Requirements
> 
> See http://pysizer.8325.org/INSTALL.
> The main one is Python 2.4 - I will port it to 2.3 soon.
>
> Bugs, suggestions, comments, problems, anything else
> 
> You can contact me at [EMAIL PROTECTED] I would love to know if
> you find a use for it, too.
>


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


Re: Want to perform unattended installation of SW using python

2005-11-13 Thread Claudio Grondi
Use AutoIt3 for it and be happy:
  http://www.autoitscript.com/autoit3/.
And if you need Python to be involved in this process, just write out the
AutoIt script from Python and then run the AutoIt script from Python, what
makes you twice that happy.
If you want, you can reinvent the wheel using Python ctypes and the
Win32 API, but what for, if AutoIt is already there and has done it
all in an excellent way?

Claudio

"28tommy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi,
>
> first of all- thanks for the quick answer.
> You presumed correctly, but unfortunately, I Don't have control of the
> preparation process of the package, so I get it as is. I just need to
> answer it's questions on each screen of the wizard...
>
> 10x again
> tommy
>


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


Re: PyFLTK - an underrated gem for GUI projects

2005-11-09 Thread Claudio Grondi
> So I hope this humble message might inspire some folks to have a serious
> look at pyfltk. For many situations, PyFLTK can take you to break-even
> point quickly, and deliver net savings in time and effort after that.

Animated by your posting I have downloaded:
  fltk-1.1.6-source.zip  (3.073.432 bytes)
  pyFltk-1.1rc1.tar.gz (306.323 bytes)
.
I use Microsoft Windows 2000 (and/or XP) with installed
MSVC++ .NET 2003 compiler environment and I am running
Python version 2.4.2.

The compilation of FLTK run without problems and after some minor
adjustments I was also able to build and install pyFltk.

Running some of the test examples
(e.g. C:\Python24\pyfltk\test\doublebuffer.py)
I am getting an error I have never seen before:

==
TitleOfMessageBox:
  Microsoft Visual C++ Runtime Library

TheMessage:
  Runtime Error!

  Program: C:\Python24\python.exe

  The application has requested the Runtime to terminate it in an unusual
way.
  Please content the application's support team for more information.
==

Also cube.py (which runs ok as fltk-1.1.6\test\cube.exe i.e. the  genuine
FLTK test app as also the doublebuffer.exe does) crashes in the pyFLTK
version with:

C:\>C:\Python24\pyfltk\test\cube.py
Traceback (most recent call last):
  File "C:\Python24\pyfltk\test\cube.py", line 218, in ?
form.show(len(sys.argv), sys.argv)
  File "C:\Python24\Lib\site-packages\fltk.py", line 2164, in show
def show(*args): return _fltk.Fl_Window_show(*args)
TypeError: Swig director python method error: Error detected when calling
Fl_Group.handle.
 argument number 1: a 'Fl_Group *' is expected, 'MyBox' is received

Most of the other test scripts seem to run ok.

Any hints about the possible reasons of the problems described above are
welcome.

It appears to me, that the
 C:\Python24\Lib\site-packages\_fltk.pyd  and the *.py files
is all what is required to run pyFltk, so there will be no problem for
pyFltk if I delete the genuine FLTK files - am I right?

Claudio
P.S. If someone is interested in getting the _fltk.pyd (the pyFLTK Windows
binary version for Python 2.4), he/she is welcome to let me know about it.


"aum" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi all,
>
> I've been doing a fair bit of python gui programming on and off, jumping
> between different widget sets along the way, from anygui, to pythoncard,
> to tkinter/PMW, then to wxPython/wxGlade, and have now settled on a python
> gui API that seems to get barely a mention - PyFLTK.
>
> PyFLTK (http://pyfltk.sourceforge.net) is a SWIG-generated Python
> wrapper around the multiplatform FLTK widget set ('Fast Light Tool Kit'
> - http://fltk.sourceforge.net). In recent months, this wrapper has
> stabilised to the point where it's fit for production projects.
>
> A recent development that's given PyFLTK even more power is the
> companion utility program, 'flconvert', which takes gui layout files
> (created with the FLTK 'fluid' gui designer program) and turns them into
> importable Python modules that Simply Just Work.
>
> Every widget set has its place, and I feel this applies in no small part
> to PyFLTK.
>
> To me, wxPython is like a 12-cylinder Hummer, with fuzzy dice hanging
> from the mirror, fridge and microwave in the back, and DVD consoles on
> every seat, towing a campervan - absolute power and luxury, giving 8mpg
> if you're lucky.
>
> wxPython has the cost of a massive disk and memory footprint. A 'hello,
> world' turned into a windoze exe with py2exe weighs in at around 15MB,
> and takes 6-10 seconds to load up on a 2GHz Athlon box, about as long as
> Photoshop! For large and intricate apps, wxPython is a logical choice,
> but for smaller progs it's serious overkill IMHO.
>
> Whereas PyFLTK feels more like an average suburban 4-door sedan giving
> 70mpg, nothing too flash, but easy to drive, easy to park and generally
> comfortable, and easy to look after. The widget set is pretty simple,
> but covers all the basics and includes good rich-text features in
> listboxes, as well as an html viewer that supports html2.0 and parts of
> html3.0.
>
> Some of the things I'm liking about PyFLTK include:
>  - way less code to get things done
>  - some nice automagic, for instance in setting up tiling (similar to
>wx's splitter windows)
>  - an absolute minimum of 'voodoo programming' (which was a constant
>bugbear for me with tkinter)
>  - apps compile small, and start up fast
>  - a really good designer program - fltk's 'fluid' program is light
>years ahead of wxglade imho
>
> Also, FLTK's intuitive, semantically clear API makes it really
> approachable for newcomers. One can write a 'hello, world' in 5 lines:
>
>   import fltk
>   label = "something here" # to stop string being gc'ed
>   w = fltk.Fl_Window(100, 100, 300, 200, label)
>   w.show()
>   fltk.Fl.run()
>
> So I hope this humble message mi

Re: How to organize Python files in a (relatively) big project

2005-10-19 Thread Claudio Grondi
Maybe looking at the todays thread  ["dynamical" importing] can be helpful
also here.

Claudio
P.S. Below a copy of one of the responses:
:
Joerg Schuster wrote:

> I need to import modules from user defined paths. I.e. I want to do
> something like:
>
> module_dir = sys.argv[1]
>
> my_path = os.path.join(module_dir, 'bin', 'my_module')
>
> from my_path import my_object
>
> Obviously, it doesn't work this way. How would it work?

some alternatives:

- if you want the modules to remain imported:

try:
sys.path.insert(0, os.path.join(module_dir, "bin"))
module = __import__("my_module")
finally:
del sys.path[0]
object = module.my_object

- if you're only interested in the object:

namespace = {}
execfile(os.path.join(module_dir, "bin", "my_module" + ".py"),
namespace)
object = namespace["my_object"]




"TokiDoki" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hello there,
>
> I have been programming python for a little while, now. But as I am
> beginning to do more complex stuff, I am running into small organization
> problems.
> It is possible that what I want to obtain is not possible, but I would
> like the advice of more experienced python programmers.
>
> I am writing a relatively complex program in python that has now around
> 40 files.
> At first, I had all of my files in one single directory, but now, with
> the increasing number of files, it is becoming hard to browse my
directory.
> So, I would want to be able to divide the files between 8 directory,
> according to their purpose. The problem is that it breaks the 'import's
>between my files. And besides,AFAIK, there is no easy way to import a
> file that is not in a subdirectory of the current file (I suppose I
> could adjust the os.path in every file, but that seems not very elegant
> to me).
> I thought about turning the whole into a package. But I have to change
> every 'import module_name' into
> 'from package_name.sub_directory_name import module_name'
> which is a little bit time consuming and not very flexible (if I change
> my mind about the subdirectory a file belongs to, I will have to track
> again every import to correct them)
>
> So, basically, here is the point: is there an 'elegant' way to keep my
> files in separate directory and still be able to import between them
> with simple 'import filename'?
>
> And if not, what would be the standard way to organize numerous python
> files belonging to the same project?
>
> Thank you,
>
> TokiDoki


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


Re: UI toolkits for Python

2005-10-19 Thread Claudio Grondi
> > Another possible scenario I have in mind is to control the Internet
browser
> > directly from a Python script using DHTML as a language for definition
of
> > appearance and specification of necessary data processing of in the
browser
> > displayed UI. This way the Internet browser and HTML with JavaScript can
be
> > considered an UI toolkit for use in Python.
> > Hope with this above to have got Python back on topic.
> >
> That is, I suppose, a possibility, but you certainly can't claim it
> would be platform-independent.
I haven't seen any really platform-independent software yet and I don't
expect to see any in the future.
It is simply not possible to have one, even if much progress was done lately
in many areas in order to try to approach it as close as possible.

Claudio

"Steve Holden" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > "Steve Holden" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > news:[EMAIL PROTECTED]
> >
> >>Claudio Grondi wrote:
> [...]
> >>>>>Do I miss here something?
> >>>>>
> >>>>
> >>>>While you are correct in saying (I paraphrase) that HTML interfaces
> >>>>nowadays can offer a rich graphical interface, it can be quite
difficult
> >>>>to manage state maintenance between the two components (web server,
web
> >>>>client) in the system.
> >>>
> >>>
> >>>The cause of confusion here is, that HTML interfaces don't necessary
> >
> > need a
> >
> >>>web server and HTTP to work. I mean, that Internet Browsers
> >>>have an API which allow access to them directly, so they can be used
> >
> > without
> >
> >>>a server as a kind of GUI library supporting widgets programmed
> >>>in HTML and JavaScript  (I haven't used them yet in this form, but I
> >
> > think
> >
> >>>it should be no problem - right or not?).
> >>>
> >>
> >>You are perfectly correct that interfaces can be programmed in the
> >>browser. As has already been said, with the adoption of standards like
> >>CSS2, it's even possible to make such stuff run across multiple browser
> >>platforms (at the moment, though, just try writing an interface that
> >>makes table rows appear and disappear in a cross-browser fashion: you'll
> >>find the stylesheet techniques you need to use for Mozilla and IE are
> >>very different). But this doesn't help you at all if you are trying to
> >>interface to Python logic.
> >>
> >>>>A "proper" GUI runs all functionality inside a single process, and
> >>>>allows much easier control over complex interactions, creation of
> >>>>dynamic dialogues, and so on.
> >>>
> >>>Complex and dynamic is in my eyes possible with HTML and JavaScript, so
> >
> > I
> >
> >>>still don't see where is a problem with this approach. I have
programmed
> >>>already a HTML and JavaScript driven server platform and know about
(the
> >>>solvable) problems with the back-button and sessions (it is sure not
the
> >>>easiest way of programming a GUI).
> >>>The only disadvantage of not using plugins or Java is, that real time
> >>>interactions are not possible, but this is in my eyes usually not the
> >>>requirement for a standard kind of GUI with no gaming, no Virtual
> >
> > Reality
> >
> >>>and no timing of user response down to milliseconds (but consider, that
> >
> > with
> >
> >>>a good speed of connection it is even possible to play blitz chess over
> >
> > the
> >
> >>>Internet).
> >>>
> >>
> >>So, back to the subject: with an HTML/Javascript interface, how do you
> >>propose to bolt Python logic into the same process? Or do you admit that
> >>the application that interacts with such an interface either has to be
> >>all JavaScript or in a separate process?
> >
> > I haven't used it in such configuration yet, but I mean, that it is not
a
> > bad idea to use local DHTML files (i.e. HTML with JavaScript) combined
with
> > a Python driven HTTP server like e.g. Karrigell which makes it possible
to
> > access local files by executing Python scripts triggerred by demand
raised
> > by submitting to it DHTML form data resulting from user input.
> > So mixing JavaScript in local DHTML files for performing what

Re: How to organize Python files in a (relatively) big project

2005-10-19 Thread Claudio Grondi
If I understand you right you need a concept in which you can put the files
of your project where you want, i.e. restructure the nesting of directories
storing your scripts without the problem of breaking the import statements.
This will give you not a solution to any problem you maybe have with
managing a large package but is a problem in itself, so I see that you have
a huge number of options to choose from:

1. best is you get a better structure of the project in your mind, so you
don't need frequent changes by resorting your modules into a various
directories (flat is better than nested). Set a size limit of a single
Python script it must reach before you split it into two separate files, so
that the number of your files decreases to a number you can handle with ease
(this depends on how good you are at it).

2. create e.g. an HTML file from which you can view, edit, execute the
scripts you have. In this file you create your nested structure and have
this way the overview you need. The Python files remain in one directory
storing the entire project. This allows you to keep together what belongs
together, but to work with it as the single files were spread over many
categories (I mean directories :).

3. create a Python script which automatically creates an HTML file giving
you the overview of all your scripts from walking the directories your
project files are stored below and put in each of your scripts a function
which on call returns the actual full path of passed name of the file to
import and updates the Python PATH, so that it can be found (e.g
updatePATH('nameOfTheModuleToImport')

4. start to choose from many tools for project management which will keep
you busy for a while and away from the actual work on your project ...

None of these above can solve the supposed actual problem, that the project
grows beyond the capacity to manage it in mind. I know about this limitation
and I have seen programmers failing on projects with increasing size of
them. Usually the dependencies between the single modules in large projects
get more and more complicated. Each next added module making the project
size larger must work with the entire already existing ones and after a
given size of project is reached it becomes really hard (and for some just
impossible) to add a new module to it making the necessary modifications to
existing ones in order to gain the new functionality. Such modifications
result usually in breaks in other parts of the project and in my eyes no
management system can really help in anticipating it at that point. Every
programmer seems to have a limit of a project size he can manage and in my
opinion no tool for structuring it or getting a better overview is of real
help here. The core of the problem is lack of skills required for managing
large projects and it seems, that not everyone who managed to learn to
program is able to acquire this skills necessary to increase the size of a
project over the by his intellectual capacity given limits. That is why
programmer need to work in teams and have a very good manager able to
coordinate their efforts in order to succeed in creating large applications.
In really large projects it is sometimes necessary to work half a year or
more full time on the existing library of code before becoming capable of
writing a single line of additional one.

Publish your code, let others work with it, try to get responses on it and
you will probably get much more out of this than by asking for ways of
managing it.

I am curious if others on this newsgroup agree with what I said above, so I
would be glad to hear about it.

Claudio



"TokiDoki" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hello there,
>
> I have been programming python for a little while, now. But as I am
> beginning to do more complex stuff, I am running into small organization
> problems.
> It is possible that what I want to obtain is not possible, but I would
> like the advice of more experienced python programmers.
>
> I am writing a relatively complex program in python that has now around
> 40 files.
> At first, I had all of my files in one single directory, but now, with
> the increasing number of files, it is becoming hard to browse my
directory.
> So, I would want to be able to divide the files between 8 directory,
> according to their purpose. The problem is that it breaks the 'import's
>between my files. And besides,AFAIK, there is no easy way to import a
> file that is not in a subdirectory of the current file (I suppose I
> could adjust the os.path in every file, but that seems not very elegant
> to me).
> I thought about turning the whole into a package. But I have to change
> every 'import module_name' into
> 'from package_name.sub_directory_name import module_name'
> which is a little bit time consuming and not very flexible (if I change
> my mind about the subdirectory a file belongs to, I will have to track
> again every import to correct them)
>
> So, b

Re: UI toolkits for Python

2005-10-18 Thread Claudio Grondi
"Steve Holden" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > "Steve Holden" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [...]
> [Claudio]
> >>>I don't fully understand your attitude here. The Web Browser interface
> >
> > has
> >
> >>>all I can imagine is required for a GUI, so what is missing when you
> >>>consider, that you can generate custom images on the fly on the server
> >
> > and
> >
> >>>let the user shape the page without requesting CPU power from the
server
> >>>using JavaScript.
> >>
> >>In this case then, I'm afraid the failure is in your imagination :-)
> >
> >
> > Any useful hints towards enlightenment except criticism?
> >
> Perhpas the mistake I made was bearing in mind the title of the thread,
> and the fact that this is a Python newsgroup.
> >
> >>>I don't even name here the not really beeing itegral part of Internet
> >>>Browsers JavaApplets and any other kind of plugin stuff.
> >>>The only issue I can see with this approach is the speed of responding
> >
> > to
> >
> >>>user interactions, but for really optimize this one needs a compiled
> >>>language anyway.
> >>>What is that complex, that it can't be solved using an Internet Browser
> >
> > as a
> >
> >>>GUI?
> >>>Do I miss here something?
> >>>
> >>
> >>While you are correct in saying (I paraphrase) that HTML interfaces
> >>nowadays can offer a rich graphical interface, it can be quite difficult
> >>to manage state maintenance between the two components (web server, web
> >>client) in the system.
> >
> >
> > The cause of confusion here is, that HTML interfaces don't necessary
need a
> > web server and HTTP to work. I mean, that Internet Browsers
> > have an API which allow access to them directly, so they can be used
without
> > a server as a kind of GUI library supporting widgets programmed
> > in HTML and JavaScript  (I haven't used them yet in this form, but I
think
> > it should be no problem - right or not?).
> >
> You are perfectly correct that interfaces can be programmed in the
> browser. As has already been said, with the adoption of standards like
> CSS2, it's even possible to make such stuff run across multiple browser
> platforms (at the moment, though, just try writing an interface that
> makes table rows appear and disappear in a cross-browser fashion: you'll
> find the stylesheet techniques you need to use for Mozilla and IE are
> very different). But this doesn't help you at all if you are trying to
> interface to Python logic.
> >
> >>A "proper" GUI runs all functionality inside a single process, and
> >>allows much easier control over complex interactions, creation of
> >>dynamic dialogues, and so on.
> >
> > Complex and dynamic is in my eyes possible with HTML and JavaScript, so
I
> > still don't see where is a problem with this approach. I have programmed
> > already a HTML and JavaScript driven server platform and know about (the
> > solvable) problems with the back-button and sessions (it is sure not the
> > easiest way of programming a GUI).
> > The only disadvantage of not using plugins or Java is, that real time
> > interactions are not possible, but this is in my eyes usually not the
> > requirement for a standard kind of GUI with no gaming, no Virtual
Reality
> > and no timing of user response down to milliseconds (but consider, that
with
> > a good speed of connection it is even possible to play blitz chess over
the
> > Internet).
> >
> So, back to the subject: with an HTML/Javascript interface, how do you
> propose to bolt Python logic into the same process? Or do you admit that
> the application that interacts with such an interface either has to be
> all JavaScript or in a separate process?
I haven't used it in such configuration yet, but I mean, that it is not a
bad idea to use local DHTML files (i.e. HTML with JavaScript) combined with
a Python driven HTTP server like e.g. Karrigell which makes it possible to
access local files by executing Python scripts triggerred by demand raised
by submitting to it DHTML form data resulting from user input.
So mixing JavaScript in local DHTML files for performing what can be done
with JavaScript inside HTML and a HTTP server capable of executing Python
scripts will do the job which JavaScript alone can't because of lack of
access to the local file system and another parts of the computer system on
which such kind of UI is executed.
Another possible scenario I have in mind is to control the Internet browser
directly from a Python script using DHTML as a language for definition of
appearance and specification of necessary data processing of in the browser
displayed UI. This way the Internet browser and HTML with JavaScript can be
considered an UI toolkit for use in Python.
Hope with this above to have got Python back on topic.

Claudio



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


Re: UI toolkits for Python

2005-10-16 Thread Claudio Grondi
"Steve Holden" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > "Kenneth McDonald" <[EMAIL PROTECTED]> wrote in
> > news:[EMAIL PROTECTED]
> >
> >>Thanks for reminding me of Gtk. OK, add that to the list.
> >>
> >>The Web Browser interface is good for simple things, and will get better
> >>with CSS2's adoption, but they still don't have a good way for important
> >>things like interactive styled text, key bindings, etc. Good for
> >>simple things
> >>(for which I use them), not for more complex stuff.
> >
> >
> > I don't fully understand your attitude here. The Web Browser interface
has
> > all I can imagine is required for a GUI, so what is missing when you
> > consider, that you can generate custom images on the fly on the server
and
> > let the user shape the page without requesting CPU power from the server
> > using JavaScript.
>
> In this case then, I'm afraid the failure is in your imagination :-)

Any useful hints towards enlightenment except criticism?

>
> > I don't even name here the not really beeing itegral part of Internet
> > Browsers JavaApplets and any other kind of plugin stuff.
> > The only issue I can see with this approach is the speed of responding
to
> > user interactions, but for really optimize this one needs a compiled
> > language anyway.
> > What is that complex, that it can't be solved using an Internet Browser
as a
> > GUI?
> > Do I miss here something?
> >
> While you are correct in saying (I paraphrase) that HTML interfaces
> nowadays can offer a rich graphical interface, it can be quite difficult
> to manage state maintenance between the two components (web server, web
> client) in the system.

The cause of confusion here is, that HTML interfaces don't necessary need a
web server and HTTP to work. I mean, that Internet Browsers
have an API which allow access to them directly, so they can be used without
a server as a kind of GUI library supporting widgets programmed
in HTML and JavaScript  (I haven't used them yet in this form, but I think
it should be no problem - right or not?).

>
> A "proper" GUI runs all functionality inside a single process, and
> allows much easier control over complex interactions, creation of
> dynamic dialogues, and so on.
Complex and dynamic is in my eyes possible with HTML and JavaScript, so I
still don't see where is a problem with this approach. I have programmed
already a HTML and JavaScript driven server platform and know about (the
solvable) problems with the back-button and sessions (it is sure not the
easiest way of programming a GUI).
The only disadvantage of not using plugins or Java is, that real time
interactions are not possible, but this is in my eyes usually not the
requirement for a standard kind of GUI with no gaming, no Virtual Reality
and no timing of user response down to milliseconds (but consider, that with
a good speed of connection it is even possible to play blitz chess over the
Internet).

Claudio
>
> regards
>   Steve
> -- 
> Steve Holden   +44 150 684 7255  +1 800 494 3119
> Holden Web LLC www.holdenweb.com
> PyCon TX 2006  www.python.org/pycon/
>



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


Re: UI toolkits for Python

2005-10-14 Thread Claudio Grondi

"Kenneth McDonald" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]
> Thanks for reminding me of Gtk. OK, add that to the list.
>
> The Web Browser interface is good for simple things, and will get better
> with CSS2's adoption, but they still don't have a good way for important
> things like interactive styled text, key bindings, etc. Good for
> simple things
> (for which I use them), not for more complex stuff.

I don't fully understand your attitude here. The Web Browser interface has
all I can imagine is required for a GUI, so what is missing when you
consider, that you can generate custom images on the fly on the server and
let the user shape the page without requesting CPU power from the server
using JavaScript.
I don't even name here the not really beeing itegral part of Internet
Browsers JavaApplets and any other kind of plugin stuff.
The only issue I can see with this approach is the speed of responding to
user interactions, but for really optimize this one needs a compiled
language anyway.
What is that complex, that it can't be solved using an Internet Browser as a
GUI?
Do I miss here something?

Claudio



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


Re: matching elements of numeric arrays

2005-10-13 Thread Claudio Grondi
<[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]
> I have two one-dimensional Numeric arrays, and I need to know the
> indices in the second array of elements from the first.
>
> so if i had:
>
> a=array([2,4,6])
> b=array([2,3,4,5,6])
>
> i want a function match that does this:
>
> >>> match(a,b)
> array([0,2,4])
>
> i have something that works, but it involves converting things to lists
> and using 'in', and it is rather slow. if someone could point me to a
> better solution, i would appreciate it.

I have no idea about Numeric array module, so I will use
the built-in Python one for it (how about the speed if
compared to Numeric arrays?):

from array import array
a = array('I', [2,4,6])
b = array('I', [2,3,4,5,6])

def match(a,b):
  retVal = array('I')
  for item in a:
retVal.append(b.index(item))
  return retVal

print a
print b
print str(match(a,b))

Outputs:

array('I', [2L, 4L, 6L])
array('I', [2L, 3L, 4L, 5L, 6L])
array('I', [0L, 2L, 4L])

Claudio


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


Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-13 Thread Claudio Grondi
What I can point you to is not Python, but embedding it in Python
is a question of executing one line of Python code triggering its
execution.
I think you will be fascinated by its features and ease of use and
how well it is suited to fit into your needs:
  http://www.autoitscript.com/autoit3/index.php
With it you will start to see, that forcing to obey to Windows way
of doing things has not only bad sides.

Is there something similar for another OSs-es (especially Linux)?

Claudio

"Kenneth McDonald" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> For unfortunate reasons, I'm considering switching back to Win XP
> (from OS X) as my "main" system. Windows has so many annoyances that
> I can only compare it to driving in the Bay Area at rush hour (OS X
> is like driving in Portland at rush hour--not as bad, but getting
> there), but there are really only a couple of things that are really,
> absolutely preventing me from making the switch. Number one is the
> lack of a decent command line and command-line environment, and I'm
> wondering (hoping) if perhaps someone has written a "Python shell"-- 
> something that will look like a regular shell, let users type in
> commands, maybe have some of the nice features of bash etc. like tab
> completion, etc, and will then execute an underlying python script
> when the command is entered. I'm not thinking of IDLE, but something
> that is really aimed more at being a system terminal, not a Python-
> specific terminal.
>
> Yes, I know that Cygwin is out there, but last I looked, they still
> went through the Win command-line window, which imposes a lot of
> restrictions.
>
> More generally, has anyone written any python programs to administer
> various Win settings for which one must otherwise delve deep into
> mazes of twisty little dialogs, all alike? Or to help out with other
> annoyances? I know there are a lot of general utilities, but if
> they're in Python, I can also use them as a starting base for my own
> needs.
>
> Finally, a significant incentive in doing this is that I could avoid
> a lot of installation hassle, since virtually everything has at least
> a decent installation package for Win. (I'd hoped this would happen
> for OS X, but it never has). Can anyone think of important python-
> related packages (release level, not cutting edge alphas) for which
> this might not be the case?
>
> Many thanks,
> Ken


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


Python source code for direct access to raw sectors of harddrives (MFT, boot sector, etc.) in Linux/Windows

2005-10-12 Thread Claudio Grondi
Python code for direct access to raw sectors of harddrives (MFT, boot
sector, etc.) in Linux/Windows:

http://people.freenet.de/AiTI-IT/Python/HowTo_AccessRawSectorsOfPhysicalDrives_onLinux.py
and
http://people.freenet.de/AiTI-IT/Python/HowTo_AccessRawSectorsOfPhysicalDrives_onWindows.py

Claudio
http://wiki.python.org/moin/ClaudioGrondi


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


Re: Wanted: Python module allowing direct access to raw sectors ofharddrives (MFT, boot sector, etc.) in MS Windows

2005-10-11 Thread Claudio Grondi
Thank you for your reply, even if currently not
that interesting for me because after the first
CD writer for IDE were available I stopped to
use SCSI and didn't come back to it since then.

Does the Python open() command not work the
same way for SCSI drives as for IDE or USB
drives (I can't try it myself, because of above)?

Claudio
P.S. for those who are interested I have uploaded a
Python script I wrote for myself to have a reference to
this subject to:
http://people.freenet.de/AiTI-IT/Python/HowTo_AccessRawSectorsOfPhysicalDrives.py
:-)

"sam" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> The following site contains my routines to access information from the
> Microsoft SCSIPASSTHROUGH layer under windows. These routines allow you
> to access the storage devices mounted under windows using SCSI
> commands. The dll that I provide will work with Python 2.3
>
> http://starship.python.net/crew/samschul/
>
> Sam Schulenburg
>
> Claudio Grondi wrote:
> > Thank you Jeff very much for your quick reply.
> > It saved me really much time of digging in the wrong direction.
> >
> > <[EMAIL PROTECTED]> wrote in
> > news:<[EMAIL PROTECTED]>...
> > >> I took the advice from this web page:
> > >> http://support.microsoft.com/kb/q100027/
> > Ok, I had found this page myself during Googling, but I have missed just
> > to try to use the described way of addressing physical devices with file
> > opening in Python.
> > It works as expected with harddrives so you are right that you are
getting
> > the MBR with the proposed code.
> >
> > After some not always happy end adventures with Python
> > scripting I am impressed by the power of the concept behind
> > the language once again.
> >
> > Claudio
> >
> > >>(I don't know how this extends to floppies, and the 9x family of OSes
> > isn't
> > >>listed in "applies to", so this may not help your case)
> > >>Here, I open "physical drive 0" and see that the magic number
indicates a
> > valid
> > >>boot record. I believe it is the MBR.
> > >>>>> f = open('.\\PhysicalDrive0', 'rb')
> > >>>>> f.read(512)[-2:]
> > >>'U\xaa' # that is, hex 55 AA
> > >>I don't know much about low-level filesystem or partition details--I
got
> > the
> > >>tidbit about the 55 AA magic number from
> >
>>http://www-uxsup.csx.cam.ac.uk/pub/doc/suse/sles9/adminguide-sles9/ch08.ht
> > ml
> > >>Jeff
> > >><[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > news:[EMAIL PROTECTED]
>




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


Re: Wanted: Python module allowing direct access to raw sectors ofharddrives (MFT, boot sector, etc.) in MS Windows

2005-10-10 Thread Claudio Grondi
Thank you Jeff very much for your quick reply.
It saved me really much time of digging in the wrong direction.

<[EMAIL PROTECTED]> wrote in
news:<[EMAIL PROTECTED]>...
>> I took the advice from this web page:
>> http://support.microsoft.com/kb/q100027/
Ok, I had found this page myself during Googling, but I have missed just
to try to use the described way of addressing physical devices with file
opening in Python.
It works as expected with harddrives so you are right that you are getting
the MBR with the proposed code.

After some not always happy end adventures with Python
scripting I am impressed by the power of the concept behind
the language once again.

Claudio

>>(I don't know how this extends to floppies, and the 9x family of OSes
isn't
>>listed in "applies to", so this may not help your case)
>>Here, I open "physical drive 0" and see that the magic number indicates a
valid
>>boot record. I believe it is the MBR.
> f = open('.\\PhysicalDrive0', 'rb')
> f.read(512)[-2:]
>>'U\xaa' # that is, hex 55 AA
>>I don't know much about low-level filesystem or partition details--I got
the
>>tidbit about the 55 AA magic number from
>>http://www-uxsup.csx.cam.ac.uk/pub/doc/suse/sles9/adminguide-sles9/ch08.ht
ml
>>Jeff
>><[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]


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


Wanted: Python module allowing direct access to raw sectors of harddrives (MFT, boot sector, etc.) in MS Windows

2005-10-10 Thread Claudio Grondi
Googling for keywords like
"direct access sector harddrive Python module Windows"
seems to give no useful results.

Any hints(best if cross-platform)?

Claudio



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


Re: pyMinGW support for Python 2.4.2 (final) is available

2005-09-28 Thread Claudio Grondi
I am not able to download any file from the site
below, getting always only a page with link to the
download which is the link to the HTML page with
same link. Any ideas why?

Claudio

"A.B., Khalid" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> This is to inform those interested in compiling Python in MinGW that
> an updated version of pyMinGW is now available.
>
> Get it from here:
> http://jove.prohosting.com/iwave/ipython/pyMinGW.html
>
> Regards
> Khalid
>


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


Re: Getting a number out of a string

2005-09-27 Thread Claudio Grondi
what about:
>>> lst = [digit for digit in '06897']
>>> lst
['0', '6', '8', '9', '7']

Claudio

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I'm trying to extract single digit number from a string.
>
> t[1] = '06897'
>
> I want to get the 7, 9,8 & 6 seperated out to use but can't find a way
> to split out the single characters.
>
> Thanks
>


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


Re: The .NET Framework SDK needs to be installed before building

2005-09-22 Thread Claudio Grondi
I mean I have seen this error already in the past installing
another package requiring compilation of C sources.

As I can remember, the actual problem was, that C++ .NET 2003
compiler environment was not installed - so this message seems
to point in the wrong direction (is created somewhere inside
distutils).

Claudio

"vj" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I have installed the .NET Framework SDK 1.1.
> Yet I recieve this error message when I install PYDB2.
>
> Could you please pour in your suggestions .
> Thanks.
>
> Vj.
>


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


Re: Is it possible to detect if files on a drive were changed without scanning the drive?

2005-09-12 Thread Claudio Grondi

"Alessandro Bottoni" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > After connecting a drive to the system (via USB
> > or IDE) I would like to be able to see within seconds
> > if there were changes in the file system of that drive
> > since last check (250 GB drive with about four million
> > files on it).
> >
> > How to accomplish this? (best if providing
> > directly a Python receipe for it :-)
> > Do available file systems have something like
> > archive attribute assigned to the root directory
> > of the drive?
> > I suppose not. Am I right?
>
> On Linux there is the FAM (File Alteration Module) for this, as long as I
> know. Maybe Python has a wrapper/binding for it.
>
> > I ask this question having Microsoft Windows 2000
> > and Windows proprietary NTFS file system in mind,
> > but I am also interested to know it about Linux or
> > Unix file systems.
>
> As long as I know, on Windows there are a few specific "hooks" to perform
> such a task. They are provided by the MS API for the NTFS/HPFS file
> systems. I do not think Python implements anything so "low level", anyway.
> Check the docu to be sure.
>
> > I know, that looking for the archive attribute of the
> > top directories doesn't help when the change
> > happened to files somewhere deeper in the
> > hierarchy of directories.
>
> Right. It does not help.
>
> Consider this: if are accessing a network file system, you can intercepts
> the calls to the virtualization layer (NFS or NetBIOS). Most likely,
Python
> can support you in performing this task.
>
> HTH
> ---
> Alessandro Bottoni

Thank you for your response.

To be more clear I should maybe add, that I have not to do with
drives beeing altered while the system is running. The drives content
can be altered e.g. by the computer of a friend who I gave the drive
out to.
I tell it here, because it seems, that the answer is biased
towards detecting changes done to files on a drive while
running on a system able to monitor the drives activity.

Claudio


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


Re: Why do Pythoneers reinvent the wheel?

2005-09-12 Thread Claudio Grondi
Here some of my thougts on this subject:

I think that this question adresses only a tiny
aspect of a much more general problem the
entire human race has in any area.
Reinventing the wheel begins when the grandpa
starts to teach his grandchild remembering well
that he has done it already many times before
to own children.

As any of us takes the chance to be somehow
different and writing program code does need
much understanding how and why something
works, it is very probably, that what is there is hard
to understand (Python as a programming language
is not really an exception here). There is not much
around of so universal value, that it can be
taken any time by anyone.

When I am coming myself back to what I have created
in the past I often see what trash I have produced.
The unique discoveries of the kind "wow! today I would
do it the same way or even less smart not given enough
time" don't change the general picture.

So the question is here, where are the tools making
it possible to find a piece of code solving a
problem when the problem is formulated only
using natural language? I am finding myself reinventing
the wheel all the time only because I am not able to find
appropriate pieces of code in the collection I have put
together (am I alone here? bad memory? lack of
proper filing system?).

It seems, that posting to a newsgroup is usually
the best choice, but even this needs much work
in advance before it is possible to communicate what the
problem is, that one has.
In case of the OpenCV interface to Python even that
seem not to help ... (I am pretty sure there is someone
out there who would be able to put me in the right
direction).

Are there any tools in Python based on associations
looking for specific types of code?
Something similar to http://www.qknow.com , but addressed
towards specific needs of a programmer looking for code
snippets? (not a kind of search engine or system of
folders with cross links, but a system able to find a chain
of snippets required to solve a problem).

To name a simplest example:
What should I do to find a piece of code taking an
integer and giving a string with binary form of a
number? How to put some available pieces of code
together if the binary form is needed and the integer
is provided as a string holding its hexadecimal form?
What if the string is the binary representation of the
integer value as internally stored in memory?
What if I would like the binary form to be splitted
in nibbles separated with one space and bytes with
two spaces?

How can I avoid to reinvent the wheel, when I
don't have the tools to find what I am looking
for?

Saying it in words of the Beatles song:
"Help me if you can, I'm feeling down.
And I do appreciate you being round.
Help me, get my feet back on the ground,
Won't you please, please help me,
help me, help me, oh. "

Claudio


"Stefano Masini" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
On 8 Sep 2005 08:24:50 -0700, Fuzzyman <[EMAIL PROTECTED]> wrote:
> What is pythonutils ?
> =
> ConfigObj - simple config file handling
> validate - validation and type conversion system
> listquote - string to list conversion
> StandOut - simple logging and output control object
> pathutils - for working with paths and files
> cgiutils - cgi helpers
> urlpath - functions for handling URLs
> odict - Ordered Dictionary Class

Fuzzyman, your post reminded me of something I can't stop thinking
about. Please don't take this as a critique on your work. I place
myself on the same side of yours.
I just wanted to share this thought with everybody had an opinion about it.

I wonder how many people (including myself) have implemented their own
versions of such modules, at least once in their pythonic life. I
indeed have my own odict (even same name! :). My own pathutils
(different name, but same stuff). My own validate... and so forth.

This is just too bad.
There are a few ares where everybody seems to be implementing their
own stuff over and over: logging, file handling, ordered dictionaries,
data serialization, and maybe a few more.
I don't know what's the ultimate problem, but I think there are 3 main
reasons:
1) poor communication inside the community (mhm... arguable)
2) lack of a rich standard library (I heard this more than once)
3) python is such an easy language that the "I'll do it myself" evil
side lying hidden inside each one of us comes up a little too often,
and prevents from spending more time on research of what's available.

It seems to me that this tendency is hurting python, and I wonder if
there is something that could be done about it. I once followed a
discussion about placing one of the available third party modules for
file handling inside the standard library. I can't remember its name
right now, but the discussion quickly became hot with considerations
about the module not being "right" enough to fit the standard library.
The points were right, but in some sense it's a pity because by be

Is it possible to detect if files on a drive were changed without scanning the drive?

2005-09-12 Thread Claudio Grondi
It is maybe not a pure Python question, but I think
it is the right newsgroup to ask for help, anyway.

After connecting a drive to the system (via USB
or IDE) I would like to be able to see within seconds
if there were changes in the file system of that drive
since last check (250 GB drive with about four million
files on it).

How to accomplish this? (best if providing
directly a Python receipe for it :-)
Do available file systems have something like
archive attribute assigned to the root directory
of the drive?
I suppose not. Am I right?

I ask this question having Microsoft Windows 2000
and Windows proprietary NTFS file system in mind,
but I am also interested to know it about Linux or
Unix file systems.

I know, that looking for the archive attribute of the
top directories doesn't help when the change
happened to files somewhere deeper in the
hierarchy of directories.

Any hints are welcome.

Claudio


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


Re: left/right mouse button events not trapped

2005-09-06 Thread Claudio Grondi
Below code which does the trick  :))

Claudio

import  string
import  wx
# import  images
import  os
import  cStringIO
import xml.sax

from wxPython.wx import *
# from Main import opj

class DisplayPicture(wx.Frame):
  cD = 0
  def __init__(self, parent, id, title, bmp, w, h):
wxFrame.__init__(self, parent, wxID_ANY, title, size = ( w, h),
style=wxDEFAULT_FRAME_STYLE )
mD = 0

self.Panel  = wx.Panel(self)
self.Bitmap = wx.StaticBitmap(self.Panel, -1, bmp, (5, 5) )

""" FOR SOME REASON THE MOUSE CLICKS DON-T WORK!"""
""" SHIT SHIT SHIT SHIT ... x 1000 """
wx.EVT_LEFT_DOWN(self.Panel,   self.OnLeftClickDown)
wx.EVT_LEFT_UP(self.Panel,self.OnLeftClickUp)
wx.EVT_LEFT_DCLICK(self.Panel, self.OnLeftDoubleClick)

wx.EVT_LEFT_DOWN(self.Bitmap,   self.OnLeftClickDownOnBitmap)

self.CreateStatusBar()
self.Show()

self.SetStatusText('Submap Coordinates:')

  def OnLeftClickDown(self, event):
print "  OnLeftClickDown"

  def OnLeftClickDownOnBitmap(self, event):
print "  OnLeftClickDownOnBitmap"

  def OnLeftClickUp(self, event):
print "  OnLeftClickUp"

  def OnLeftDoubleClick(self, event):
print "  OnLeftDoubleClick"

class MyApp(wx.App):
  cD = 0
  def OnInit(self):
wx.InitAllImageHandlers()
return 1

#
# Main
#

if __name__ == "__main__":
  app = MyApp(0)


  data = open('e:\winnt\Granit.bmp', "rb").read()
  stream = cStringIO.StringIO(data)
  bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
  bmpW = bmp.GetWidth()
  bmpH = bmp.GetHeight()
  DisplayPicturePanel=DisplayPicture(None, -1, "Test MB", bmp, bmpW, bmpH)
  #MainFrame = DisplayPicture(None,-1,"Test Mouse Clicks")

  app.MainLoop()


"Claudio Grondi" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> I don't know much about wxPython, but
>   the left/right mouse button events _ARE_ trapped, but
>   not when clicking on the image, probably because they
>   are registered to the panel not to the image.
> Just resize the window and click next to the image.
>
> Hope this helps for now, before you get a response
> from someone who knows some more about wxPython
> (e.g. why the events from the bitmap are not forwarded
> to the panel containing it?).
>
> Claudio
> P.S. Here the corrected code I was able to run on my machine:
>
> import  string
> import  wx
> # import  images
> import  os
> import  cStringIO
> import xml.sax
>
> from wxPython.wx import *
> # from Main import opj
>
> class DisplayPicture(wx.Frame):
>   cD = 0
>   def __init__(self, parent, id, title, bmp, w, h):
> wxFrame.__init__(self, parent, wxID_ANY, title, size = ( w, h),
> style=wxDEFAULT_FRAME_STYLE )
> mD = 0
>
> self.Panel=wx.Panel(self)
> wx.StaticBitmap(self.Panel, -1, bmp, (5, 5) )
>
> """ FOR SOME REASON THE MOUSE CLICKS DON-T WORK!"""
> """ SHIT SHIT SHIT SHIT ... x 1000 """
> wx.EVT_LEFT_DOWN(self.Panel,   self.OnLeftClick)
> wx.EVT_LEFT_UP(self.Panel, self.OnLeftClick)
> wx.EVT_LEFT_DCLICK(self.Panel, self.OnLeftClick)
>
> self.CreateStatusBar()
> self.Show()
>
> self.SetStatusText('Submap Coordinates:')
>
>   def OnLeftClick(self, event):
> print "ok the mouse click works!"
>
> class MyApp(wx.App):
>   cD = 0
>   def OnInit(self):
> wx.InitAllImageHandlers()
> return 1
>
> #
> # Main
> #
>
> if __name__ == "__main__":
>   app = MyApp(0)
>
>
>   data = open('e:\winnt\Granit.bmp', "rb").read()
>   stream = cStringIO.StringIO(data)
>   bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
>   bmpW = bmp.GetWidth()
>   bmpH = bmp.GetHeight()
>   DisplayPicturePanel=DisplayPicture(None, -1, "Test MB", bmp, bmpW, bmpH)
>   #MainFrame = DisplayPicture(None,-1,"Test Mouse Clicks")
>
>
>   app.MainLoop()
>
> <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > Hi,
> >
> > I have included a small listing. The test program opens a panel and
> > show a bitmap.
> > What I want is to when the mouse is over the bitmap panel, I want to
> > trap the left mouse click.
> > The purpose is to get the position of the mouse pointer on the bitmap.
> > However, for some reason, the left (I also tried right) mouse clicks
> > are not intercepted.
> > I new to Python and wxWindows so any help would be greatly appreciated.
> >
> > With kind regards,
> >
> > Kris
> > "
> > import  string
>

Re: left/right mouse button events not trapped

2005-09-06 Thread Claudio Grondi
I don't know much about wxPython, but
  the left/right mouse button events _ARE_ trapped, but
  not when clicking on the image, probably because they
  are registered to the panel not to the image.
Just resize the window and click next to the image.

Hope this helps for now, before you get a response
from someone who knows some more about wxPython
(e.g. why the events from the bitmap are not forwarded
to the panel containing it?).

Claudio
P.S. Here the corrected code I was able to run on my machine:

import  string
import  wx
# import  images
import  os
import  cStringIO
import xml.sax

from wxPython.wx import *
# from Main import opj

class DisplayPicture(wx.Frame):
  cD = 0
  def __init__(self, parent, id, title, bmp, w, h):
wxFrame.__init__(self, parent, wxID_ANY, title, size = ( w, h),
style=wxDEFAULT_FRAME_STYLE )
mD = 0

self.Panel=wx.Panel(self)
wx.StaticBitmap(self.Panel, -1, bmp, (5, 5) )

""" FOR SOME REASON THE MOUSE CLICKS DON-T WORK!"""
""" SHIT SHIT SHIT SHIT ... x 1000 """
wx.EVT_LEFT_DOWN(self.Panel,   self.OnLeftClick)
wx.EVT_LEFT_UP(self.Panel, self.OnLeftClick)
wx.EVT_LEFT_DCLICK(self.Panel, self.OnLeftClick)

self.CreateStatusBar()
self.Show()

self.SetStatusText('Submap Coordinates:')

  def OnLeftClick(self, event):
print "ok the mouse click works!"

class MyApp(wx.App):
  cD = 0
  def OnInit(self):
wx.InitAllImageHandlers()
return 1

#
# Main
#

if __name__ == "__main__":
  app = MyApp(0)


  data = open('e:\winnt\Granit.bmp', "rb").read()
  stream = cStringIO.StringIO(data)
  bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
  bmpW = bmp.GetWidth()
  bmpH = bmp.GetHeight()
  DisplayPicturePanel=DisplayPicture(None, -1, "Test MB", bmp, bmpW, bmpH)
  #MainFrame = DisplayPicture(None,-1,"Test Mouse Clicks")


  app.MainLoop()

<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi,
>
> I have included a small listing. The test program opens a panel and
> show a bitmap.
> What I want is to when the mouse is over the bitmap panel, I want to
> trap the left mouse click.
> The purpose is to get the position of the mouse pointer on the bitmap.
> However, for some reason, the left (I also tried right) mouse clicks
> are not intercepted.
> I new to Python and wxWindows so any help would be greatly appreciated.
>
> With kind regards,
>
> Kris
> "
> import  string
> import  wx
> import  images
> import  os
> import  cStringIO
> import xml.sax
>
> from wxPython.wx import *
> from Main import opj
>
> class DisplayPicture(wx.Frame):
>   cD = 0
>
>   def __init__(self, parent, id, title, bmp, w, h):
> wxFrame.__init__(self,parent,wxID_ANY, title, size = ( w, h),
> style=wxDEFAULT_FRAME_STYLE)
>
>   mD = 0
>
> self.Panel=wx.Panel(self)
>  wx.StaticBitmap(self.Panel, -1, bmp, (5, 5) )
>
> """ FOR SOME REASON THE MOUSE CLICKS DON'T WORK!"""
> """ SHIT SHIT SHIT SHIT ... x 1000 """
> wx.EVT_LEFT_DOWN(self.Panel, self.OnLeftClick)
>  wx.EVT_LEFT_UP(self.Panel, self.OnLeftClick)
>  wx.EVT_LEFT_DCLICK(self.Panel, self.OnLeftClick)
>
>
> self.CreateStatusBar()
>  self.Show()
>
>  self.SetStatusText('Submap Coordinates:')
>
>   def OnLeftClick(self, event):
> print "ok the mouse click works!"
>
> class MyApp(wx.App):
> cD = 0
> def OnInit(self):
> wx.InitAllImageHandlers()
> return 1
>
> #
> # Main
> #
>
> if __name__ == "__main__":
> app = MyApp(0)
>
>
> data = open(opj('c:\winnt\Greenstone.bmp'), "rb").read()
> stream = cStringIO.StringIO(data)
> bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
> bmpW = bmp.GetWidth()
> bmpH = bmp.GetHeight()
> DisplayPicturePanel=DisplayPicture(None, -1, "Test MB", bmp, bmpW,
> bmpH)
> #MainFrame = DisplayPicture(None,-1,"Test Mouse Clicks")
>
>
> app.MainLoop()
> "
>


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


Python OpenCV wrapper

2005-09-06 Thread Claudio Grondi

 What is the current status of Python OpenCV interface i.e. the opencv
module?

\OpenCV\samples\python\contours.py gives following ERROR:
OpenCV Python version of contours
Traceback (most recent call last):
  File "\OpenCV\samples\python\contours.py", line 6, in ?
from opencv import cv
ImportError: No module named opencv

but I can't find any hints towards a opencv Python module.

Claudio
P.S.
OpenCV means Intel® Open Source Computer Vision Library. It is a collection
of C functions and a
few C++ classes that implement some popular Image Processing and Computer
Vision algorithms.
  http://www.intel.com/technology/computing/opencv/overview.htm

This is the best what I was able to find using Google, but it seems to lead
nowhere:
http://64.233.183.104/search?q=cache:0XTwiKGzflYJ:www.ient.rwth-aachen.de/team/asbach/opencv-python.html+OpenCV+python+module&hl=de
dated  2005-02-02 (the original page was not available, but Google has a
cache :/):
Before putting a lot of effort in SWIG wrapping of OpenCV ourselves, we
searched the web for already existing Python wrappers. There has been some
work on the topic, but none that satisfied our needs, since we're interested
in wrappers for the current and future OpenCV releases that provide access
to the data structure internals.:

  a.. http://www.swig.org/ - The SWIG homepage
  b..
http://sourceforge.net/tracker/index.php?func=detail&aid=754443&group_id=1645&atid=101645
 -
SWIG Bug ???[754443] conversion of preprocessor math", one of the bugs that
make direct SWIG wrapping of OpenCV headers impossible.
  c.. http://www.cs.wustl.edu/~rstancha/oss.html - Basic SWIG wrapping for
Python and OpenCV (see above). This is where we took PIL and Numeric
convertor ideas from.
  d.. http://members.tripod.com/~edcjones/pycode.html - An older attempt to
SWIG wrapping OpenCV for Python. Uses manually rewritten OpenCV headers that
are not portable to current OpenCV releases (Beta 3 and Beta 4 not working).
  e.. http://blueruby.mydns.jp/opencv/index.rbx?cmd=view;name=top - Ruby
wrappres for OpenCV (see above). Sorry, this page is in Japanese .


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

Re: new line

2005-08-29 Thread Claudio Grondi
"Kuljo" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Dear friends
> I'm so sorry to bore you with this trivial problem. Allthou: I have string
> having 0x0a as new line, but I should have \n instead.
> How should I solve it?
> I've tried
> >>>text_new=tex_old.replace(str(0x0a), '\n')
> and other things, but none of them worked.
> Thanks in advance

text_new=tex_old.replace(chr(0x0a), '\r\n')
works for me.

Claudio
P.S. str(0x0a) == '10'


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


Re: Why does min(A, B) not raise an error if A, B actually can't be compared?

2005-08-26 Thread Claudio Grondi
Thanks to Raymond for his reply.

If I understand him right, there is no problem with
min() as such, but with the definition of the class, which
when used in min() should define at least __cmp__().

I have attached code with another
  class  PythonObject_classWithDefined__cmp__:
where the behaviour of min() is like I would
expect it.

Using classes without defined __cmp__ in comparison
operations violates the directive:
  "Explicit is better than implicit"
and is just to be considered bad programming
style or to name it more directly, just a way of
obfuscating code, right?

The still open question for me then is:
Why does min() not raise an error in case
there is no comparison function definition
for the feeded objects available?

Claudio

ATTACHMENT:

class PythonObject_classWithDefined__cmp__:
  def __init__(self, value = 1):
self.value = value
  #:def
  def __cmp__(self, otherInstance):
if ( self.value < otherInstance.value ):
  return -1
elif(self.value == otherInstance.value ):
  return 0
else:
  return 1
#:if/else
  #:def
#:class

PythonObject_classWithDefined__cmp__instanceA =
PythonObject_classWithDefined__cmp__()
PythonObject_classWithDefined__cmp__instanceB =
PythonObject_classWithDefined__cmp__()
print "min(A,B) is A: "
print "in case of classes with defined __cmp__() as parameter: " +
str(min(PythonObject_classWithDefined__cmp__instanceA,
PythonObject_classWithDefined__cmp__instanceB) is
PythonObject_classWithDefined__cmp__instanceA)
print "min(B,A) is A: "
print "in case of classes with defined __cmp__() as parameter: " +
str(min(PythonObject_classWithDefined__cmp__instanceB,
PythonObject_classWithDefined__cmp__instanceA) is
PythonObject_classWithDefined__cmp__instanceA)

 outputs:

min(A,B) is A:
in case of classes with defined __cmp__() as parameter: True
min(B,A) is A:
in case of classes with defined __cmp__() as parameter: False


"Raymond Hettinger" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > Is there any deeper reason I don't understand
> > explaining why does min(A,B) behave different
> > for classes than for lists?
>
> Yes, the sort order for lists is determined by their contents.  With
> your example, the lists have identical contents, so min() returns the
> first minimum value encountered which is A for min(A,B) and B for
> min(B,A).
>
> For instances, the sort order is determined by custom __cmp__ or rich
> comparision methods.  In the absence of those, the default ordering is
> determined by the object's id.  In your example, the default is used
> and either object may be returned as the minimum depending on which
> object id is a higher number (that is an implementation and state
> dependent).  Since the two objects have unique ids, min() will
> consistently find one to be lower than the other irrespective of
> argument order, if min(A,B) is A, then min(B,A) will also be A.
>
> The best way to develop your understanding here is view the object ids
> for the instances and experiment with the results of A etc.
>
> Then write a simple, pure python version of min() that returns the
> first occurence of the lowest valued element.  Trace through its
> execution and all will become clear.
>
>
> Raymond
>



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


Why does min(A,B) behave different for lists and for classes?

2005-08-26 Thread Claudio Grondi
Trying to understand the outcome of the recent
thread (called later reference thread):

"Speed quirk: redundant line gives six-fold speedup"

I have put following piece of Python code together:

class PythonObject_class:
  pass
PythonObject_class_instanceA = PythonObject_class()
PythonObject_class_instanceB = PythonObject_class()
PythonObject_list_instanceA = [1]
PythonObject_list_instanceB = [1]

print "min(A,B) is A: "
print "in case of classes as parameter: " +
str(min(PythonObject_class_instanceA, PythonObject_class_instanceB) is
PythonObject_class_instanceA)
print "in case of lists as parameter:   " +
str(min(PythonObject_list_instanceA,  PythonObject_list_instanceB)  is
PythonObject_list_instanceA)
print "min(B,A) is A: "
print "in case of classes as parameter: " +
str(min(PythonObject_class_instanceB,
PythonObject_class_instanceA) is PythonObject_class_instanceA)
print "in case of lists as parameter:   " +
str(min(PythonObject_list_instanceB,
PythonObject_list_instanceA) is PythonObject_list_instanceA)

getting as output:

min(A,B) is A:
in case of classes as parameter: True
in case of lists as parameter:   True
min(B,A) is A:
in case of classes as parameter: True
in case of lists as parameter:   False

Is there any deeper reason I don't understand
explaining why does min(A,B) behave different
for classes than for lists?
It makes for me currently not much sense how it
behaves for classes, because the result is according
to the postings in the above mentioned reference
thread nondeterministic.

Claudio


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


Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread Claudio Grondi
> I've learnt my lesson :)  Thank you for your help, and apologies
> for wasting other people's time with this as well as my own!

I've learnt my lesson reading through this thread, too.

I am glad to be given the chance of  wasting my time
with it and very happy and thankful, that you posted
your problem here before I have bumped into similar
one myself. I suppose, that there are many others
on this  newsgroup who appreciated your posting,
too.

Claudio


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


unpacking TAR 1.14/ 1.15 archives on Windows (first step towards own static HTML version of Wikipedia)

2005-08-20 Thread Claudio Grondi

Thank you both (Martin and Diez) for your help.

The 17 GByte TAR archive was unpacked
without problems the way you suggested.

Let's summarize:

# Python  tarfile  module can't extract files from
newer TAR archives (archived with tar 1.14 or later)

# The core of my problems was, that I was not aware
how easy it is to install and work with Cygwin and that to
get Cygwins  tar.exe  to work it is necessary to use the
provided Cygwin bash-3.00 shell an NOT the Windows
command shell (DOS-box) .

The receipt for unpacking Wikipedia media files
provided as TAR archives when using Microsoft
Windows is:

Step 1. download http://sources.redhat.com/cygwin/setup.exe

Step 2a. run the downloaded setup.exe which goes online and
  lets you choose which packages should be installed

Step 2b. select for the installation additional to suggested ones
  the  tar  package version 1.15

Step 3. use the Cygwin icon on the Desktop or in Start-Programs-
  Cygwin-Cygwin Bash Shell to start a Cygwin shell and type :

bash-3.00$
./bin/tar.exe  --extract  --directory=/cygdrive/i/wikipedia/en/media
   -f
/cygdrive/j/download.wikimedia.org/archives/images/en/20050530_upload.tar

where i: and j: are the drive letters of appropriate Windows drives.

The media files stored in TAR archive
j: \download.wikimedia.org\archives\images\en\20050530_upload.tar
will be unpacked to
  i:\wikipedia\en\media
directory

Step 4. wait, wait, wait ... (how long depends most on
speed of your  harddrives, on my system with USB drives
appr. one hour)

Step 5.  BE HAPPY  :))
  and enjoy it, because you have mastered a step towards
  your own static HTML version of Wikipedia.
  The problems with extracting the content from the MySQL
  database dumps will kill you soon - and if not, especially
  for non-english languages (like German, Polish, Russian)
  and with math-formulas converted to pictures,
  all done on a Windows system __PLEASE__ share your
  know-how with me !!!
  (the only useful information I found on Internet about it
  were postings within the thread I initiated a longer time
  ago myself
http://www.pythonforum.org/ftopic19424_Wikipedia___conversion_of_in_SQL_database_stored_data_to_HTM.html
)

Claudio

"Diez B. Roggisch" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > remember. I work in a Windows command shell
> > (DOS-box) and mount says:
> > j: on /cygdrive/j , but I don't know how to write
> > the entire path
> > "j:\o\archives\images\dump.tar",
> > so that the file can be found by tar.exe and
> > unpacked to "i:\images" .
> > tar.exe --extract --directory=tmp -f j:/o/archives/images/dump.tar
> > results in:
> > /usr/bin/tar: j\:/o/archives/images/dump.tar: Cannot open: Input/Output
> > error
> > telling
> > tar.exe --extract --directory=tmp -f
/cygdrive/j/o/archives/images/dump.tar
> > doesn't work either.
>
>
> Try the cygpath-command like this:
>
> echo `cygpath c:\\some\\windows\\path`
>
> That should yield
>
> /cygdrive/c/some/windows/path
>
> Alternatively, do somethink like this
>
> mkdir -p /mnt/j
>
> mount j: /mnt/j
>
> Then /mnt/j should be the root for all files under j:
>
> HTH Diez


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


Re: Version of TAR in tarfile module? TAR 1.14 or 1.15 port to Windows?

2005-08-20 Thread Claudio Grondi
Martin, thank you for your response.

I see, that I have to test myself if the tarfile
module can do what I need, so I did and I
have evidence, that the Python tarfile module
is not able to see all the files inside the TAR
archives created on Linux with TAR 1.14 .
The Python tarfile module stops to go through the
TAR archive somewhere already at the beginning,
like the other tools I have used, did.

I have no understanding what Cygwin, MinGW
(do I put MinGW in the right context?) are and do,
but I gave Cygwin a try and installed it selecting
also the tar package version 1.15 for installation.

I tried to run the tar.exe, but in the beginning it was
not able to do anything for me. I haven't given up
and after hours of trying to find the reason for this
I found that:
  the tar.exe seems to have no access to any files
  not inside the
   [%SystemDrive%\Cygwin\usr]
 directory on my system drive e: , where Cygwin is
 installed.
Is there a way to go around this, because I have
to uncompress a 17 GByte file and my system
drive has only 3 GByte of free storage space.
I have in mind, that it could have something to do
with the mount command, but this is all I can
remember. I work in a Windows command shell
(DOS-box) and mount says:
j: on /cygdrive/j , but I don't know how to write
the entire path
"j:\o\archives\images\dump.tar",
so that the file can be found by tar.exe and
unpacked to "i:\images" .
tar.exe --extract --directory=tmp -f j:/o/archives/images/dump.tar
results in:
/usr/bin/tar: j\:/o/archives/images/dump.tar: Cannot open: Input/Output
error
telling
tar.exe --extract --directory=tmp -f /cygdrive/j/o/archives/images/dump.tar
doesn't work either.

Claudio

"Martin v. Löwis" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
> > What TAR version is built into the tarfile module?
>
> None: the tarfile module is not built on top of
> GNU tar. Instead, it is a complete reimplementation.
>
> > Is there a TAR 1.14 or 1.15 port to Windows
> > available in Internet for download (which URL)?
>
> http://sources.redhat.com/cygwin/
>
> Regards,
> Martin




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

Version of TAR in tarfile module? TAR 1.14 or 1.15 port to Windows?

2005-08-19 Thread Claudio Grondi
I need to unpack on a Windows 2000 machine
some Wikipedia media .tar archives which are
compressed with TAR 1.14 (support for long file
names and maybe some other features) .
It seems, that Pythons tarfile module is able to list far
more files inside the archives than WinRAR or 7zip or
TotalCommander, but will it unpack all available files
(largest archive size 17 GByte)?

If tarfile is build on TAR 1.14 or TAR 1.15 it will be
probably ok, so my questions are:

What TAR version is built into the tarfile module?

Is there a TAR 1.14 or 1.15 port to Windows
available in Internet for download (which URL)?

Claudio



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


Re: Documentation bug: Python console behaviour changed

2005-07-20 Thread Claudio Grondi
>> 'Ctrl-Z' does not shut down the console but 'Ctrl-D' etc.
>> Usually means you have a readline package installed.
Right. Readline uninstalled, Ctrl-Z works again.

By the way:
After trying to take over readline support from Gary Bishop,
I have inbetween given up trying to fix readline behaviour on
international keyboards in Windows (mainly because the
Python 2.4 IDLE works for me best, so I don't need IPython
anymore).
I haven't digged very deep into it, but I mean, that the whole
code must be probably more or less entirely rewritten by
someone with experience in internationalization matters on
Windows (various keyboards and localized Windows
versions) and readline behaviour on *nix systems.
Up to now, there is noone known to me willing to support
the readline package - any volunteers?
Michele Simionato and me can then test the outcome on
German and Italian Windows systems and keyboards.

Claudio

"Tim Golden" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
[Lucas Raab]
| Peter Hansen wrote:
| > Kay Schluehr wrote:
| >
| >> The documentation of the Python console behaviour is not correct
| >> anymore for Python 2.4.1. At least for the Win2K system
| I'm working on
| >> 'Ctrl-Z' does not shut down the console but 'Ctrl-D' etc.
| >>
| >> The Python interpreter tells me instead:
| >>
| >>
| > quit
| >>
| >>
| >> 'Use Ctrl-Z plus Return to exit.'
| >>
| >> Nah, 'Ctrl-Z' is now undo :-)
| >
| >
| > Are you really using the console, started with the "Command
| Prompt" icon
| > from the Start Menu (or some equivalent)?  And are you sure
| you haven't
| > installed something else that magically changed the
| behaviour of Ctrl-Z?
| >
| > (I get the documented behaviour with Python 2.4.1, under Win XP.)
| >
| > -Peter
|
| I'm getting the same behavior as Kay.

Usually means you have a readline package installed:

I know that this one gives the effect described:

http://sourceforge.net/projects/uncpythontools/

Don't know about this one:

http://newcenturycomputers.net/projects/readline.html

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk



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


Re: Documentation bug: Python console behaviour changed

2005-07-19 Thread Claudio Grondi
"Lucas Raab" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Peter Hansen wrote:
> > Kay Schluehr wrote:
> >
> >> The documentation of the Python console behaviour is not correct
> >> anymore for Python 2.4.1. At least for the Win2K system I'm working on
> >> 'Ctrl-Z' does not shut down the console but 'Ctrl-D' etc.
> >>
> >> The Python interpreter tells me instead:
> >>
> >>
> > quit
> >>
> >>
> >> 'Use Ctrl-Z plus Return to exit.'
> >>
> >> Nah, 'Ctrl-Z' is now undo :-)
> >
> >
> > Are you really using the console, started with the "Command Prompt" icon
> > from the Start Menu (or some equivalent)?  And are you sure you haven't
> > installed something else that magically changed the behaviour of Ctrl-Z?
> >
> > (I get the documented behaviour with Python 2.4.1, under Win XP.)
> >
> > -Peter
>
> I'm getting the same behavior as Kay.
>
> -- 
> --
> Lucas Raab

I'm getting the same behaviour, too.
What is non-standard is, that I am using english
international keyboard on German version of
Windows 2000 Professional 5.0.2195 SP 4,
Build 2195.

Claudio


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


Re: Favorite non-python language trick?

2005-06-24 Thread Claudio Grondi
I supose it will be very, very hard to find a trick
which turns out useful in Python. The current
set of features is from my point of view very
well designed out of the experience with many
other languages, so maybe you can use Python
as reference telling you which tricks are really
useful in programming and which are just bad,
non-Pythonic style.

At least I am myself out of ideas, else I had
proposed a PEP already, to get it or have
provided a module for it.

So feel free to poke around with Python.

if(not \
"--[[" == "--[["):
  # block of code
# --]]
as (already suggested) will also do the
trick with the block comment.

By the way,   I personally find
--[[
 good style comment block
]]--
or
[[--
 good style comment block
--]]
much more intuitive than
--[[
 bad style comment block
--]]

Claudio


"Joseph Garvin" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Claudio Grondi wrote:
>
> >>And you can do block comments with --[[ and ---]].
> >>
> >>
> >
> >I am very happy not to have such "tricks" in Python.
> >
> >Any other (useful) suggestions?
> >
> >Claudio
> >
> >
> I'm glad and all that not everyone shares my enthusiasm over Lua's
> trick, and I'm glad that C/C++ can do it, but the original issue was
> non-python language tricks in general. Lets keep the thread on track.
>
> So far we've got lisp macros and a thousand response's to the lua trick.
> Anyone else have any actual non-python language tricks they like?
>
> Yeesh.
>
>
> >"Joseph Garvin" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> >news:[EMAIL PROTECTED]
> >
> >
> >>As someone who learned C first, when I came to Python everytime I read
> >>about a new feature it was like, "Whoa! I can do that?!" Slicing, dir(),
> >>getattr/setattr, the % operator, all of this was very different from C.
> >>
> >>I'm curious -- what is everyone's favorite trick from a non-python
> >>language? And -- why isn't it in Python?
> >>
> >>Here's my current candidate:
> >>
> >>So the other day I was looking at the language Lua. In Lua, you make a
> >>line a comment with two dashes:
> >>
> >>-- hey, this is a comment.
> >>
> >>And you can do block comments with --[[ and ---]].
> >>
> >>--[[
> >>hey
> >>this
> >>is
> >>a
> >>big
> >>comment
> >>--]]
> >>
> >>This syntax lets you do a nifty trick, where you can add or subtract a
> >>third dash to change whether or not code runs:
> >>
> >>--This code won't run because it's in a comment block
> >>--[[
> >>print(10)
> >>--]]
> >>
> >>--This code will, because the first two dashes make the rest a comment,
> >>breaking the block
> >>---[[
> >>print(10)
> >>--]]
> >>
> >>So you can change whether or not code is commented out just by adding a
> >>dash. This is much nicer than in C or Python having to get rid of """ or
> >>/* and */. Of course, the IDE can compensate. But it's still neat :)
> >>
> >>
> >
> >
> >
> >
>


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


Re: Favorite non-python language trick?

2005-06-24 Thread Claudio Grondi
> And you can do block comments with --[[ and ---]].

I am very happy not to have such "tricks" in Python.

Any other (useful) suggestions?

Claudio

"Joseph Garvin" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> As someone who learned C first, when I came to Python everytime I read
> about a new feature it was like, "Whoa! I can do that?!" Slicing, dir(),
> getattr/setattr, the % operator, all of this was very different from C.
>
> I'm curious -- what is everyone's favorite trick from a non-python
> language? And -- why isn't it in Python?
>
> Here's my current candidate:
>
> So the other day I was looking at the language Lua. In Lua, you make a
> line a comment with two dashes:
>
> -- hey, this is a comment.
>
> And you can do block comments with --[[ and ---]].
>
> --[[
> hey
> this
> is
> a
> big
> comment
> --]]
>
> This syntax lets you do a nifty trick, where you can add or subtract a
> third dash to change whether or not code runs:
>
> --This code won't run because it's in a comment block
> --[[
> print(10)
> --]]
>
> --This code will, because the first two dashes make the rest a comment,
> breaking the block
> ---[[
> print(10)
> --]]
>
> So you can change whether or not code is commented out just by adding a
> dash. This is much nicer than in C or Python having to get rid of """ or
> /* and */. Of course, the IDE can compensate. But it's still neat :)


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


Re: key - key pairs

2005-06-23 Thread Claudio Grondi
> is there in python a kind of dictionary that supports key - key pairs?
> I need a dictionary in which I can access a certain element using two
> different keys, both unique.
>
A Python dictionary needs a unique key, so a pair
of keys is still one unique key, but probably it is some
kind of misunderstanding here, because a dictionary
is not a database which needs a key to quickly find
an entry, so it can have as many keys as required.

What about two dictionaries where each has as a value
a key to the target dictionary with the actual values?

> For example:
>
> I've a dictionary with strings and times. Sometimes I have the string and
I
> want to have the time, other time I've the time and I want the string. It
> is important that one of the keys supports the min/max builtin function.
>From this example it seems, that what is needed is
a two-way dictionary. I don't know about a special
kind of dictionary for this, so maybe someone else
knows about such.
I can only recommend to use two dictionaries,
where the second one is created out of the first one,
so that they key, value pair is reversed.
If you need some code for the latter, let me know.

Claudio


"Florian Lindner" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hello,
> is there in python a kind of dictionary that supports key - key pairs?
> I need a dictionary in which I can access a certain element using two
> different keys, both unique.
>
> For example:
>
> I've a dictionary with strings and times. Sometimes I have the string and
I
> want to have the time, other time I've the time and I want the string. It
> is important that one of the keys supports the min/max builtin function.
>
> Thanks,
>
> Florian


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


Re: What is different with Python ?

2005-06-17 Thread Claudio Grondi
>> there is a 1% of people extremely interested in turning
>> on or off a pixel
I taught "adults" aged from 16 to 86 for some years
a course "Introduction to data processing", where I had
tried to teach the basics beginning with switching light
on and off. Having around twenty participants I
experienced from time to time one or two who found
it fascinating, so the 1% is in my eyes a good guess.

> 40x50. Probably nowdays unless you show them an antialiased
> texture mapped 3D floating torus with their name and
> face on it in live video they'll prefer exchanging
> stupid messages with the mobile phone instead.
The ability of making a video (I currently experience
a run towards "equipping" videos from camcorders
showing the involved teenager fighting using ordinary
sticks with StarWars laser sword effects) when equipped
with appropriate software tool is given now even to the
not gifted 99%. After the videos are done by the a little
bit smarter ones of the entire group, it doesn't whetting
the apetite for more programming skills - it creates
traffic on ICQ and Internet by exchanging the
videos and the opinions if they are cool or not.

> If it's about the time it will take to get a rotating
> 3d torus with live video on it I know for sure that most
> of the programmers I know that started from high level
> will probably *never* reach that point.
Many consider such skills as not worth to achieve,
looking for a solution to eventually raising problems
in a better computer hardware and new software
tools in case of timing problems.
Generally it appears to me, that it is true that many of
current teenagers look for authorities not for own experience
(this is nothing new) and that they perceive the world around
them through the window of the Internet browser not through
the window of the room (this is what makes the difference
compared to past time). But the current world they experience
is so different from what it was twenty years ago, that it
is today sure possible to start on a very high level and
stay there all the life never beeing able to go down to
the details without having therefore serious disadvantages
as a programmer. I experienced beeing very surprised
myself, that it is even possible to be hired as a programmer
having an IQ below the level of around 80.

I am personally biased towards trying to understand
anything as deep as possible and in the past was quite
certain, that one can not achieve good results
without a deep insight into the underlying details.
I have now to admit, that I was just wrong. From my
overall experience I infer, that it is not only possible
but has sometimes even better chances for success,
because one is not overloaded with the ballast of deep
understanding which can not only be useful but also
hinder from fast progress.

Claudio

"Andrea Griffini" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> On 17 Jun 2005 01:25:29 -0700, "Michele Simionato"
> <[EMAIL PROTECTED]> wrote:
>
> >I don't think anything significant changed in the percentages.
>
> Then why starting from
>
> print "Hello world"
>
> that can't be explained (to say better it can't be
> *really* understood) without introducing a huge
> amount of magic and not from a simple 8 bit CPU
> instead ? What are the pluses of the start-from-high-level
> approach ? If one is to avoid bordeom I don't agree
> as assembler is all but boring (when you start),
> or at least this was what *I* experienced.
>
> If it's about the time it will take to get a rotating
> 3d torus with live video on it I know for sure that most
> of the programmers I know that started from high level
> will probably *never* reach that point. Surely if
> you start say from pull-down menus they'll be able to
> do pull down menus. And IMO there are good chances
> they'll stay there lifetime.
>
> So is python the good first programming language ?
> IMO not at all if you wanna become a programmer; it
> hides too much and that hidden stuff will bite back
> badly. Unless you know what is behind python it will
> be almost impossible for you to remember and avoid
> all the traps. Buf if you need to know what is behind
> it then it's better to learn that stuff first, because
> it's more concrete and simpler from a logical point
> of view; the constructions are complex but (because)
> the bricks are simpler.
>
> But it probably all boils down to what is a programmer.
>
> Is C++ a good first programming language ?
>
> BWHAHAHAHAHAHAHAHA :D
>
> But apparently some guru I greatly respect thinks so
> (I'm not kidding, http://www.spellen.org/youcandoit/).
>
> Andrea


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


Re: What is different with Python ?

2005-06-17 Thread Claudio Grondi
> I always thought about our intellect being something "superior"
> to this world made of fragile bones and stinking flesh.
> However I realized that there's probably no real magic in
> it... knowing there are pills to make you happy is sort of
> shocking from a philosophical point of view :-)

Yes it is, but it doesn't mean, that this well known
insight has an effect on what people think about
themselves, the religion and the Universe.

For an example of what I try to say here, see the
"What Deep Blue showed was that chess is
not a game of true intelligence"
discussion thread in rec.games.chess.computer
and track what meaning people assign to
the concept of Artificial Intelligence since the term
was coined.
As long as a machine can't replicate itself and defend
its own existance, its intelligence will be questioned.
And even if such a machine can fight its enemies the
final answer to the question if "true intelligence" is
unique to humans can be only given in a fight, but
even then the evidence of existance of superior AI
can't be given, because only dead people are forced
to agree, but it doesn't matter to them anymore ...

Claudio


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


Re: What is different with Python ?

2005-06-16 Thread Claudio Grondi

>> "Also I think the fact that you think your were diteriating just goes to
>> show [...]"
 should be probably:
 "In my opinion the fact that you consider you were deteriorating just
  shows [...]"
but it can be understood as it is anyway, right?
Written maybe exactly as it is, with the only purpose:
  to encourage you, Andrea.

Claudio


"Jeffrey Maitland" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Well as for the communication skills dropping. I highly doubt that, if
> anything you are just picking up on things you never noticed before (and
> your communication skills far surpass the average person that writes
> anything in todays' society).
>
> A good example for me is that I am noticing that I seem to type the like
hte
> often, yes a spell checker picks it up but when writing code it's
sometimes
> not available.
>
> Also I think the fact that you think your were diteriating just goes to
show
> how dedicated you are to detail, and making sure you give the right advice
> or ask the right question.
>
> Jeff
>
>




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


Re: What is different with Python ?

2005-06-16 Thread Claudio Grondi
> My communication ability is dropping every day at

Probably no reason to worry. Reading your post I haven't
even noticed the unnecessary "not", because the message
was clear as intended even with it, anyway.
Should I start to be seriously in doubt about own
physiological problems only because overseeing
it? I think no.
I think also, that many people here would confirm,
that your posts are on a very high communication level
showing much insight.

> May indeed be I'm just *realizing* how low are my
> communication skills...
That's another story - moving to the next level of insight
is usually a pain, because one detects how "stupid"
one was before.

Claudio


<[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Andrea Griffini wrote:
>
> > That strings in python are immutable it's surely
> > just a detail, and it's implementation specific,
> > but this doesn't means it's not something you can
> > ignore for a while. If you use python this is a
> > *fundamental* property.
>
> My communication ability is dropping every day at
> an incredible rate (it's getting so bad I've been
> seriously in doubt about physiological problems).
> In the above phrase there is a "not" in excess; I
> meant to write
>
>   ... but this doesn't means it's something you can
>   ignore for a while. If you use python this ...
>
>
> May indeed be I'm just *realizing* how low are my
> communication skills...
>
> Andrea
>


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


Re: What is different with Python ?

2005-06-15 Thread Claudio Grondi

> Yes, both the sun and the moon have gravitational fields which affect
> tides.  But the moon's gravitational field is much stronger than the
sun's,
> so as a first-order approximation, we can ignore the sun.

Here we are experiencing further small lie which found its way
into a text written by an author probably not aware, that he is
creating it.
I have picked it out, not because I am so biased towards
the very detail, but because it is a good example of how hard
it is to discuss without creating small lies one after another.

The school books are filled with statements similar to the above
causing endless confusion and misunderstandings.

"the moon's gravitational field is much stronger than the sun's"
...
Sure it is the opposite, i.e. the gravitational field of the sun is
much stronger than that of the moon. What was intended to
state is probably, that the gravitational force caused by attraction
of the masses of earth and the sun applied to earth is lower
than the gravitational force caused by attraction of the masses
of earth and the moon (applied to earth).
I am sure, that if someone will analyse the statement above
deep enough he will find some more small lies originated
by the temptation to keep any statements short and simple
without giving a precise definition of all assumptions
required to be known in order to understand it right.

What leads to confusion is also the explanation that the water
of the oceans is attracted by the moon. It is only half of the
true. The another half is, that the moon is attracted by the
water of the oceans. It is very interesting, that in the minds
of many people the gravitational force acts only on one body.
Many think I am stupid, when I try to insist that the gravitational
force a human body exerts on earth is the same as that which
the earth exerts on a human body.
"the human body is so small, so the gravitational force it exerts
on earth can be neglected compared to the gravitational force
the earth exerts on the human body" is the explanation.

The problem of science is, that for communication of its findings
it has to use the same language which is used also for many other
purposes. The problem of text writers is, that it is so convienient
to use shortcuts to what one thinks, but has just forgotten to mention
before. It is also common to expresses own thoughts in an
inappropriate way because at the moment the right words are just
not there.

Hope this above has cleared away all what was clear before ;/)

What has it all to do with Python? To be not fully off-topic, I
suggest here,  that it is much easier to discuss programming
related matters (especially in case of Python :-) or mathematics
than any other subjects related to nature, because programming is
_so easy_ compared to what is going on in the "real world".
I see the reason for that in the fact, that programming is based
on ideas and rules developed by humans themselves, so it is
relatively easy to test and proove if statements are right or not.
Exception is when the source code is hidden like the rules
directing the behaviour of our Universe, what sure shouldn't be
interpreted, that people hiding source code behave more
like The Creator than others making it public  ;/)

Claudio


"Roy Smith" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>
> > Roy Smith wrote:
> > > Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> > >
> > > >High and low tides aren't caused by the moon.
> > >
> > >
> > > They're not???
> >
> > Nope. They are mostly caused by the continents. If the
> > Earth was completely covered by ocean, the difference
> > between high and low tide would be about 10-14 inches.
>
> Yeah, I know about all that stuff.  But, let's explore this from a
teaching
> point of view.
>
> > The true situation is that tides are caused by the
> > interaction of the gravitational fields of the sun, the
> > moon and the Earth, the rotation of the Earth, the
> > physical properties of water, its salinity, the depth,
> > shape and composition of the coast and shoreline, the
> > prevailing ocean currents, vibrationary modes of the
> > ocean (including up to 300 minor harmonics), ocean
> > storms, and even the wind.
>
> That's a lot of detail to absorb, and is appropriate for a college-level
> course taken by oceanography majors.  The key to teaching something is to
> strip away all the details and try to get down to one nugget of truth with
> which you can lay a foundation upon which further learning can happen.
>
> Yes, both the sun and the moon have gravitational fields which affect
> tides.  But the moon's gravitational field is much stronger than the
sun's,
> so as a first-order approximation, we can ignore the sun.
>
> And, yes, there's a huge amplifying effect caused by coastline shape and
> resonant frequencies of the ocean basins, but if you took away the moon
> (remember, we're ignoring the sun for now), there would be no tides at
all.
> If you took

Re: What is different with Python ?

2005-06-14 Thread Claudio Grondi
> > High and low tides aren't caused by the moon.
> They're not???

I suppose, that the trick here is to state,
that not the moon, but the earth rotation relative
to the moon causes it, so putting the moon at
cause is considered wrong, because its existance
alone were not the cause for high and low tides
in case both rotations were at synch. It is probably
a much more complicated thingy where also the
sun and maybe even the planets must be
considered if going into the details, but this is
another chapter.

I experienced once a girl who pointing me to the
visible straight beams from earth to sky one can see
as result of sunlight coming through the clouds
said: "look, along this visible beams the water from
the lake wents upwards and builds the clouds".
She was very convinced it's true, because she
learned it at school, so I had no chance to go the
details explaining, that there is no need for the
visible straight light beams coming through the
holes in the clouds for it.

I can imagine, that many believe that the
moon is orbiting each day around the earth
even if they know, that earth rotates around
its own axle and around the sun. Its not that
important for them to ask for details, so that
is the mechanism how the "lies" are born -
caused by lack of the necessity or the laziness
to achieve deeper understanding.

Claudio

"Roy Smith" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> > High and low tides aren't caused by the moon.
>
> They're not???


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


Re: What is different with Python ?

2005-06-12 Thread Claudio Grondi
> They're things that can be IMO genuinely accept
> as "obvious". Even "counting" is not the lowest
> level in mathematic... there is the mathematic
> philosohy direction.
I am personally highly interested in become
aware of the very bottom, the fundaments
all our knownledge is build on.
Trying to answer questions like:
What are the most basic ideas all other
are derived from in mathematics and
programming?
keeps me busy for hours, days, years ...

Any insights you can share with
me(and/or this group)?

Claudio



"Andrea Griffini" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> On Sun, 12 Jun 2005 20:22:28 -0400, Roy Smith <[EMAIL PROTECTED]> wrote:
>
> >How far down do you have to go?  What makes bytes of memory, data busses,
> >and CPUs the right level of abstraction?
>
> They're things that can be IMO genuinely accept
> as "obvious". Even "counting" is not the lowest
> level in mathematic... there is the mathematic
> philosohy direction. From "counting" you can go
> "up" in the construction direction (rationals,
> reals, functions, continuity and the whole
> analysis area) building on the counting concept
> or you can go "down" asking yourself what it
> does really mean counting, what do you mean
> with a "proof", what really is a "set".
> However the "counting" is naturally considered
> obvious for our minds and you can build the
> whole life without the need to look at lower
> levels and without getting bitten too badly for
> that simplification.
>
> Also lower than memory and data bus there is
> of course more stuff (in our universe looks
> like there is *always* more stuff no mattere
> where you look :-) ), but I would say it's
> more about electronic than computer science.
>
> >Why shouldn't first-year CS students study "how a computer works" at the
> >level of individual logic gates?  After all, if you don't know how gates
> >work, things like address bus decoders, ALUs, register files, and the
like
> >are all just magic (which you claim there is no room for).
>
> It's magic if I'm curious but you can't answer
> my questions. It's magic if I've to memorize
> because I'm not *allowed* to understand.
> It's not magic if I can (and naturally do) just
> ignore it because I can accept it. It's not
> magic if I don't have questions because it's
> for me "obvious" enough.
>
> >> Also concrete->abstract shows a clear path; starting
> >> in the middle and looking both up (to higher
> >> abstractions) and down (to the implementation
> >> details) is IMO much more confusing.
> >
> >At some point, you need to draw a line in the sand (so to speak) and say,
> >"I understand everything down to *here* and can do cool stuff with that
> >knowledge.  Below that, I'm willing to take on faith".  I suspect you
would
> >agree that's true, even if we don't agree just where the line should be
> >drawn.  You seem to feel that the level of abstraction exposed by a
> >language like C is the right level.  I'm not convinced you need to go
that
> >far down.  I'm certainly not convinced you need to start there.
>
> I think that if you don't understand memory,
> addresses and allocation and deallocation, or
> (roughly) how an hard disk works and what's
> the difference between hard disks and RAM then
> you're going to be a horrible programmer.
>
> There's no way you will remember what is O(n),
> what O(1) and what is O(log(n)) among containers
> unless you roughly understand how it works.
> If those are magic formulas you'll just forget
> them and you'll end up writing code that is
> thousands times slower than necessary.
>
> If you don't understand *why* "C" needs malloc
> then you'll forget about allocating objects.
>
> Andrea


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


Following the white rabbit (was "The Python Way")

2005-06-12 Thread Claudio Grondi
> Just follow the white rabbit.
This triggers in me the temptation to start
a thread asking:

What (in your opinion) can a good programmer
learn from watching all of the Matrix movies?
Which part, one, two or three deals most with
the philosophy of programming?

Claudio

"Jarek Zgoda" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Kalle Anke napisa³(a):
>
> > So, I'm looking for advice/information on:
> >
> > + How to write "proper" python code instead of
> >   Java/Perl/C/C++/Pascal/Modula-2/etc inspired code
>
> Just follow the white rabbit.
>
> Rewrite your code in Python, then optimize.
>
> -- 
> Jarek Zgoda
> http://jpa.berlios.de/ | http://www.zgodowie.org/


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

Re: What is different with Python ?

2005-06-11 Thread Claudio Grondi
> 4) Yes I agree a mix ("... well spiced soup ...")
> seems to be the answer but
> my brain somehow wants to formalize it.

Here one further suggestion trying to point out, that
it probably can't generally be formalized, because
the experience one developes after going through
the story of "assembly, basic, cobol, lisp,
JAVA, c, c++, perl, Tcl, Java, JavaCard" has
in my opinion a vital impact on shortcuts one uses
and the way of doing things. I mean, that the concept
of Python has raised from such experience, so anyone
who went through all this, will get the core ideas
implemented in Python without any effort, because
they were already there as a kind of meta-language
used in thinking, unconsciously looking for the
chance of beeing  expressed in formalized form
as a new programming language.
To support my thesis I can mention here, that
from my experience, Python seems not to be
the language of choice for the very beginners,
who prefere another approaches which are
mostly variants of Basic.

Claudio

"Philippe C. Martin" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Thanks ,
> I have gotten many answers already, some not posted.
>
> 1) Typing is not the issue - even with RT-Kernels, people use C++
> 2) Yes I find dynamic binding very nice
> 3) "... you didn't give many examples of what you did for the
> last 18 years (except that that also included RT kernels). " assembly
> (losts) , basic, cobol, lisp, JAVA, c, c++, perl, Tcl, Java, JavaCard
.
>
> I know the "interactive" aspect helps also, the runtime error/exception
> checking, the many libraries/tools, the responsiveness of the people on
> this newsgroup, the "introspectiveness" of the system, the cross-platform
> it deals with, the way it "pushes" people to code in a clean way, the GUI
> support, the stability, the extensibility (in and out)  I'm sure
you'll
> agree none of that can explain why after 1 week of playing with, I was
more
> productive in Python than C/C++ just as I know my product (I will not
> describe it here as I am not marketing) would not exist today were it not
> for Python.
> 4) Yes I agree a mix ("... well spiced soup ...") seems to be the answer
but
> my brain somehow wants to formalize it.
>
> Regards,
>
> Philippe
>
>
>
>
>
> Philippe C. Martin wrote:
>
> > I apologize in advance for launching this post but I might get
enlightment
> > somehow (PS: I am _very_ agnostic ;-).
> >
> > - 1) I do not consider my intelligence/education above average
> > - 2) I am very pragmatic
> > - 3) I usually move forward when I get the gut feeling I am correct
> > - 4) Most likely because of 1), I usually do not manage to fully explain
> > 3) when it comes true.
> > - 5) I have developed for many years (>18) in many different
environments,
> > languages, and O/S's (including realtime kernels) .
> >
> >
> > Yet for the first time I get (most) of my questions answered by a
language
> > I did not know 1 year ago.
> >
> > As I do try to understand concepts when I'm able to, I wish to try and
> > find out why Python seems different.
> >
> > Having followed this newsgroup for sometimes, I now have the gut feeling
> > (see 3)) other people have that feeling too.
> >
> >
> > Quid ?
> >
> > Regards,
> >
> > Philippe
>




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


<    1   2   3   4   >