Re: Python Print Error

2016-07-28 Thread Timothy
On Thu, 28 Jul 2016 10:40:28 -0700, Cai Gengyang wrote:
> How to debug this ?
> 
 print "This line will be printed."
> SyntaxError: Missing parentheses in call to 'print'

You are probably using Python 3, while the syntax is for Python 2.
Use print("This line will be printed.") instead.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Developing Commercial Applications in Python

2005-01-03 Thread Delaney, Timothy C (Timothy)
Christophe Cavalaria wrote:

> [EMAIL PROTECTED] wrote:
> 
>> Hello All,
>> I am trying to convince my client to use Python in his new product.
>> He is worried about the license issues. Can somebody there to point
>> me any good commercial applications developed using python ?. The
>> licence clearly says Python can be used for commercial applications.
>> Is there any other implications like that of GPL to make the source
>> open ? Thanks for any help. eeykay

> Troika games use Python in their games. It seems you can even get the
> source .py files for Vampires: Bloodlines :)

Absolutely - it's a slightly modified version of 2.1.2. Troika also used
Python for the Temple of Elemental Evil.

I even compiled psyco to work with Bloodlines and modified the .py
source to call it - worked perfectly well, but didn't give me any
significant performance improvement :( I'm CPU limited, so I thought it
was worth a try.

I'm wondering if I can hack Python 2.4 into Bloodlines ... the biggest
problem is that Bloodlines used .vpk files for packaging, and I believe
the major modifications to 2.1 are to allow these to be read. I've
already extracted all of these though ...

Anyway, back to the original question:
http://www.python.org/doc/faq/general.html#are-there-copyright-restricti
ons-on-the-use-of-python

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


RE: interpreter Py_Initialize/Py_Finalize mem leak?

2005-01-09 Thread Delaney, Timothy C (Timothy)
Roman Suzi wrote:

> In pure curiosity I tried to compile loop.c from Demo/embed
> and started it with 'print 2+2'. It seems, that both 2.3 and 2.4
> pythons have memory leaks in Py_Initialize/Py_Finalize calls.
> (That is, interpreter doesn't clean up well after itself).

What's your evidence for this (i.e. what are the symptoms)?

If you have a repeatable test case, please raise a bug report on
SourceForge.

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


RE: shutil.move has a mind of its own

2005-01-10 Thread Delaney, Timothy C (Timothy)
Daniel Bickett wrote:

> shutil.move( "C:\omg.txt" , "C:\folder\subdir" )
  ^  ^^ ^
The problem is that backslash is the escape character. In particular,
'\f' is a form feed.

>>> '\o'
'\\o'
>>> '\f'
'\x0c'
>>> '\s'
'\\s'

Notice how for '\o' and '\s' it doubles-up the backslash - this is
because '\o' and '\s' are not valid escapes, and so it treats the
backslash as just a backslash. But '\f' is a valid escape.

You have a couple of options:

1. Use double-backslashes (to escape the backslash):
   shutil.move("C:\\omg.txt", "C:\\folder\\subdir")

2. Use forward slashes (they work on Windows for the most part):
   shutil.move("C:/omg.txt", "C:/folder/subdir")

3. Build your paths using os.path.join (untested):
   shutil.move(os.path.join("C:", "omg.txt"), os.path.join("C:",
"folder", "subdir"))

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


RE: sorted (WAS: lambda)

2005-01-13 Thread Delaney, Timothy C (Timothy)
Terry Reedy wrote:

> No, not same difference.  A list method would only operate on lists,
> as is true of all list methods.  Being a function lets it work for
> any iterable, as is true of any function of iterable.  Big
> difference.  And consistent. One could argue though that it should
> have been put into itermethods module instead of builtins.

Definitely not. iter*tools* is primarily for functions that take
iterators and *return* iterators i.e. don't use memory proportional to
the length of the iterator.

OK - so there are one or two exceptions, but their presense there has
been strongly justified (and nowhere else seems appropriate - for
example, itertools.tee).

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


RE: generator expressions: performance anomaly?

2005-01-16 Thread Delaney, Timothy C (Timothy)
Raymond Hettinger wrote:

> Check out the current source.  The time machine beat you to it.

Nick's other suggestion - that genexps propagate __len__ - might still
be interesting. Of course, it would only be applicable for unconditional
genexps(i.e. no if clause).

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


RE: fefinining % of c'm'y and k

2005-01-16 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote:

> hello
> i need a program (and pleas shoe me the modol in the softwar) that :
> if i have a scaned photo
> i want to define out of each poligon color ,as it seems in the photo,
> the cmyk
> in % (percets) of the color/
> 4 exampl from poligon color orang defin the cmyk in %
> like that: (example)
> c: 30%
> m:56%
> y:78%
> k: 10%

This site will assist you greatly.
http://www.catb.org/~esr/faqs/smart-questions.html

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


RE: Distutils: blurring the file==module borders

2005-01-24 Thread Delaney, Timothy C (Timothy)
Frans Englich wrote:

> in ./foo/ I have an __init__.py and a handful of files named
> ClassA.py, ClassB.py, ClassC.py and so forth.
>
> import foo.ClassA
> 
> var = foo.ClassA.ClassA()
> 
> while I want to do var = foo.ClassA()
> 
> In other words, the result I want can be achieved by putting all code
> in __init__.py. The problem is that I would find it horrible to have
> all code in one file.

# __init__.py

from foo.ClassA import ClassA

That brings the class 'ClassA' into the namespace of module 'foo'
(replacing module 'ClassA' as a side effect - if you don't want that,
change some names).

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


RE: On benchmarks, heaps, priority queues

2005-01-26 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote:

> PQPython23 - the Lib implementation
> PQ0 - my insertion sort based variant
> PQueue - my "heap" based variant
> (like PQPython23, but different).

First of all, you should be running these benchmarks using Python 2.4.
heapq is considerably faster there ... (Raymond Hettinger rewrote it all
in C).

http://www.python.org/2.4/highlights.html

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


RE: Which is faster?

2005-01-26 Thread Delaney, Timothy C (Timothy)
Aggelos I. Orfanakos wrote:

> Any idea which of the following is faster?
> 
> 'a/b/c/'[:-1]
> 
> or
> 
> 'a/b/c/'.rstrip('/')
> 
> Thanks in advance.
> 
> P.S. I could time it but I thought of trying my luck here first, in
> case someone knows already, and of course the reason.

First, it almost certainly doesn't matter. Use the one that is
self-documenting.

Secondly, time it yourself. It's incredibly easy. There's a module
written especially for doing this - and surprise surprise, it's called
"timeit.py" and it's in the /Lib directory.

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


RE: Pystone benchmark: Win vs. Linux (again)

2005-01-30 Thread Delaney, Timothy C (Timothy)
Franco Fiorese wrote:

>   * Windows XP Pro:  16566.7 pystones/second
>   * Linux (kernel 2.6.9 NPTL): 12346.2 pystones/second

First of all, realise that pystone is not meant to be a general-purpose
benchmarking program. It test a specific, *small* subset of the
functionality available in Python. It's also not meant to be able to
compare across machines, etc. It's highly susceptible to cache effects
and various other things.

If you include parrotbench you will get a better view of things, but
it's also not designed for comparisons across machines.

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


RE: Next step after pychecker

2005-02-01 Thread Delaney, Timothy C (Timothy)
huy wrote:

> do not yet have good coverage. TDD is a quite hard to practice as a
> beginner. 

It's even harder to bolt onto an existing codebase :(

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


RE: Why does super() require the class as the first argument?

2005-02-06 Thread Delaney, Timothy C (Timothy)
Nick Coghlan wrote:

> It *is* possible to eliminate the explicit class argument, but it
> takes a bit (*cough*) of work:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286195

Nick - you stole my thunder ;)

Note that my recipe uses a sys._getframe() hack, so it will never be in
Python as it is. It's also considerably slower than just using super.
But it *does* eliminate the need for specifying the current class name,
and (if you wish) the current method name.

Guido has said that eventually he wants a simpler super() call - but he
doesn't really like my proposed syntax of having it hang off self.
Personally, I like it though and if there was enough community support
I'd write it up as a PEP using the recipe as a sample implementation
which demonstrates the required semantics. However, it hasn't gained
much community support so far ;)

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


RE: Alternative to standard C "for"

2005-02-06 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote:

> 2) for i in range(A, B, STEP):
>  ...do something...

Note that the most common use of this is something like:

t = 1, 2, 3

for i in range(len(t)):
print i, t[i]

This is best accomplished as:

t = 1, 2, 3

for i, e in enumerate(t):
print i, e

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


RE: strange behaviour with decorators.

2005-02-09 Thread Delaney, Timothy C (Timothy)
Antoon Pardon wrote:

> Ah, yes, the penny dropped. The try: except where there because
> originally there were other statements I wanted to test and I
> didn't want the raise exception by the inc(-2) stop the script.
> I completely forget to consider it would also catch the
> error I was expecting.

A very good example of why you should (almost) never use a bare except:
...

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


RE: [N00B] What's %?

2005-02-10 Thread Delaney, Timothy C (Timothy)
Harlin wrote:

> In the mode of anticipating another question... I get these all the
> time at work of all places! You'd think IT workers would know the
> answer to these...
> 
> What good is the modulus operator? What would I ever need it for?

# Print a summary every 100 rows
for i in range(1, 1001):
if i % 100 == 0:
print 'Summary: %s rows' % (i,)

There are two examples of using the modulo operator in the above - one
is using it in it's intended integer form, and the other is using it in
its overloaded string formatting form.

Note that the range is from 1 (inclusive) to 1001 (exclusive). If you
used the normal range(1000) you would get a summary on the first time
round the loop, and wouldn't get one for the last 99. Why is for you to
work out ;)

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


RE: custom classes in sets

2005-02-13 Thread Delaney, Timothy C (Timothy)
vegetax wrote:

>   def __hashcode__(s): return s.path.__hashcode__()

Try __hash__ ...

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


RE: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Delaney, Timothy C (Timothy)
Stephen Kellett wrote:

> In message <[EMAIL PROTECTED]>, Ilias Lazaridis
> <[EMAIL PROTECTED]> writes
>>>  And yet there is not one company that has someone devoted full-time
>>> to  developing Python. Not even Guido.
>> 
>> Who's "Guido"?
> 
> LOL Falling off my chair!!

See, the problem is that you have to go all the way to the second FAQ in
order to find out who Guido is. Obviously it needs to be more prominent
on the Python web site.

Oh - you mean Ilias didn't actually *read* anything on the Python web
site? My bad.

Illias - I'm assuming you are not a troll (despite the contrary
evidence) and am going to direct you to a site with all the answers you
need.

http://www.catb.org/~esr/faqs/smart-questions.html

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


RE: Inheritance error in python 2.3.4???

2005-02-14 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote:

> I guess I could just use one underscore but that means it is
> easier for other people to get at my implementation details (which,
> coming from a C++ background really bothers me).

This is the correct solution, and getting over being bothered about it
is the correct thing to do.

Getting at private members is simple in C++ too if anyone wants to do
that.

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


RE: Why doesn't join() call str() on its arguments?

2005-02-16 Thread Delaney, Timothy C (Timothy)
John Roth wrote:

> result = "".join([str(x) for x in list])

As of 2.4, you should use a generator expression here instead (unless
you require backwards-compatibility with 2.3).

result = ''.join(str(x) for x in iterable)

Easier to read, more memory-efficient, potentially faster (depending on
performance characteristics of building large lists).

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


RE: parameter name conflict. How to solve?

2005-03-07 Thread Delaney, Timothy C (Timothy)
Steven Bethard wrote:

>> If you ask: why do you choose these names? The answer is: they need
>> to be conformable with other functions, parameter names.

Is this a style guide thing?

>> I have a function that pretty much like:
>> 
>> def output(output=''):
>>   print output
>> 
>> and now in another function, I need to call output function, with
>> again keyword parameter output 
>> 
>> def func(output=''):
>>   output(output=output)

Why not just:

def func(output_param=''):
output(output=output_param)

?

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


RE: Default function arguments, KURL::cleanPath() -- a bindings bug?

2005-03-07 Thread Delaney, Timothy C (Timothy)
Frans Englich wrote:

> Apparently, cleanPath /requires/ a boolean argument, but the C++
> function definition says:
> 
>   void cleanPath(bool cleanDirSeparator = true);

Most likely that cleanPath's default parameter hasn't been declared to
*Python*. If so, I expect this is a KURL bug. Raise a bug report with
the KURL developers.

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


RE: Best way to make a list unique?

2005-03-08 Thread Delaney, Timothy C (Timothy)
Diez B. Roggisch wrote:

> No. But I doubt that that is what you actually want, as listA will
> lose its order afterwards. Typically, something like that gets
> written like this: 

This is actually one thing that Java 1.5 has that I'd like to see in
Python - the LinkedHashSet and LinkedHashMap. Very useful data
structures.

For those who don't know, these implement a hash set/map which iterates
in the order that the keys were first added to the set/map.

Such a data structure is fairly simple to implement, and removing
duplicates then becomes:

unique = list(linkedset(orig))

and you're guaranteed to maintain order.

Implementing these is fairly simple.

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


RE: parameter name conflict. How to solve?

2005-03-08 Thread Delaney, Timothy C (Timothy)
Bo Peng wrote:

>> Is this a style guide thing?
>> 
>> Why not just:
>> 
>> def func(output_param=''):
>> output(output=output_param)
>> 
> 
> This is exactly the problem. There are a bunch of other functions that
> use output='' parameter. Changing parameter name for this single
> function may cause confusion.

So why not rename the `output` function? Or alternatively, you could
change the parameter name for everything (not recommended).

I can assure you that when someone goes to maintain this code, having a
function go through all kinds of schenanigans to support what you want
to do will be much more confusing than a different parameter name.

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


RE: Best way to make a list unique?

2005-03-08 Thread Delaney, Timothy C (Timothy)
Steven Bethard wrote:

> Sounds like a good candidate for the collections module.  Of course
> someone will need to implement it. ;)

I'll suggest it to Raymond ... ;)

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


RE: Best way to make a list unique?

2005-03-08 Thread Delaney, Timothy C (Timothy)
Michael Hoffman wrote:

>>> For those who don't know, these implement a hash set/map which
>>> iterates in the order that the keys were first added to the set/map.
> 
> I would love to see such a thing.

I've proposed this on python-dev, but the general feeling so far is
against it. So far the only use case is to remove duplicates without
changing order, and there are iterator-based solutions which would
normally be preferable.

It's pretty simple to roll your own, and I'll probably put together a
Cookbook recipe for it.

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


RE: Conversion to string: how do `s work?

2005-03-14 Thread Delaney, Timothy C (Timothy)
Chris Lasher wrote:

> I'm working my way through _Learning_Python_ 2nd ed., and I saw
> something peculiar which is not explained anywhere in the text.
> 
> print " " + file + " size=" + `size`
> 
> The `s appear to somehow automagically convert the integer to a string
> for concatenation. How does this work? Is this just a shortcut for
> str(size)? Is it considered bad practice to use `s?

In addition to the fact that `` is repr() and generally shouldn't be
used, the above is much better written using string formatting:

print ' %s size=%u' % (file, size)

Shorter, cleaner, and more explicit.

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


RE: code for Computer Language Shootout

2005-03-16 Thread Delaney, Timothy C (Timothy)
Jacob Lee wrote:

>>  # alias methods to avoid repeated lookup
>>  join = ''.join

I would actually do the alias here sometimes, but give it a
semantically-useful name ...

nosep_join = ''.join

...

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


RE: decorators ?

2004-12-02 Thread Delaney, Timothy C (Timothy)
Michael Hudson wrote:

> Skip Montanaro <[EMAIL PROTECTED]> writes:
> 
>> Jacek> Anything you can do with decorators, you could do before
>> (with Jacek> the exception of rebinding the __name__ of
>> functions). 
>> 
>> And while that feature was added because we realized it would be
>> nice if the decorated function could have the same name as the
>> original function, it seems like that change could stand on its own
>> merits. 
> 
> Indeed.  I'd been meaning to do it for at least a year...

Ah - looking for any old excuse to get it in huh? 

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


RE: How is Python designed?

2004-12-02 Thread Delaney, Timothy C (Timothy)
Roy Smith wrote:

> As far as I can tell, the process works like this:
> 
> Guido has an idea for something he wants to do and announces it.
> 
> Everybody beats him up about it.
> 
> He goes ahead and does it anyway.
> 
> It's a strange process, but it seems to work.

It's not quite that straightforward. For example, sometimes we beat
someone else up as well.

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


RE: byte code generated under linux ==> bad magic number under windows

2004-12-06 Thread Delaney, Timothy C (Timothy)
Philippe C. Martin wrote:

> I understand from my reading that a .pyc generated by python anywhere
> should run anywhere else - is that true ?
> 
> If I generate 'compile.all' a pyc with python 2.3.3 under Linux, I
^
> get a 'bad magic number' trying to execute it under windows (2.4).
   ^^^
> are the pyc plateform dependant ? and if so must I generate one
> version for each version of Linux, windows .. ?

.pyc files are not platform dependent, but they are *version* dependent
- specifically, major version (i.e. 2.3, 2.4).

Between major versions, the bytecode can change. There were in fact some
significant changes between 2.3 and 2.4.

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


RE: need some help quickly

2004-12-14 Thread Delaney, Timothy C (Timothy)
Allan Irvine wrote:

> Hope you can help - any thoughts welcome

Here is the best place you can get help for your problem:
http://www.catb.org/~esr/faqs/smart-questions.html

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


RE: Python compiler method

2004-12-15 Thread Delaney, Timothy C (Timothy)
Lady_Valerie wrote:

> hello guys! i just want to ask favor, coz i want to know how python
> compiler method could be done? im really clueless of this programming
> language hope anyone coule help me with this topic... im just focusing
> only on the compiler of the python.thanks a lot!!!

This should get you some of the way:
http://www.catb.org/~esr/faqs/smart-questions.html

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


RE: [ANN] [Hack] Import binary extensions from zipfiles, windows only

2004-12-16 Thread Delaney, Timothy C (Timothy)
Thomas Heller wrote:

> zipextimporter.py contains the ZipExtImporter class which allows to
> load Python binary extension modules contained in a zip.archive,
> without unpacking them to the file system.

I take it this was what you were talking about the other day when you
mentioned single-file applications produced by py2exe ...

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


RE: [dictionary] how to get key by item

2004-12-14 Thread Delaney, Timothy C (Timothy)
Roy Smith wrote:

>> >>> forward = {10 : 50, 2 : 12, 4 : 43}
>> >>> reverse = dict([(v,k) for (k,v) in forward.iteritems()])
>> >>> print forward {10: 50, 4: 43, 2: 12}
>> >>> print reverse
>> {50: 10, 43: 4, 12: 2}
> 
> BTW, does Python really build the intermediate list and throw it away
> after using it to initialize the dictionary, or is it smart enough to
> know that it doesn't really need to build the whole list in memory?

Python will do what you tell it. In the above case, it will build a
list.

Using Python 2.4, the above can be rewritten as a generator expression:

>>> forward = {10 : 50, 2 : 12, 4 : 43}
>>> reverse = dict((v,k) for (k,v) in forward.iteritems())
>>> print forward {10: 50, 4: 43, 2: 12}
>>> print reverse
{50: 10, 43: 4, 12: 2}

which does not build an intermediate list. Note that all I've done is
remove the [ and ] - that's because a genexp must be surrounded by
parentheses, but *any* parentheses will do - for example, the
parentheses surrounding the parameters in a function call.

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


RE: printing anomaly

2005-03-20 Thread Delaney, Timothy C (Timothy)
Paul Rubin wrote:

> What's the deal with this?
> 
> >>> print 3.2
> 3.2
> >>> print [3.2]
> [3.2002]
> >>>
> 
> Yes, I know that 3.2 isn't an exact binary fraction.  I'm wondering
> why it's converted differently depending on whether it's in a list.

`print 3.2` == `print str(3.2)`.
`print [3.2]` == `print str([3.2])`.

list.str calls repr() on all elements. Partly, this is so that:

>>> print [3.2]
>>> print ['3.2']

don't have the same output. Otherwise, how could you tell (visually) if
an element was a string or a float (or integer, or whatever)?

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


RE: Set literals

2005-03-21 Thread Delaney, Timothy C (Timothy)
George Sakkis wrote:

> How about overloading curly braces for set literals, as in
> 
 aSet = {1,2,3}
> 
> - It is the standard mathematic set notation.
> - There is no ambiguity or backwards compatibility problem.
> - Sets and dicts are in many respects similar data structures, so why
> not share the same delimiter ? 

This was the proposed syntax (with {-} being the empty set - there's the
ambiguity). The issue may be revisited for Python 3K, but for now there
will not be syntax support for sets.

Read the section on 'Set Notation' in:
http://www.python.org/peps/pep-0218.html

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


RE: Help me to sort.

2005-03-23 Thread Delaney, Timothy C (Timothy)
BMS wrote:

> I'll apreciate if you can guide me how to sort in Python. I'm doing a
> list and I want to sort it in ascending or descending order. 
> 
> Please send me some examples.

Everything you need is right here:
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.python.org/doc/

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


RE: The Running Time of += on Char Strings ?

2005-03-28 Thread Delaney, Timothy C (Timothy)
MyHaz wrote:

> ''.join(['Thank ','you])
   ^^ Syntax error ...

Probably better as:

' '.join(['Thank', 'you'])

;)

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


RE: __getslice__ passed INT_MAX rather than sys.maxint for missingendpoint?

2005-03-28 Thread Delaney, Timothy C (Timothy)
Dave Huang wrote:

> Hi, I don't actually know Python; I'm just trying to debug a problem
> I encounted in another program, so apologies if this has been
> covered before. I did do some Google searches though, and didn't
> find anything that specifically addressed this :)
> 
> According to the documentation at
> , __getslice__
> is passed sys.maxint for a missing endpoint (foo[i:]). However, as
> far as I can tell, it's actually passing INT_MAX. I'm running Python
> 2.4 on an Alpha running NetBSD 2.0, an LP64 platform, so the two
> aren't the same. INT_MAX is 2^32-1, whereas sys.maxint is LONG_MAX:
> 2^64-1.
> 
> So, am I misunderstanding things, or is this a doc bug, or a code bug?

It sounds like a code bug to me - raise it at:
http://sourceforge.net/tracker/?group_id=5470&atid=105470

> FWIW, the problem I encountered was some code that did something like:
> def __getslice__(self, a, b):
> if b == maxint:
> b = self.length  # this never got executed, causing

I presume that's actually:

if b == sys.maxint:

Anyway, the quick fix for this is:

def __getslice__(self, a, b):
b = min(b, len(self.length))

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


RE: mod_python

2005-03-29 Thread Delaney, Timothy C (Timothy)
onur2029 wrote:

>I need mod_python resources,documentation or ebook.But not manual
> from modpython.org.I'm waiting for your links.

http://www.catb.org/~esr/faqs/smart-questions.html

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


RE: string goes away

2005-03-31 Thread Delaney, Timothy C (Timothy)
Andreas Beyer wrote:

> Yeeh, I was expecting something like that. The only reason to use
> map() at all is for improving the performance.
> That is lost when using list comprehensions (as far as I know). So,
> this is *no* option for larger jobs.

Try it and see. You'll probably be pleasantly surprised.

Note that you can use `str.upper` in map ...

/usr/bin> C:/Python24/python.exe -m timeit -s "strings = ['a']*1000"
"map(str.upper, strings)"
1000 loops, best of 3: 304 usec per loop

/usr/bin> C:/Python24/python.exe -m timeit -s "strings = ['a']*1000"
"[s.upper() for s in strings]"
1000 loops, best of 3: 331 usec per loop

Pretty damn close.

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


RE: the bugs that try men's souls

2005-04-06 Thread Delaney, Timothy C (Timothy)
Jordan Rastrick wrote:

> I had a doozy myself the other night, writing a mergesort for python's
> deque class (I can't believe it doesnt come with one!)

Post it to the Cookbook ... ;)

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


RE: Compiling extensions

2005-04-06 Thread Delaney, Timothy C (Timothy)
ake wrote:

> I would like to compile extensions usig distutils. is there a way to
> set which compiler to use ?
> 
> I am using windows and VC++ 7.1 comp.

python setup.py --help
python setup.py build --help

However, if you're using an installed version of VC++ 7.1 you shouldn't
need to set the compiler.

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


RE: problem in the compiler ?

2005-05-02 Thread Delaney, Timothy C (Timothy)
Glauco Silva wrote:

> when i creat a RadioButton and put a command = self.Function , this
> function is called in the creation of RadioButton. It´s right this or
> it´s wrong ? 

http://www.catb.org/~esr/faqs/smart-questions.html

I'm pretty sure I can guess exactly what the problem is. I suspect your code 
looks somewhat like:

btn = RadioButton(command=self.Function())

Follow the instructions in the above link and you should be able to work out 
why this is wrong.

If I've failed to read your mind correctly, the above link should also teach 
you how to make it easier for me to do so.

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


RE: problem in the compiler ?

2005-05-03 Thread Delaney, Timothy C (Timothy)
Glauco Silva wrote:

> My code is like this:
> 
> MyClass()
> 
> class MyClass:
>  def __init__(self):
>  btn = RadioButton(command=self.Function)
>  def Function(self):
>  print "Enter in the function"
> 
> When a do this, the function 'Function' is call. And i don´t want
> this. What´s wrong ?

Are you absolutely sure this is the exact code? As it is this will not work - 
it will fail with a NameError.

You need to post a working piece of code that exhibits the behaviour, and 
include the exact error message (if any).

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


RE: problem in the compiler ?

2005-05-04 Thread Delaney, Timothy C (Timothy)
Glauco Silva wrote:

> I´m sorry, I feel I didn't comunicate very well .
> The program I am writing is a part of a big project, so it would be
> no use to post it here as it involves many other things and concepts.

We wouldn't want the whole thing - that would be useless. What you need to do 
is trim it down to the smallest piece of code that causes the problem. Normally 
doing this reveals the actual problem, and you don't need to go to the 
newsgroup.

> But i solve my problem and don´t have bug. My code was wrong.

Excellent. You should now post your solution to the newsgroup.

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


RE: Ask for a tool to protect my .pyc file :)

2005-05-08 Thread Delaney, Timothy C (Timothy)
Lily Kakm wrote:

> when I distribute my software, I will give the users .pyc file (maybe
> I can use py2exe, but I think there's no essential different),
> because I don't like them to know my source code.

Leaving aside all other arguments of whether or not you should allow
your users to see your source code ...

The simplest method to compile python is to use Pyrex:
http://www.google.com.au/search?q=pyrex&btnI

It's almost-compatible syntax-wise with Python 2.2 (no augmented
assignment, no nesting classes, and classmethods don't appear to work -
probably static methods too).

Then you just have a single script which calls your first main module,
and everything else is in a shared library (.so, .pyd).

It's quite nice to be able to have identical source, copy the source
tree, rename files appropriately and be able to build using Pyrex (with
an appropriate setup.py).

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


RE: bad argument type for built-in operation

2005-05-10 Thread Delaney, Timothy C (Timothy)
Florian Lindner wrote:

> Traceback (most recent call last):
>   File "visualizer.py", line 8, in ?
> main()
>   File "visualizer.py", line 5, in main
> g = GraphCreator(f)
>   File "/home/florian/visualizer/GraphCreator.py", line 13, in
> __init__ self.conf = ConfigReader(config)
>   File "/home/florian/visualizer/ConfigReader.py", line 53, in
> __init__ graph.sourceReader = CSVReader(filename, firstline,
>   delimiter) File "/home/florian/visualizer/ConfigReader.py", line
> 13, in __init__ self.reader = csv.reader(f, delimiter=Adelimiter)
> TypeError: bad argument type for built-in operation
> 
> f ist file object, Adelimiter is ",".
> 
> What is wrong there?

Lack of code. I'd start looking very carefully as to whether `f` really
is a file object.

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


RE: Need a little parse help

2005-05-10 Thread Delaney, Timothy C (Timothy)
Peter Hansen wrote:

> In my opinion, if the code fits on one screen and just reads stuff
> from one file and, maybe, writes to another, you can safely and with
^^
> clean conscience ignore Mike's advice (but remember it for later!).

Remember, finalisers are not called when Python exits. So if you don't
explicitly close the file you are *writing* to, it may not be flushed
before being closed (by the OS because the process no longer exists).

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


RE: Need a little parse help

2005-05-11 Thread Delaney, Timothy C (Timothy)
Fredrik Lundh wrote:

> that's probably because finalizers *are* called when Python exits.

D'oh! Old semantics? I'm sure I remember this used to not work at some
point, and not just in Jython.

My apologies to anyone who I led astray. Still ... better to be too
careful ;) I've been trying to find the declared semantics (without
looking at the source for now) but it's proving elusive ...

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


RE: Property,how to use it?

2005-05-15 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote:

> What is the "property" mean in the python? Who can explain it
> for me? I don't know how to use it.

http://www.catb.org/~esr/faqs/smart-questions.html

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


RE: The world is really unstable these days......

2005-05-15 Thread Delaney, Timothy C (Timothy)
Peter Hansen wrote:

> Lucas Raab wrote:
>> 
> [...]
>> Y'know, I really do love these random word spam messages. They're
>> quite entertaining to read.
> 
> Although, when posting in reply to them it apparently helps those who
> read this through the mailing list, and who have Bayesian filtering of
> spam happening, if you would snip the entire content.
> 
> Otherwise it can confuse the spam blockers since they have your name
> generally associated with useful messages (I presume ;-) )  instead of
> with spam.  You're messin' with their statistics, man!  ;-)

Absolutely. Another example of where these things can mess with
Spambayes is people replying to XL and correcting his horrendous
troll-posts. It makes it really hard for Spambayes to determine that
*anything* coming from XL is spam.

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


RE: speeding up Python script

2005-05-18 Thread Delaney, Timothy C (Timothy)
James Carroll wrote:

> It looks like your algorithm really does iterate over all values for
> six variables and do lots of math.. then you can't do any better than
> implementing the inner loop in C.

Or Pyrex ...
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/

For this type of situation, Pyrex is pretty much perfect. You can write
your algorithm in Python, get it right, then optimise it with static
typing, C variables, etc as required. You don't even need to change your
test suite because you build a Python extension module.

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


RE: Is Python suitable for a huge, enterprise size app?

2005-05-18 Thread Delaney, Timothy C (Timothy)
Ivan Van Laningham wrote:

> What you're going to run into are two major stumbling blocks.  One,
> Python's got no credibility with management types unless the
> credibility's already there.  "Python?  Never heard of it.  Tell me
> about it.  ...   Oh, it's interpreted, is it?  Interesting."  You can
> see Python going down the sewer pipes, right on their faces.  Two,
> security.  "This python sounds pretty interesting.  Tell me about the
> security.  How can we prevent people from stealing our source code,
> which we just spent millions developing?  ...  Hmm, trust the
> developers out there not to peek?  Oh, sure, let's use it."  (True,
> there are ways around the second, but you're going to have to talk
> _very_ fast and have ALL the answers before the management type gets
> to his/her office and shuts the door in your face and on your idea.)

There is a good answer to both of these ... Pyrex (second time I've
recommended it today :)

http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/

I recently had a situation here at work where a utility written in
Python needed to start going out to customers. The simplest solution was
to use Pyrex to create extension modules from the Python files. With
very minimal changes and an appropriate build script, everything worked.

The disadvantages are that for the Pyrex files you are limited to a
subset of Python features - in particular, things like list
comprehensions, generators, etc don't work. OTOH, it's very easy to put
that type of thing in a Python module and call it from a Pyrex module. A
mixture of Python and Pyrex is about the best of both worlds (esp. if
you add psyco to the mix).

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


RE: For review: PEP 343: Anonymous Block Redux and GeneratorEnhancements

2005-06-05 Thread Delaney, Timothy C (Timothy)
Nicolas Fleury wrote:

> def getFirstLine(filename):
>  with opening(filename) as file
>  return file.readline()

Your tastes definitely disagree with the majority of Python programmers
then, including Guido. Scoping is defined in Python by indentation.

If you want the above sort of thing, you're going to have to write a new
PEP, and I'd be very surprised to see it accepted. But there's nothing
stopping you from doing so.

> def getFirstLine(filename):
>  with opening(filename) as file:
>  return file.readline()

This is beautiful and explicit. What else could you want?

The syntax:

with EXPR1 as VAR1, EXPR2 as VAR2:
...

was discussed on python-dev. It wasn't explicitly rejected, but the
feeling seemed to be that it was an unnecessary complication as far as
PEP 343 is concerned. There's nothing stopping another PEP proposing
this as an extension to PEP 343, and there's nothing stopping that being
in Python 2.5 if it's accepted.

PEP 343 was originally PEP 340 (and several other things) and was quite
complicated at one point (it originally contained PEP 342 as well). The
PEP in its current state represents 2 months of discussion, complication
and (finally) simplification. Its semantics are clear and unambiguous.
And (as Guido states) it will obsolete 4(?) other PEPs.

Be sure to read the referenced PEPs (and the ones referenced from them)
- they contain a lot of history. Also read PEP 346 for a competing PEP
to PEPs 340 and 343 that gradually converged to PEP 343 - most
importantly, it contains the rejected options (that seem to have been
lost from PEPs 340 and 343).

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


RE: Controlling a generator the pythonic way

2005-06-12 Thread Delaney, Timothy C (Timothy)
Thomas Lotze wrote:

> call. The picture might fit better (IMO) if it didn't look so much
> like working around the fact that the next() call can't take
> parameters for some technical reason. 

You might want to take a look at PEP 342
. Doesn't help you now, but it
will in the future.

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


RE: Controlling a generator the pythonic way

2005-06-13 Thread Delaney, Timothy C (Timothy)
Steve Holden wrote:

> Sigh indeed. But if you allow next() calls to take arguments you are
> effectively arguing for the introduction of full coroutines into the
> language, and I suspect there would be pretty limited support for
> that. 

You mean `PEP 342`_ which I posted earlier and is considered pretty
non-controversial?

I think I may suggest that the name of the PEP be changed to "Coroutines
using advanced iterators".

.. _`PEP 342`: http://www.python.org/peps/pep-0342.html

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


RE: Controlling a generator the pythonic way

2005-06-13 Thread Delaney, Timothy C (Timothy)
FWIW, PEP 342 is now titled "Coroutines via Enhanced Iterators" :)

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


RE: Python in Games (was RE: [Stackless] Python in Games)

2005-06-14 Thread Delaney, Timothy C (Timothy)
Dave LeCompte (really) wrote:

>> Who is using Python in games
>> 
>> Python has been used in a number of games, including
>> 
>>* ToonTown - http://www.toontown.com/
>>* EveOnline - http://www.eve-online.com/
>>* Blade of Darkness - http://www.codemastersusa.com/blade/

Add to that:

- `The Temple of Elemental Evil`__
- `Vampire: The Masquerade: Bloodlines`__

.. __: http://www.troikagames.com/toee.htm
.. __: http://www.vampirebloodlines.com/

Moved to python-list because it's gone beyond Stackless :)

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


RE: Python in Games (was RE: [Stackless] Python in Games)

2005-06-14 Thread Delaney, Timothy C (Timothy)
Irmen de Jong wrote:

> Also, alledgedly the new BattleField II uses Python in a way...
> because I heard that you had to comment out a certain line
> in a certain .py file to remove the time limit of the demo :-)

Silly silly people - they should have at least had the launcher and that
part in Pyrex ;)

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


trying to unsubscribe

2012-10-02 Thread timothy holmes
My efforts at trying to unsubscribe are not working. Could you help me with
this, or take this email as a request to unsubscribe.
Thanks,
Timothy Holmes
-- 
http://mail.python.org/mailman/listinfo/python-list


Site Packages Folder Red on Clean Install

2019-12-10 Thread Timothy Coca
Hello,

I have a new dell XPS, I freshly installed the latest version of
Pythong (3.8.0) and pycharm. Pycharm shows the site packages folder as red,
and I can not import and modules from inside of it. Pip install works to
install some programs like numpy, scipy, but would not install matplotlib
successfully.

Even though Pip installed numpy successfully to the Sitpackages folder, I
can not import or use it. Any advice?

Note: Upon purchase I did replace the hard drive and ram, and reinstall
windows. It all runs fine, but if you suspect that can be related please
let me know.

Any advice on how to resolve this would be appreciated. I've seen forum
posts where others had the same issue but no ressolutions.

I am trying installing a previous version of Python to see if it works.

Thanks,

Tim Coca
-- 
https://mail.python.org/mailman/listinfo/python-list


catching all tracebacks

2005-10-05 Thread Timothy Smith
iw ant to use a singel try except statment with my main app loop in the 
middle and catch all tracebacks and email them to myself as a bug 
report. however it seems a little more tricky then i thought

try:
Main.Main()
except Exception, err_o:
print err_o.__class__.__name__, '//', err_o, '//', err_o.args

that was suggested to me however it doesn't catch the errors i made in 
the program, it just spits out a traceback.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: catching all tracebacks

2005-10-05 Thread Timothy Smith
Timothy Smith wrote:

>iw ant to use a singel try except statment with my main app loop in the 
>middle and catch all tracebacks and email them to myself as a bug 
>report. however it seems a little more tricky then i thought
>
>try:
>Main.Main()
>except Exception, err_o:
>print err_o.__class__.__name__, '//', err_o, '//', err_o.args
>
>that was suggested to me however it doesn't catch the errors i made in 
>the program, it just spits out a traceback.
>  
>
never mind it works now.
-- 
http://mail.python.org/mailman/listinfo/python-list


non descriptive error

2005-10-06 Thread Timothy Smith
i try to run my app and i get this

%python DutyShift.py
error


thats it. thats the error. mya pp was previously working, and i did make 
some fairly large changes to it, but i'd expect a more descriptive 
message then just "error". anyidea where i need to start looking?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: non descriptive error

2005-10-09 Thread Timothy Smith
Terry Hancock wrote:

>On Thursday 06 October 2005 11:57 pm, Timothy Smith wrote:
>  
>
>>i try to run my app and i get this
>>
>>%python DutyShift.py
>>error
>>
>>thats it. thats the error. mya pp was previously working, and i did make 
>>some fairly large changes to it, but i'd expect a more descriptive 
>>message then just "error". anyidea where i need to start looking?
>>
>>
>
>By looking at the source code for DutyShift.py?
>
>  
>
well DUH thank you captain obvious! i ment what KIND of code error would 
make it flip out like that.
FAYI i have already found it and it was a wrongly indented code block :/

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


Re: non descriptive error

2005-10-09 Thread Timothy Smith
i have reproduced the error in this code block

#save values in edit
self.FinaliseTill.SaveEditControlValue()
if 
Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalance']))
 
== Decimal('0'):
#box must be checked before continuing
if self.PlacedInSafe.GetValue() != 1:
self.parent.Popup("You must place the till draw 
back in the 
safe","Till draw")
else:
#finalise the till draw
if  
Decimal(self.TillFloat.GetLabel().split('$')[1]) != Decimal('0'):
Prompt = wx.MessageDialog(self,"""The 
correct amount has not been 
returned from the till draw float to the main float!
If you proceed please contact your 
manager""","Change tin doesn't 
balance!",wx.YES_NO)
if Prompt.ShowModal() == wx.ID_YES:
self.Submit()
else:
self.parent.Popup('You have an outstanding change tin 
balance on this 
till','Change tin')


i have NO idea what in there could be making it have such a strange 
error. it just says "error" when you try run it. there nothing terribly 
strange being done.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: non descriptive error

2005-10-09 Thread Timothy Smith
Timothy Smith wrote:

>i have reproduced the error in this code block
>
>#save values in edit
>   self.FinaliseTill.SaveEditControlValue()
>   if 
>Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalance']))
> 
>== Decimal('0'):
>   #box must be checked before continuing
>   if self.PlacedInSafe.GetValue() != 1:
>   self.parent.Popup("You must place the till draw 
> back in the 
>safe","Till draw")
>   else:
>   #finalise the till draw
>   if  
> Decimal(self.TillFloat.GetLabel().split('$')[1]) != Decimal('0'):
>   Prompt = wx.MessageDialog(self,"""The 
> correct amount has not been 
>returned from the till draw float to the main float!
>   If you proceed please contact your 
> manager""","Change tin doesn't 
>balance!",wx.YES_NO)
>   if Prompt.ShowModal() == wx.ID_YES:
>   self.Submit()
>   else:
>   self.parent.Popup('You have an outstanding change tin 
> balance on this 
>till','Change tin')
>
>
>i have NO idea what in there could be making it have such a strange 
>error. it just says "error" when you try run it. there nothing terribly 
>strange being done.
>  
>
FYI i have located where the problem was. in the first if statement
there was an unbalanced ). now since when does python not give a
descriptive error for that?

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


Re: non descriptive error

2005-10-09 Thread Timothy Smith
[EMAIL PROTECTED] wrote:

>On Mon, Oct 10, 2005 at 09:12:13AM +1000, Timothy Smith wrote:
>  
>
>>FAYI i have already found it and it was a wrongly indented code block :/
>>
>>
>
>When indentation leaves an illegal program structure, Python gives a very
>informative error message, such as
>
>  File "/tmp/x.py", line 3
>return 3
>   ^
>IndentationError: unindent does not match any outer indentation level
>
>Jeff
>  
>
not in my first case it didn't. i simply tabbed an incorrect block in 
and it worked. i should have saved it to show you
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: non descriptive error

2005-10-09 Thread Timothy Smith
Neil Hodgson wrote:

>Timothy Smith:
>
>  
>
>>FYI i have located where the problem was. in the first if statement
>>there was an unbalanced ). now since when does python not give a
>>descriptive error for that?
>>
>>
>
>I see this with the arrow pointing at the extra ')':
>
> >pythonw -u "xx.py"
>   File "xx.py", line 3
> if 
>Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalance']))
> 
>== Decimal('0'):
> 
>  ^
>SyntaxError: invalid syntax
>
>Neil
>  
>
it is definately a bug in 2.3 when using the decimal module. i can 
reproduce it.

from decimal import Decimal
a = Decimal('0'

and when you attempt to run it you will get "error"

of course i do understand that decimal wasn't part of 2.3, but atleast 
now when if anyone gets that terse message they know where to start 
looking :)


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


Re: non descriptive error

2005-10-11 Thread Timothy Smith
Fredrik Lundh wrote:

>Timothy Smith wrote:
>  
>
>>i have reproduced the error in this code block
>>
>>#save values in edit
>>self.FinaliseTill.SaveEditControlValue()
>>if
>>Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalance']))
>>== Decimal('0'):
>>#box must be checked before continuing
>>if self.PlacedInSafe.GetValue() != 1:
>>self.parent.Popup("You must place the till draw back in the
>>safe","Till draw")
>>else:
>>#finalise the till draw
>>if Decimal(self.TillFloat.GetLabel().split('$')[1]) != Decimal('0'):
>>Prompt = wx.MessageDialog(self,"""The correct amount has not been
>>returned from the till draw float to the main float!
>>If you proceed please contact your manager""","Change tin doesn't
>>balance!",wx.YES_NO)
>>if Prompt.ShowModal() == wx.ID_YES:
>>self.Submit()
>>else:
>>self.parent.Popup('You have an outstanding change tin balance on this
>>till','Change tin')
>>
>>i have NO idea what in there could be making it have such a strange
>>error. it just says "error" when you try run it. there nothing terribly
>>strange being done.
>>
>>
>
>the snippet you posted gives
>
>$ python script.py
>  File "script.py", line 2
>self.FinaliseTill.SaveEditControlValue()
>^
>SyntaxError: invalid syntax
>
>on my python 2.3 install.
>
>are you sure you don't have some weird sitecustomize file on your
>machine?  (more likely, it's a wxPython issue.  can you reproduce
>this without using wxPython ?)
>
>
>
>
>
>  
>
i am still coming across this error it's driving me nuts. usually i can 
find what's wrong, but it is becoming an increasingly annoying problem. 
i also get the same problem on a windows machine with the same 
installed. this time it's nothing to do with the decimal module. help!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python obfuscation

2005-11-10 Thread Timothy Smith

> Reliability is
>important but so is protecting your code in an effective manner
>  
>
there is no way to prevent people disassembling your code compiled or 
otherwise. once you give then the program they can easily take it apart. 
no if's, no but's; do NOT rely on binary's for security.

>
>the big software companies might say 'trusted computing will save us'
>but I for one will never truly trust it.
>  
>
trusted computing it about your computer not trusting YOU. the computer 
you pay for will decied based on some other company's whim's what you 
are and are not allowed to do.

>Perhaps a comprehensive protection for interpreted languages can never
>be built because of their high level nature?
>  
>
i repeat. there is no such thing as protected code. i've seen people de 
construct exe's written in C.

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


Re: an intriguing wifi http server mystery...please help

2005-11-30 Thread Timothy Smith
Paul McNett wrote:

>[EMAIL PROTECTED] wrote:
>  
>
>>1)
>>Laptop wired, client
>>Desktop wired, server
>>GREAT!
>>webpage served in 2 seconds
>>
>>2)
>>Laptop wired, server
>>Deskop wired, client
>>GREAT!
>>webpage served in 2 seconds
>>
>>3)
>>Laptop wireless, client
>>Desktop wireless, server
>>GREAT!
>>webpage served in 2 seconds
>>
>>4)
>>Laptop wireless, server
>>Desktop wireless, client
>>CRAP!
>>webpage served in 90 seconds
>>
>>
>>What the heck is happening?
>>
>>
>
>Please post your routing tables and, if you are referencing your server 
>machine 
>by name, your name server addresses (/etc/resolv.conf on Linux).
>
>
>  
>
i'm inclined to agree, your client and server might be taking totally 
different routes to get to each other and hence the 90ms
-- 
http://mail.python.org/mailman/listinfo/python-list


how to print unicode structures?

2005-01-17 Thread Timothy Babytch
Imagine you have some list that looks like
('unicode', 'not-acii', 'russian') and contains characters not from 
acsii. or list of dicts, or dict of dicts.

how can I print it? not on by one, with "for" - but with just a simple 
print? My debugging would be MUCH simpler.

Now when I try print or pprint that variable I get a page full of
'\xe4\xeb\xa2\xa0\xe6\xe3\xaa\xe6\xe3\xaa' and so on.
I use Python 2.4, Fedora Linux, UTF-8 locale
--
http://mail.python.org/mailman/listinfo/python-list


Zen of Python

2005-01-19 Thread Timothy Fitz
While I agree that the Zen of Python is an amazingly concise list of
truisms, I do not see any meaning in:

Flat is better than nested.

I strive for balance between flat and nested. Does anyone have a good
example of where this is applied? (specifically to python, or in
general)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Zen of Python

2005-01-19 Thread Timothy Fitz
On 19 Jan 2005 15:24:10 -0800, Carl Banks <[EMAIL PROTECTED]> wrote:
> The gist of "Flat is better than nested" is "be as nested as you have
> to be, no more," because being too nested is just a mess.

Which I agree with, and which makes sense. However your "gist" is a
different meaning. It's not that "Flat is better than nested" it's
that "Too flat is bad and too flat is nested so be as nested (or as
flat) as you have to be and no more." Perhaps Tim Peters is far too
concise for my feeble mind 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyCon Preliminary Program Announced!

2005-01-21 Thread Timothy Fitz
> I don't care much for "parallel tracks" myself, because I want to hear
> basically everything.  But we had more proposals of higher quality
> this year than ever before, so it came down to scheduling more talks
> in parallel than ever before too, or rejecting perfectly good
> proposals.  

Will there be recordings of any of these presentations? There are
quite a few times when I want to be at all three tracks at the same
time.
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: LJ pyGTK clien Zapys-0.3 released

2005-01-25 Thread Timothy Babytch
Usable simple app for posting messages to LiveJournal.
Easy extandable.
Main feature: character substitution. I mean (tm) to â, (c) to Â, quote 
to matching pairs and so on. The list can be easily extended with your 
own regexps.

submit on Ctrl+Enter.
Edit/delete last entry.
screenshot: http://img.lj.com.ua/ilishin/zapys-3.png
download: http://firefox.org.ua/misc/zapys-0.3.tar.bz2
--
http://mail.python.org/mailman/listinfo/python-list


Re: Where are list methods documented?

2005-02-01 Thread Timothy Fitz
[Tim Peters]
> The methods on mutable sequence types are documented in the Library
> manual's section on mutable sequence types:
>
>http://docs.python.org/lib/typesseq-mutable.html
>
 
And like -many- python programmers, when he thinks "List" he doesn't
immediately think "Mutable Sequence Type." The title should stay but
perhaps the tutorial should be updated to point people in the right
direction when they're "done" and need to know specifics? (This link
of the documentation was non-obvious to me also)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Finding user's home dir

2005-02-02 Thread Timothy Grant
On Wed, 02 Feb 2005 11:30:34 -0800 (PST), Nemesis
<[EMAIL PROTECTED]> wrote:
> Hi all, I'm trying to write a multiplatform function that tries to
> return the actual user home directory. I saw that
> os.path.expanduser("~") works on Linux but on Windows2000 (at least on
> the win I used) it returns %USERPROFILE%, so I tried os.environ["HOME"]
> and it gave me the same results. So I ended up with
> os.environ["USERPROFILE"], it doesn't work on Linux but (at least) on
> Windows2000 it returns the correct information
> 
> I googled a little bit and it seems that there is no general solution,
> so I tried to merge what I found, and I wrote this little function:
> 
> def getHomeDir():
> ''' Try to find user's home directory, otherwise return current 
> directory.'''
> try:
> path1=os.path.expanduser("~")
> except:
> path1=""
> try:
> path2=os.environ["HOME"]
> except:
> path2=""
> try:
> path3=os.environ["USERPROFILE"]
> except:
> path3=""
> 
> if not os.path.exists(path1):
> if not os.path.exists(path2):
> if not os.path.exists(path3):
> return os.getcwd()
> else: return path3
> else: return path2
> else: return path1
> 
> Please, could you test it on your systems and tell me what you got?
> I'd like to know what it returns on different operating systems because
> I'm developing a multiplatform software.
> 
> Thank you all.
> --
> Unauthorized amphibians will be toad away.
> 
>  |\ |   |HomePage   : http://nem01.altervista.org
>  | \|emesis |XPN (my nr): http://xpn.altervista.org
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 

Works beautifully on my PowerBook running Mac OSX 10.3.7

/Users/timothygrant

-- 
Stand Fast,
tjg.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python AST Sprint

2005-02-02 Thread Timothy Fitz
I am interested in helping Python, however my knowledge of Abstract
Syntax Trees is lacking. Where should I turn to educate myself? Any
books or websites would be appreciated.
-- 
http://mail.python.org/mailman/listinfo/python-list


multi threading and win9x

2005-06-20 Thread Timothy Smith
i want to run my sql statements on a seperate thread to prevent my app 
from stop responding to input (atm is says "not responding" under 
windows until the sql is finished)
but i'm hesitant because i have to still support win9x and i'm not sure 
how well this will play.
-- 
http://mail.python.org/mailman/listinfo/python-list


startfile problems

2005-08-01 Thread Timothy Smith
hello i have a very odd issue with os.startfile()

ok basicly my app works perfectly on every single other pc todate. i 
cannot recreate this issue on any system. so i've already ruled out any 
obvious coding issues, such as wrong file names etc. this issue only 
occurs on this one old pc.

upon trying to os.startfile() a pdf document (that i create) i get the 
error - Windows error [erro2]"System cannot find the specified file"
however when i go in to the program directory, the file is there, and i 
can open it. i have ruled out the following:
the pdf viewer is working.
the path and file name are correct
the path and file name do not contain any spaces and what not.

it's a windows xp system and i'm using python 2.3

i'm very curious as to what everyone thinks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: startfile problems

2005-08-02 Thread Timothy Smith
Dennis Lee Bieber wrote:

>On Tue, 02 Aug 2005 15:10:23 +1000, Timothy Smith
><[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
>  
>
>>i'm very curious as to what everyone thinks
>>
>>
>
>   I suspect most of us think: Where's the code?
>   followed by: Where's the traceback?
>
>   As for your statement of verifying the path and filename... We
>haven't seen it so can't guess... (part of the "where's the code")
>
>   Does the path contain \n, \t, \r, \f, etc. If it does, and you
>are not using a raw string, you are looking for a file with newline,
>tab, carriage return, formfeed, etc. respectively in the name.
>
>
>fid = "c:\temp\something.pdf"  #bad, this is
>#  c:emp\something.pdf
>#  assuming \s isn't some special character
>
>fid = r"c:\temp\something.pdf" #good
>fid = "c:\\temp\\something.pds" #okay
>
>  
>
it's iterally just

PDFname = 'tmp.pdf'
os.startfile(PDFname)

thats the code.

so obviously it contains no errnous characters. see my update btw. it 
actually DOES open the report, but throws up the exception as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: startfile problems

2005-08-02 Thread Timothy Smith
Dennis Lee Bieber wrote:

>On Tue, 02 Aug 2005 17:35:27 +1000, Timothy Smith
><[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
>
>  
>
>>it's iterally just
>>
>>PDFname = 'tmp.pdf'
>>os.startfile(PDFname)
>>
>>thats the code.
>>
>>
>>
>   No "import os"?
>   And the full traceback?
>
>  
>
>>so obviously it contains no errnous characters. see my update btw. it 
>>actually DOES open the report, but throws up the exception as well.
>>
>>
>
>   Must not have made it to my server yet, assuming it was posted
>after my comment.
>
>import os
>
>PDFname = "test.pdf"
>os.startfile(PDFname)
>
>   No errors if I'm in the directory with the PDF when I execute
>the program...
>
>E:\UserData\Dennis Lee Bieber\My Documents>script1.py
>
>E:\UserData\Dennis Lee Bieber\My Documents>python script1.py
>
>E:\UserData\Dennis Lee Bieber\My Documents>
>
>
>
>  
>
yep the program is executed in the same dir as the pdf file. like i said 
it actually opens it, but throws up an exception as well.
if i hadn't seen it with my own eyes i wouldn't believe it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: startfile problems

2005-08-02 Thread Timothy Smith
Michael Hoffman wrote:

>Timothy Smith wrote:
>
>  
>
>>yep the program is executed in the same dir as the pdf file. like i said 
>>it actually opens it, but throws up an exception as well.
>>
>>
>
>You are far more likely to get informed help if you post the traceback 
>here, as has been suggested twice already.
>  
>
i can't since it's a remote site and i can't reproduce the error. the 
best i have is a screen shot.
besdies which the only information it gives is the names and line 
numbers of the my py modules, nothing more. the only real info it gives 
i have posted already, in my inital post (the last line of it, 
WindowsError etc..)

other then that there's no more information to be had. it's a bloody 
simple 2 line function, nothing funky about it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Survey Tool

2005-08-31 Thread Timothy Downs
I've been looking around for an online (that is, web-based) survey tool 
for commercial use, and have been unable to any written in Python.
Is anyone aware of such a thing existing?

A price tag is not a problem, although access to source code is desirable.

Timothy Downs

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


Re: Survey Tool

2005-08-31 Thread Timothy Downs
Sorry if I wasn't clear- Was after a Python program serving up (using 
CGI, Django, CherryPy.. or whatever) a survey- filled out using a web 
browser.

Timothy Downs

> Wait. . .Do you want it on a website? I don't really understand you
>
>
> -Ivan
>
> _
> Don’t just search. Find. Check out the new MSN Search! 
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>

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


OCR librarys

2005-09-12 Thread Timothy Smith
i'm looking for ocr librarys with reasonably free licensing and the 
ablity to use python with them. c library's that i can call from python 
are acceptable.
so far all i have run into is voodoo and wild claims. i've tried gocr, 
and it wasn't very impressive. i'm like to be able to ocr handwriting 
but it's not a major requirment. anyone with any pointers or idea's i'm 
all ears. i'd really not like to have to use somthing like imagemagick 
and start from scratch.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OCR librarys

2005-09-12 Thread Timothy Smith
Larry Bates wrote:

>You need to specify a "platform" you will be running on.  I've had
>good experience with ExperVision's RTK toolkit on Windows.  It is not
>free, but it is very, very good.  Sometimes software is actually
>worth paying for ;-).
>
>Larry Bates
>
>
>Timothy Smith wrote:
>  
>
>>i'm looking for ocr librarys with reasonably free licensing and the
>>ablity to use python with them. c library's that i can call from python
>>are acceptable.
>>so far all i have run into is voodoo and wild claims. i've tried gocr,
>>and it wasn't very impressive. i'm like to be able to ocr handwriting
>>but it's not a major requirment. anyone with any pointers or idea's i'm
>>all ears. i'd really not like to have to use somthing like imagemagick
>>and start from scratch.
>>
>>
i know it's worth paying for a good one. i built a system that read 
barcodes off images once and it used a paid for library.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: services on linux

2005-09-20 Thread Timothy Smith
Martin Franklin wrote:

>Christoph Haas wrote:
>  
>
>>On Tue, Sep 20, 2005 at 02:57:26AM -0500, pt python wrote:
>>
>>
>>
>>>im moving from the windows world to the linux world and i need to make
>>>a python script to see if a service is instaled (ex: apache), if it is
>>>running or stoped and to start/stop a service like apache or mysql.
>>>Theres an API on windows to manage services and i need to know how to
>>>do that on linux. Can anyone help me with the module and API to work
>>>with services on linux?
>>>  
>>>
>>Unless you really want to do that in Python. It's just a matter of "ps"
>>and "grep". Simple shell stuff.
>>
>>Example: ps ax | grep apache
>>
>>
>>
>
>
>On RedHat based distro's (fedora in my case)
>
>
>/sbin/service sshd status
>
>
>gives me (as a normal user) the status of my ssh server not sure if 
>other distro's have this...
>
>
>
>  
>
>>>by the way, im developing a app, maybe multi-plataform, to install and
>>>manage several open source packages like apache, mySQL, phpwebadmin,
>>>phpnuke, etc... if anyone have nice ideais i apreciate that..
>>>  
>>>
>>That's usually the Linux distribution's job to handle the installed
>>packages. Some distributions do that better than others
>>(Debian). ;) Or what did you mean when you said "install
>>and manage"?
>>
>>
>>
>
>
>yeah you really need to look at the tools you have been given with your 
>distro, rpm, deb, etc for the best way.  If it's pure python then the 
>distutils package (in the python standard library) may help, also I 
>noticed that PyInstaller 1.0 has just been released
>
>  
>
i'd be very careful using a distro specific tool. it's no good if it 
only works on redhat.

>http://pyinstaller.hpcf.upr.edu/pyinstaller
>
>
>and has options to create single file installers for Linux / IRIX and 
>Windows...
>
>
>
>
>
>
>
>  
>

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


Python-libnjb on macosx

2005-02-10 Thread Timothy Grant
I was working on some things that use Glenn Strong's excellent libnjb
wrapper on my Linux box. I have since bought a PowerBook and have been
trying to get everything working correctly under OS/X.

This morning I got Python-libnjb to build without errors using the
following command:

ld -dynamic -dylib -L/sw/lib -L/sw/lib/python2.3/config njb_c_wrap.o
-o _njb_c.dylib -lpython2.3 -lnjb -lSystem -framework IOKit -ldylib1.o

However, when I try and import NJB.py I get the following:

([EMAIL PROTECTED]) pythonw NJB.py  
Traceback (most recent call last):
  File "NJB.py", line 2, in ?
import njb_c, sys, os, os.path, stat
  File "/Users/timothygrant/src/Python-libnjb/njb_c.py", line 5, in ?
import _njb_c
ImportError: Inappropriate file type for dynamic loading

I'm guessing this means that while I got the library to build, I
didn't get it to build correctly. However, I'm enough of an OS/X
neophyte that I don't know which direction to turn.

Any suggestions?


-- 
Stand Fast,
tjg.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: webbrowser.py

2005-02-14 Thread Timothy Babytch
Jeremy Sanders wrote:
It occurs to me that webbrowser could be more intelligent on Linux/Unix
systems. Both Gnome and KDE have default web browsers, so one could use
their settings to choose the appropriate browser.

I haven't been able to find a freedesktop common standard for web browser,
however.

webbrowser could identify whether it was running under KDE/Gnome (maybe
scan the processes?), identify the correct desktop's browser (or just use
Gnome, maybe), and start that web browser.
I would not mind just using default GNOME's browser :)
to determine the one you will need python-gconf2 module and look for 
gconf entry /desktop/gnome/applications/browser

The only bug here is that user MUST have python-gconf2 installed. Many 
GNOMErs do not have it. but hey - one more dependancy.. Who cares? If 
they istalled pyGTK :) - why it is wrong to ask for python-gconf2?
--
http://mail.python.org/mailman/listinfo/python-list


More newbie macosx user questions

2005-02-24 Thread Timothy Grant
I think I'm mis-understanding something about how PYTHONPATH works (at
least on OSX I didn't have this trouble on Linux).

I have a directory where I store libraries that I'm playing around
with. However, for some reason python can't find the library. Since
I'm using PyQt, I use pythonw, but the results are identical with
python. It doesn't look like my PYTHONPATH is getting prepended to the
library path.

Can anyone tell me what I'm doing wrong?

([EMAIL PROTECTED]) echo $PYTHONPATH 
/Users/timothygrant/code/lib
([EMAIL PROTECTED]) ls $PYTHONPATH
NJB.pyNJB.pyc   _njb_c.so njb_c.py  njb_c.pyc
([EMAIL PROTECTED]) pythonw
Python 2.3 (#1, Sep 13 2003, 00:49:11) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import NJB
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named NJB
>>> import sys
>>> for p in sys.path:
... print p
... 

/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages
-- 
http://mail.python.org/mailman/listinfo/python-list


problem installing wxPython 2.5.3, wxWidgets installed ok

2005-02-25 Thread timothy . williams
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2
machine.

I have python in a non-standard place, but I'm using --prefix with the
configure script to point to where I have everything. The make install
in $WXDIR seemed to go fine. I have the libxw* libraries in my lib/
directory

libwx_base-2.5.so@libwx_gtk_adv-2.5.so.3.0.0*
libwx_base-2.5.so.3@  libwx_gtk_core-2.5.so@
libwx_base-2.5.so.3.0.0*  libwx_gtk_core-2.5.so.3@
libwx_base_net-2.5.so@libwx_gtk_core-2.5.so.3.0.0*
libwx_base_net-2.5.so.3@  libwx_gtk_gl-2.4.so@
libwx_base_net-2.5.so.3.0.0*  libwx_gtk_gl-2.4.so.0@
libwx_base_xml-2.5.so@libwx_gtk_gl-2.4.so.0.1.1*
libwx_base_xml-2.5.so.3@  libwx_gtk_html-2.5.so@
libwx_base_xml-2.5.so.3.0.0*  libwx_gtk_html-2.5.so.3@
libwx_gtk-2.4.so@ libwx_gtk_html-2.5.so.3.0.0*
libwx_gtk-2.4.so.0@   libwx_gtk_xrc-2.5.so@
libwx_gtk-2.4.so.0.1.1*   libwx_gtk_xrc-2.5.so.3@
libwx_gtk_adv-2.5.so@ libwx_gtk_xrc-2.5.so.3.0.0*
libwx_gtk_adv-2.5.so.3@

I also have a wx/ directory under my lib. directory.

The problem is when I try to do a 'python setup.py install' in the
./wxPython directory.  I get a message about not finding a config file
for wx-config and then several errors during gcc compiles.

> python setup.py build
Found wx-config: /project/c4i/Users_Share/williams/Linux/bin/wx-config
Using flags:  --toolkit=gtk2 --unicode=no --version=2.5

  Warning: No config found to match:
/project/c4i/Users_Share/williams/Linux/bin/wx-config --toolkit=gtk2
--unicode=no --version=2.5 --cxxflags
   in /project/c4i/Users_Share/williams/Linux/lib/wx/config
  If you require this configuration, please install the desired
  library build.  If this is part of an automated configuration
  test and no other errors occur, you may safely ignore it.
  You may use wx-config --list to see all configs available in
  the default prefix.

...

Preparing OGL...
Preparing STC...
Preparing GIZMOS...
running build
running build_py
copying wx/__version__.py -> build-gtk2/lib.linux-i686-2.3/wx
running build_ext
building '_core_' extension
creating build-gtk2/temp.linux-i686-2.3
creating build-gtk2/temp.linux-i686-2.3/src
creating build-gtk2/temp.linux-i686-2.3/src/gtk
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC -DSWIG_GLOBAL -DHAVE_CONFIG_H
-DWXP_USE_THREAD=1 -UNDEBUG -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API
-Iinclude -Isrc -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/freetype2/config
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/project/c4i/Users_Share/williams/Linux/include/python2.3 -c
src/libpy.c -o build-gtk2/temp.linux-i686-2.3/src/libpy.o -O3
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC -DSWIG_GLOBAL -DHAVE_CONFIG_H
-DWXP_USE_THREAD=1 -UNDEBUG -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API
-Iinclude -Isrc -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0
-I/usr/include/freetype2 -I/usr/include/freetype2/config
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/project/c4i/Users_Share/williams/Linux/include/python2.3 -c
src/gtk/_core_wrap.cpp -o
build-gtk2/temp.linux-i686-2.3/src/gtk/_core_wrap.o -O3
cc1plus: warning: command line option "-Wstrict-prototypes" is valid
for Ada/C/ObjC but not for C++
In file included from src/gtk/_core_wrap.cpp:400:
include/wx/wxPython/wxPython_int.h:19:19: wx/wx.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:21:25: wx/busyinfo.h: No such file
or directory
include/wx/wxPython/wxPython_int.h:22:22: wx/caret.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:23:25: wx/choicebk.h: No such file
or directory
include/wx/wxPython/wxPython_int.h:24:24: wx/clipbrd.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:25:25: wx/colordlg.h: No such file
or directory
include/wx/wxPython/wxPython_int.h:26:23: wx/config.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:27:23: wx/cshelp.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:28:25: wx/dcmirror.h: No such file
or directory
include/wx/wxPython/wxPython_int.h:29:21: wx/dcps.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:30:24: wx/dirctrl.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:31:23: wx/dirdlg.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:32:20: wx/dnd.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:33:24: wx/docview.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:34:24: wx/encconv.h: No such file or
directory
include/wx/wxPython/wxPython_int.h:35:25: wx/fdrepdlg.h: No such file
or direct

...

Why isn't there a -I../include switch on the compile line, and how do I
reconfigure it so it does?

Thanks for any help.

-- 
http://mail.python.org/mailma

Re: problem installing wxPython 2.5.3, wxWidgets installed ok

2005-03-01 Thread timothy . williams
Luc wrote:
> [EMAIL PROTECTED] a écrit:
>
> > I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a
Fedora 2
> > machine.
> >
> > I have python in a non-standard place, but I'm using --prefix with
the
> > configure script to point to where I have everything. The make
install
> > in $WXDIR seemed to go fine. I have the libxw* libraries in my lib/
> > directory
> >
(snip)
> pay attention: some of your current applications will not work with
that
> version. In my case, all the apps I have wrotten before and with
previous
> 2.4 as well with the boa-constructor IDE

So are you saying that 2.5.3.1 is not ready for prime time? How does
your reply address my 'python setup.py install' problem?

I don't have any wx applications to speak of yet. Just some of the
tutorial examples.

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


locale support and 4.10

2005-03-04 Thread Timothy Smith
i'm trying to setlocale() on 4.10, and it appears the python package 
doesn't support this under 4.10.

Python 2.3.3 (#2, Apr 28 2004, 22:48:37)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, 'us')
Traceback (most recent call last):
 File "", line 1, in ?
 File "/usr/local/lib/python2.3/locale.py", line 381, in setlocale
   return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>>
the exact same thing works under windows xp.
do i have to compile it with locale support?
also my second question. once i have this working how do i set the 
thousands_sep character to be a "," ?
--
http://mail.python.org/mailman/listinfo/python-list


Re: locale support and 4.10

2005-03-05 Thread Timothy Smith
Martin v. Löwis wrote:
Timothy Smith wrote:
 >>> locale.setlocale(locale.LC_NUMERIC, 'us')
the exact same thing works under windows xp.
do i have to compile it with locale support?

No. You have to choose a locale name that is supported by your
operating system (which appears to be FreeBSD). Read your OS
documentation for what valid locale names are; most likely,
"en_US" or "en_US.ISO-8859-1" are supported.
also my second question. once i have this working how do i set the 
thousands_sep character to be a "," ?

You don't directly set it. It is a property of the locale.
Regards,
Martin
something strange is happening, no matter what i try nothing is a 
supported locale
and yes it's freebsd 4.10
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to script DOS app that doesn't use stdout

2005-03-08 Thread Timothy Grant
On Sun, 06 Mar 2005 13:41:57 GMT, Gregor <[EMAIL PROTECTED]> wrote:
> There's a DOS console application I am trying to script (in Python), but it
> doesn't seem to use stdout or stderr... For example, if I redirect output
> to a file ("cmd > file.txt"), the output still appears on screen.
> Similarly, the output pipes returned by popen* don't catch the app's
> output. How might this app be generating its output? Any thoughts on how it
> could be captured (perhaps with something in the win32 extensions)?
> 
> Thanks,
> 
> Greg.

I've had to do this a couple of times but never in recent years. I
don't know your exact needs, but the best tool I ever found for this
sort of job was called Phantom of the Keyboard.

I ran into a couple of apps that I needed data out of and couldn't get
it. They'd only output to screen, never to disk. I used Phantom to
automate the app to dump data to screen and then capture the screen to
disk.

-- 
Stand Fast,
tjg.
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   >