Documentación desde la terminal de comandos.

2012-06-07 Thread Diego Uribe Gamez
Una pregunta, como puedo listar todas las librerías que puedo importar a un
.py? y de sus clases? en la terminal de Linux Debian, algo así como cuando
listo todos los programas usando "# aptitude search nombre"

Se que entro a otra terminal usando "# Python"

Gracias

-- 
 *Diego Alonso Uribe Gamez*
--

*Desarrollador web*

Twitter: @DiegoUG 

Google+: http://gplus.to/diegoug
--
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-07 Thread Tim Wintle
On Wed, 2012-06-06 at 16:56 -0400, Jerry Hill wrote:
> For what it's worth, I've never seen either of those constructs ("see
> overleaf" and "see over").  Are they perhaps more common in a
> particular academic context, or possibly more common in places that
> use "British English" spellings rather than "American English"?

Perhaps - "overleaf" is relatively common in documents here - while
filling out forms, in exam papers, etc.

However a quick search suggests the usage is in British and American
dictionaries with the same meaning.

Tim


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


Re: Documentación desde la terminal de comandos.

2012-06-07 Thread Chris Rebert
2012/6/6 Diego Uribe Gamez 
>
> Una pregunta, como puedo listar todas las librerías que puedo importar a
> un .py? y de sus clases? en la terminal de Linux Debian, algo así como
> cuando listo todos los programas usando "# aptitude search nombre"
>
> Se que entro a otra terminal usando "# Python"
>
> Gracias
>
> --
>  Diego Alonso Uribe Gamez

Hola Diego,

Esta lista de correo (python-list) es en inglés. Recomiendo que usted
le pregunte a python-es
(http://mail.python.org/mailman/listinfo/python-es ), que es la lista
equivalente pero en español.
(Lo siento por mi español malo.)

Adios,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Career related question

2012-06-07 Thread Stanley Lee
Hey all,

Can I only post jobs on Python's official website, or can I also
direct the message to the appropriate mailing list in http://mail.python.org/
? Btw, do I have to be a subscriber of a given list in order to submit
messages?

Thanks in advance,

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


Where is the lastest step by step guide to compile Python into an executable?

2012-06-07 Thread David Shi
Hi, folks.

Where is the lastest step by step guide to compile Python into an executable?

Regards.

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


next alpha sequence value from var pointing to array

2012-06-07 Thread jdmorgan

Hello,

I am still fairly new to python, but find it to be a great scripting 
language.Here is my issue:


I am attempting to utilize a function to receive any sequence of letter 
characters and return to me the next value in alphabetic order e.g. send 
in "abc" get back "abd".I found a function on StackExchange (Rosenfield, 
A 1995) that seems to work well enough (I think):


/def next(s):/

/strip_zs = s.rstrip('z')/

/if strip_zs:/

/return strip_zs[:-1] + chr(ord(strip_zs[-1]) + 1) + 'a' * (len(s) - 
len(strip_zs))/


/else:/

/return 'a' * (len(s) + 1)/

I have found this function works well if I call it directly with a 
string enclosed in quotes:


returnValue = next("abc")

However, if I call the function with a variable populated from a value I 
obtain from an array[] it fails returning only ^K


Unfortunately, because I don't fully understand this next function I 
can't really interpret the error.Any help would be greatly appreciated.


Thanks ahead of time,

Derek

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


Re: Career related question

2012-06-07 Thread Chris Angelico
On Thu, Jun 7, 2012 at 7:33 PM, Stanley Lee  wrote:
> Hey all,
>
> Can I only post jobs on Python's official website, or can I also
> direct the message to the appropriate mailing list in http://mail.python.org/
> ? Btw, do I have to be a subscriber of a given list in order to submit
> messages?

Job postings are frowned upon here on the list; the job board is the
appropriate place (assuming that it's a definitely Python-related
job). You normally have to be subscribed to the list to post, since
responses are usually going to also be on-list; but python-list
cross-communicates with the newsgroup comp.lang.python, so you can be
on either (and there are web-based newsgroup readers too).

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


Re: next alpha sequence value from var pointing to array

2012-06-07 Thread Peter Otten
jdmorgan wrote:

> Hello,

Welcome!

> I am still fairly new to python, but find it to be a great scripting
> language.Here is my issue:
> 
> I am attempting to utilize a function to receive any sequence of letter
> characters and return to me the next value in alphabetic order e.g. send
> in "abc" get back "abd".I found a function on StackExchange (Rosenfield,
> A 1995) that seems to work well enough (I think):

Please don't try to be clever about formatting your mail. Use text only. 

> /def next(s):/
> 
> /strip_zs = s.rstrip('z')/
> 
> /if strip_zs:/
> 
> /return strip_zs[:-1] + chr(ord(strip_zs[-1]) + 1) + 'a' * (len(s) -
> len(strip_zs))/
> 
> /else:/
> 
> /return 'a' * (len(s) + 1)/

This should be

def next_alpha(s):
strip_zs = s.rstrip('z')
if strip_zs:
return (strip_zs[:-1] + chr(ord(strip_zs[-1]) + 1) +
'a' * (len(s) - len(strip_zs)))
else:
return 'a' * (len(s) + 1)

(I renamed the function because next() already is a built-in function since 
Python 2.6)

The function removes all lowercase "z" letters from the end of the string. 
If the rest is empty like for next_alpha("zzz") it returns len(s) + 1 "a"s, 
or "" in the example. If the rest is not empty, e.g for

next_alpha("abcz")

it replaces the last non-"z" character with its successor in the alphabet

>>> chr(ord("c")+1)
'd'

and replaces the trailing "z"s with the same number of trailing "a"s.

> I have found this function works well if I call it directly with a
> string enclosed in quotes:
> 
> returnValue = next("abc")
> 
> However, if I call the function with a variable populated from a value I
> obtain from an array[] it fails returning only ^K

I'm assuming that something is missing here, but if the function actually 
returns the string "^K" that is the expected result for

>>> next_alpha("^J")
'^K'

The function only handles lowercase letters a...z correctly.

> Unfortunately, because I don't fully understand this next function I
> can't really interpret the error.Any help would be greatly appreciated.

What is the actual value you pass to the function? Add print statements 

argument = ... # your code
print argument
return_value = next_alpha(argument)
print return_value

and post what is printed.
If you get a traceback, e. g. 

>>> next_alpha([])
Traceback (most recent call last):
  File "", line 1, in 
  File "next_alpha.py", line 2, in next_alpha
strip_zs = s.rstrip('z')
AttributeError: 'list' object has no attribute 'rstrip'

cut and paste it, and post it here, too



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


Re: next alpha sequence value from var pointing to array

2012-06-07 Thread jdmorgan

Hi Peter,

Thanks for you feedback. I have the next_alpha function you have 
provided.  But, am still getting the same result.
The actual value I am passing in is "btl".  But, as I mentioned I am 
getting it from an array value.  Here is my actual code.
I am reading a comma separated file, getting the last item and trying to 
get the next alpha.  Thanks again.



def getNRTLid(layerName):
lids_seen = []
lyrs_seen = []
last_lid = ""
f = open("NRTLayerLID.csv", "r");
for line in f:
sp = line.split(',')
lyrs_seen.append(sp[0])
lids_seen.append(sp[1])
f.close();
sorted_array = sorted(lids_seen)
sorted_array.reverse()
print "highest lid is %s" % sorted_array[0]
highest_lid = sorted_array[0]
test = highest_lid.lower()
nl = next_alpha(test)


Best,
Derek
--
http://mail.python.org/mailman/listinfo/python-list


Re: next alpha sequence value from var pointing to array

2012-06-07 Thread Peter Otten
jdmorgan wrote:

> Hi Peter,
> 
> Thanks for you feedback. I have the next_alpha function you have
> provided.  But, am still getting the same result.
> The actual value I am passing in is "btl".  But, as I mentioned I am
> getting it from an array value.  

Note that what you are calling an array is (somewhat confusingly) called 
"list" in Python. Still, it doesn't matter where you get it from if you are 
actually passing the string "btl" to next_alpha() the result should be 
"btm".

> Here is my actual code.

There seems to be missing something at the end of the function...

> I am reading a comma separated file, getting the last item and trying to
> get the next alpha.  Thanks again.
> 
> 
> def getNRTLid(layerName):
>  lids_seen = []
>  lyrs_seen = []
>  last_lid = ""
>  f = open("NRTLayerLID.csv", "r");
>  for line in f:
>  sp = line.split(',')
>  lyrs_seen.append(sp[0])
>  lids_seen.append(sp[1])
>  f.close();
>  sorted_array = sorted(lids_seen)
>  sorted_array.reverse()
>  print "highest lid is %s" % sorted_array[0]

Change %s to %r in the above. There may be whitespace characters at the end 
of the string which you can detect that way. 

   print "highest lid is %r" % sorted_array[0] # what does that print?

>  highest_lid = sorted_array[0]
>  test = highest_lid.lower()
>  nl = next_alpha(test)

   print repr(nl) # what does that print?



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


Re: what gui designer is everyone using

2012-06-07 Thread Dave Cook
On 2012-06-05, Mark R Rivet  wrote:
> I want a gui designer that writes the gui code for me. I don't want to
> write gui code. what is the gui designer that is most popular?
> I tried boa-constructor, and it works, but I am concerned about how
> dated it seems to be with no updates in over six years.

I've been using wxFormBuilder since last summer.  It's reasonably easy
to use, and there are regular releases by the developers. 

I have a coworker who's had a lot of success using Boa for everything.
It would be a shame if Boa is allowed to bitrot in to complete
unuseability.

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


Re: Where is the lastest step by step guide to compile Python into an executable?

2012-06-07 Thread Mark Lawrence

On 07/06/2012 11:05, David Shi wrote:

Hi, folks.

Where is the lastest step by step guide to compile Python into an executable?

Regards.

David






Google.

--
Cheers.

Mark Lawrence.

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


xlrd 0.7.8 released!

2012-06-07 Thread Chris Withers

Hi All,

I'm pleased to announce the release of xlrd 0.7.8:

http://pypi.python.org/pypi/xlrd/0.7.8

This release features the following changes:

- Compatibility with Python 2.1 and 2.2 is restored.

- Fix for github issue #7: assertion error when reading file with 
xlwt-written bitmap. The assertion is now ignored and a warning logged 
if verbosity > 0.


- superfluous zero bytes at end of xls OBJECT records are now ignored.

For full details, please see the GitHub repository:

https://github.com/python-excel/xlrd

Barring any packaging issues or serious bugs, this will be the last 
release in the 0.7 series and the last release supporting Python 2.1 and 
2.2.


The next release, likely in a couple of weeks time, will be 0.8.0 
targeting Python 2.6 and upwards and featuring support for reading data 
from .xlsx files (although not formatting, unless some sponsorship or 
patches turn up). If you're interested in this, it would be great if you 
could try out the master branch and let us know if you find any problems:


https://github.com/python-excel/xlrd

There's also details of all things Python and Excel related here:

http://www.python-excel.org/

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
http://mail.python.org/mailman/listinfo/python-list


Interprocess comunication

2012-06-07 Thread Julio Sergio
I'm trying to call an external process to filter some of my data, i.e., I'm 
trying to pass some information to the called process, and have this 
information 
back transformed. I started testing with the linux 'cat' command, in this way:


->>> import subprocess as sp
->>> p = sp.Popen(["cat"],stdin=sp.PIPE,stdout=sp.PIPE,close_fds=True)
->>> (fi,fo) = (p.stdin, p.stdout)
->>> fi.write("SOMETHING\n")
->>> fi.flush()
->>> fo.readline()
'SOMETHING\n'
->>> fi.write("OTHER\n")
->>> fi.flush()
->>> fo.readline()
'OTHER\n'
->>> fi.write("NEXT\n")
->>> fi.flush()
->>> fo.readline()
'NEXT\n'
->>> fi.write("NEXT1\n")
->>> fi.flush()
->>> s = fo.readline()
->>> s
'NEXT1\n'

Up to this point it worked as expected. However, when I tryied with the methods 
that write and read several lines, apparently the process got stalled:

->>> fi.writelines(["uno\n","dos\n","tres\n"])
->>> fi.flush()
->>> s = fo.readlines()
.
.
.

Do you have any comments on this?

Thanks,

 --Sergio


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


Re: Interprocess comunication

2012-06-07 Thread MRAB

On 07/06/2012 17:04, Julio Sergio wrote:

I'm trying to call an external process to filter some of my data, i.e., I'm
trying to pass some information to the called process, and have this information
back transformed. I started testing with the linux 'cat' command, in this way:


->>>  import subprocess as sp
->>>  p = sp.Popen(["cat"],stdin=sp.PIPE,stdout=sp.PIPE,close_fds=True)
->>>  (fi,fo) = (p.stdin, p.stdout)
->>>  fi.write("SOMETHING\n")
->>>  fi.flush()
->>>  fo.readline()
'SOMETHING\n'
->>>  fi.write("OTHER\n")
->>>  fi.flush()
->>>  fo.readline()
'OTHER\n'
->>>  fi.write("NEXT\n")
->>>  fi.flush()
->>>  fo.readline()
'NEXT\n'
->>>  fi.write("NEXT1\n")
->>>  fi.flush()
->>>  s = fo.readline()
->>>  s
'NEXT1\n'

Up to this point it worked as expected. However, when I tryied with the methods
that write and read several lines, apparently the process got stalled:

->>>  fi.writelines(["uno\n","dos\n","tres\n"])
->>>  fi.flush()
->>>  s = fo.readlines()
.
.
.

Do you have any comments on this?


I believe it's waiting for the end of the input, i.e. for the pipe to
close.

Have you tried calling fo.readline() 3 times instead?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Interprocess comunication

2012-06-07 Thread J. Cliff Dyer
On Thu, 2012-06-07 at 16:04 +, Julio Sergio wrote:

> Up to this point it worked as expected. However, when I tryied with the 
> methods 
> that write and read several lines, apparently the process got stalled:
> 
> ->>> fi.writelines(["uno\n","dos\n","tres\n"])
> ->>> fi.flush()
> ->>> s = fo.readlines()
> .
> .
> .

readlines() reads all the lines from the filehandle, but the filehandle
hasn't signalled that it is done writing lines, so fo is waiting until
fi is complete.  You either need to keep reading one line at a time, and
manually release control when there's nothing more to read, or you need
to do an fi.close() before you try to use fo.readlines().



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


Re: Interprocess comunication

2012-06-07 Thread Julio Sergio
MRAB  mrabarnett.plus.com> writes:

> 
> I believe it's waiting for the end of the input, i.e. for the pipe to
> close.
> 
> Have you tried calling fo.readline() 3 times instead?
> 

yeah! It worked!...
A question remains: what is then the purpose of fo.readlines(...)?

Thanks,
--Sergio




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


Re: Interprocess comunication

2012-06-07 Thread Oscar Benjamin
On 7 June 2012 17:04, Julio Sergio  wrote:

> I'm trying to call an external process to filter some of my data, i.e., I'm
> trying to pass some information to the called process, and have this
> information
> back transformed. I started testing with the linux 'cat' command, in this
> way:
>
>
> ->>> import subprocess as sp
> ->>> p = sp.Popen(["cat"],stdin=sp.PIPE,stdout=sp.PIPE,close_fds=True)
> ->>> (fi,fo) = (p.stdin, p.stdout)
> ->>> fi.write("SOMETHING\n")
> ->>> fi.flush()
> ->>> fo.readline()
> 'SOMETHING\n'
> ->>> fi.write("OTHER\n")
> ->>> fi.flush()
> ->>> fo.readline()
> 'OTHER\n'
> ->>> fi.write("NEXT\n")
> ->>> fi.flush()
> ->>> fo.readline()
> 'NEXT\n'
> ->>> fi.write("NEXT1\n")
> ->>> fi.flush()
> ->>> s = fo.readline()
> ->>> s
> 'NEXT1\n'
>
> Up to this point it worked as expected. However, when I tryied with the
> methods
> that write and read several lines, apparently the process got stalled:
>
> ->>> fi.writelines(["uno\n","dos\n","tres\n"])
>
->>> fi.flush()
>
->>> s = fo.readlines()
>

The readlines() method is intended to read an entire file and split it into
lines, so it blocks until EOF is found. If you want to use readlines(), you
should first close the subprocesses stdin:

>>> fi.writelines(["uno\n","dos\n","tres\n"])
>>> fi.flush()
>>> fi.close()
>>> s = fo.readlines()

Although now you can no longer use the subprocess for reading or writing.
If that is not what you want in your actual problem then you'll need to
avoid readlines().


> .
> .
> .
>
> Do you have any comments on this?
>
> Thanks,
>
>  --Sergio
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interprocess comunication

2012-06-07 Thread Julio Sergio
J. Cliff Dyer  sdf.lonestar.org> writes:

> 
> readlines() reads all the lines from the filehandle, but the filehandle
> hasn't signalled that it is done writing lines, so fo is waiting until
> fi is complete.  You either need to keep reading one line at a time, and
> manually release control when there's nothing more to read, or you need
> to do an fi.close() before you try to use fo.readlines().
> 
> 

Thanks... It worked as you said. Here is how I coded it:

->>> fi.writelines(["uno\n","dos\n","tres\n"])
->>> fi.close()
->>> l = fo.readlines()
->>> l
['uno\n', 'dos\n', 'tres\n']


--Sergio

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


Re: Interprocess comunication

2012-06-07 Thread J. Cliff Dyer
It is for reading all the lines from a complete file.  If the file is
still being written to, it doesn't have an end yet.  File objects do
many things besides RPC.  Also, there are instances where all you want
to do is block until the file is done, and then get all the content.
readlines will do that, too.



On Thu, 2012-06-07 at 16:39 +, Julio Sergio wrote:
> MRAB  mrabarnett.plus.com> writes:
> 
> > 
> > I believe it's waiting for the end of the input, i.e. for the pipe to
> > close.
> > 
> > Have you tried calling fo.readline() 3 times instead?
> > 
> 
> yeah! It worked!...
> A question remains: what is then the purpose of fo.readlines(...)?
> 
> Thanks,
> --Sergio
> 
> 
> 
> 


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


Re: Career related question

2012-06-07 Thread Temia Eszteri
On Thu, 7 Jun 2012 22:23:47 +1000, Chris Angelico 
wrote:

>On Thu, Jun 7, 2012 at 7:33 PM, Stanley Lee  wrote:
>> Hey all,
>>
>> Can I only post jobs on Python's official website, or can I also
>> direct the message to the appropriate mailing list in http://mail.python.org/
>> ? Btw, do I have to be a subscriber of a given list in order to submit
>> messages?
>
>Job postings are frowned upon here on the list; the job board is the
>appropriate place (assuming that it's a definitely Python-related
>job). You normally have to be subscribed to the list to post, since
>responses are usually going to also be on-list; but python-list
>cross-communicates with the newsgroup comp.lang.python, so you can be
>on either (and there are web-based newsgroup readers too).
>
>Chris Angelico

>From what I've seen, the cross-communication isn't working properly -
it's all one-way, and nobody's done anything to look into it yet. Or,
failing that, there's just some intercommunication problems between
the NNTP servers and the mailing list just samples from multiple
sources...

~Temia
-- 
The amazing programming device: fuelled entirely by coffee, it codes while
awake and tests while asleep!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interprocess comunication

2012-06-07 Thread Peter Otten
Julio Sergio wrote:

> J. Cliff Dyer  sdf.lonestar.org> writes:
> 
>> 
>> readlines() reads all the lines from the filehandle, but the filehandle
>> hasn't signalled that it is done writing lines, so fo is waiting until
>> fi is complete.  You either need to keep reading one line at a time, and
>> manually release control when there's nothing more to read, or you need
>> to do an fi.close() before you try to use fo.readlines().
>> 
>> 
> 
> Thanks... It worked as you said. Here is how I coded it:
> 
> ->>> fi.writelines(["uno\n","dos\n","tres\n"])
> ->>> fi.close()
> ->>> l = fo.readlines()
> ->>> l
> ['uno\n', 'dos\n', 'tres\n']

I believe this may hang on the fi.writelines(...) line if you write "too 
much" data.

>From the subprocess documentation:

"""
Warning
 
Use communicate() rather than .stdin.write, .stdout.read or .stderr.read to 
avoid deadlocks due to any of the other OS pipe buffers filling up and 
blocking the child process.
"""

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


Why does this leak memory?

2012-06-07 Thread Steve

When I run this program:

import configparser, sys, gc
def test():
   config=configparser.ConfigParser()
   #del(config)
   #gc.collect()
test()
sys.stderr.write(sys.version)
gc.set_debug(gc.DEBUG_LEAK|gc.DEBUG_STATS)

It reports:

3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)]gc: 
collecting generation 2...

gc: objects in each generation: 453 258 4553
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable <_Link 02713300>
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable <_Link 02713350>
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable <_Link 02713378>
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable 
gc: collectable <_Link 02713328>
gc: collectable 
gc: collectable 
gc: done, 19 unreachable, 0 uncollectable, 0.s elapsed.

The leaks can be removed by uncommenting both lines shown.

This strikes me as very odd behaviour.  Can anyone explain it, or is it a 
bug?


Thanks,

S.




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


Installing MySQLdb via FTP?

2012-06-07 Thread Tim Johnson
Is it possible to install MySQLdb via FTP?

1)I have a hostmonster account with SSH. I have been able to log in
and install MySQLdb from the shell. Works fine.

2)Now I have a client who wants to have a hostmonster account and we
will need MySQLdb. I *will not* have SSH access since (as I
understand it) hostmonster allows SSH access from 1 IP only.

3)The hostmonster account services (I.E. cpanel) does not have any
service to do this.

4)I wouldn't need to make the install on PYTHONPATH as my resources
will handle sys.path configuration.

This isn't an immediate need so URLs and pointers to relevant
discussions would suffice.

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what gui designer is everyone using

2012-06-07 Thread Miki Tebeka
> what is the gui designer that is most popular?
IIRC Qt designer can output Python code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python libraries portable?

2012-06-07 Thread jkells
We are new to developing applications with Python.  A question came up 
concerning Python libraries being portable between Architectures.More 
specifically, can we take a python library that runs on a X86 
architecture and run it on a SPARC architecture or do we need to get the 
native libraries for SPARC?

Thanking you in advance 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this leak memory?

2012-06-07 Thread John Gordon
In  "Steve"  writes:

> gc: objects in each generation: 453 258 4553
> gc: collectable 
> gc: collectable 
> gc: collectable 
> gc: collectable <_Link 02713300>
> gc: collectable 
> gc: collectable 
> gc: collectable 
> gc: collectable <_Link 02713350>
> gc: collectable 
> gc: collectable 
> gc: collectable 
> gc: collectable <_Link 02713378>
> gc: collectable 
> gc: collectable 
> gc: collectable 
> gc: collectable 
> gc: collectable <_Link 02713328>
> gc: collectable 
> gc: collectable 
> gc: done, 19 unreachable, 0 uncollectable, 0.s elapsed.

> The leaks can be removed by uncommenting both lines shown.

> This strikes me as very odd behaviour.  Can anyone explain it, or is it a 
> bug?

I'm unfamiliar with gc output, but just glancing over it I don't see
anything that looks like a leak.  It reported that there were 19 objects
which are unreachable and therefore are candidates for being collected.

What makes you think there is a leak?

-- 
John Gordon   A is for Amy, who fell down the stairs
[email protected]  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

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


Re: what gui designer is everyone using

2012-06-07 Thread Kevin Walzer

On 6/5/12 10:10 AM, Mark R Rivet wrote:

I want a gui designer that writes the gui code for me. I don't want to
write gui code. what is the gui designer that is most popular?
I tried boa-constructor, and it works, but I am concerned about how
dated it seems to be with no updates in over six years.


None. I write GUI code by hand (Tkinter).

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python libraries portable?

2012-06-07 Thread Corey Richardson
On Thu, 07 Jun 2012 20:20:47 GMT
jkells   wrote:

> We are new to developing applications with Python.  A question came
> up concerning Python libraries being portable between
> Architectures.More specifically, can we take a python library
> that runs on a X86 architecture and run it on a SPARC architecture or
> do we need to get the native libraries for SPARC?
> 

Pure-python libraries should run wherever Python does, if it doesn't,
that's a bug. C extensions to CPython shouldn't have any platform
incompatibilities, but of course you'll need to recompile.

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


Re: Why does this leak memory?

2012-06-07 Thread Ian Kelly
On Thu, Jun 7, 2012 at 12:48 PM, Steve  wrote:
> The leaks can be removed by uncommenting both lines shown.

That's just a matter of timing.  You call the function before you call
set_debug, so when you uncomment the lines, the garbage collector is
explicitly run before the debug flags are set.  When it runs again
later, there are no collectable objects for it to find, as they've
already been collected.  With the lines commented, the garbage
collector doesn't get run until after the set_debug call, so it finds
the collectable objects at that time.  Either way the objects get
collected sooner or later, so I don't see any leaks here.

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this leak memory?

2012-06-07 Thread Ian Kelly
For comparison, here is what a leaking program would look like:

class Foo(object):

def __init__(self, other=None):
if other is None:
other = Foo(self)
self.other = other

def __del__(self):
pass

import gc
gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_LEAK)

for i in range(5):
foo = Foo()
del foo
gc.collect()
print "len(gc.garbage) ==", len(gc.garbage)


gc: collecting generation 2...
gc: objects in each generation: 167 3363 0
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: done, 4 unreachable, 4 uncollectable, 0.s elapsed.
len(gc.garbage) == 4
gc: collecting generation 2...
gc: objects in each generation: 4 0 3463
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: done, 4 unreachable, 4 uncollectable, 0.s elapsed.
len(gc.garbage) == 8
gc: collecting generation 2...
gc: objects in each generation: 4 0 3467
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: done, 4 unreachable, 4 uncollectable, 0.s elapsed.
len(gc.garbage) == 12
gc: collecting generation 2...
gc: objects in each generation: 4 0 3471
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: done, 4 unreachable, 4 uncollectable, 0.s elapsed.
len(gc.garbage) == 16
gc: collecting generation 2...
gc: objects in each generation: 4 0 3475
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: uncollectable 
gc: done, 4 unreachable, 4 uncollectable, 0.s elapsed.
len(gc.garbage) == 20
gc: collecting generation 2...
gc: objects in each generation: 0 0 3475
gc: done, 0.s elapsed.


Note that on each iteration, it reports only the four new
uncollectable objects, not any of the previous uncollectable objects,
because when they are found to be uncollectable they are added to
gc.garbage and so become reachable again.

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


tiffany 0.3 released

2012-06-07 Thread Christian Tismer

# coding=utf-8

Tiffany - Read/Write Multipage-Tiff with PIL without PIL


Tiffany stands for any tiff. The tiny module solves a large set of
problems, has no dependencies and just works wherever Python works.
Tiffany was developed in the course of the *DiDoCa* project and will
now appear on PyPi.

Abstract


During the development of *DiDoCa* (Distributed Document Capture) we were
confronted with the problem to read multipage Tiff scans. The GUI toolkit
*PySide (Qt)* does support Tiff, but only shows the first page. We also had
to support Fax compression (CCITT G3/G4), but *Qt* supports this.

As a first approach we copied single pages out of multi-page tiff files
using *tiffcp* or *tiffutil* (OS X) as a temp file for display. A 
sub-optimum

solution, especially for data security reasons.

The second approach replaced this by a tiny modification of the linkage of
the tiff directories (IFD). This way, a tiff file could be patched in memory
with the wanted page offset and then be shown without any files involved.

Unfortunately also this solution was not satisfactory:

- out tiff files have anomalies in their tiff tags like too many null-bytes
  and wrong tag order,

- Qt's implementation of tiff is over-pedantic and ignores all tags 
after the

  smalles error.

Being a good friend of *Fredrik Lundh* and his *PIL* since years, I tried to
attach the problem using this. Sadly Fredrik hasn't worked much on this 
since

2006, and the situation is slightly messed up:

*PIL* has a clean-up of tiff tags, but cannot cope with fax compression 
by default.
There exists a patch since many years, but this complicates the build 
process

and pulls with *libtiff* a lot of dependencies in.

Furthermore, *PIL* is unable to write fax compressed files, but blows 
the data

up to the full size, making this approach only a half solution as well.

After a longer odyssey I saw then the light of a Tiffany lamp:

I use only a hand-full of *PIL*s files, without any modification, 
pretend to unpack
a tiff file, but actually cheating. Only the tiff tags are nicely 
processed and

streamlined, but the compressed data is taken unmodified as-is.
When writing a tiff page out, the existing data is just assembled in the 
correct

order.

For many projects like *didoca* that are processing tiff files without 
editing
their contents, this is a complete solution of their tiff problem. The 
dependencies
of the project stay minimal, there are no binaries required, and Tiffany 
is with

less than 300 lines remarkably small.

Because just 5 files from *PIL* are used and the _imaging module is not 
compiled

at all, I'm talking about "PIL without PIL" ;-)

Tiffany is a stand-alone module and has no interference with *PIL*.
You can see this by looking at ``import_mapper.py``. This module 
modifies ``__import__``
so that the *PIL* modules appear as top-level internally, but become 
sub-modules of

tiffany in ``sys.modules``.

Please let me know if this stuff works for you, and send requests to
 or use the links in the bitbucket website:

https://bitbucket.org/didoca/tiffany

cheers -- Chris

--
Christian Tismer :^)
tismerysoft GmbH : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 :*Starship* http://starship.python.net/
14482 Potsdam: PGP key ->  http://pgp.uni-mainz.de
work +49 173 24 18 776  mobile +49 173 24 18 776  fax n.a.
PGP 0x57F3BF04   9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
  whom do you want to sponsor today?   http://www.stackless.com/

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


Re: Python libraries portable?

2012-06-07 Thread Tim Johnson
* Corey Richardson  [120607 14:19]:
> On Thu, 07 Jun 2012 20:20:47 GMT
> jkells   wrote:
> 
> > We are new to developing applications with Python.  A question came
> > up concerning Python libraries being portable between
> > Architectures.More specifically, can we take a python library
> > that runs on a X86 architecture and run it on a SPARC architecture or
> > do we need to get the native libraries for SPARC?
> > 
> 
> Pure-python libraries should run wherever Python does, if it doesn't,
> that's a bug. C extensions to CPython shouldn't have any platform
> incompatibilities, but of course you'll need to recompile.
  Perhaps this respons to this thread contains a possible solution to my 
question
  subject "Installing MySQLdb via FTP?"

  Does this mean that I could copy my MySQLdb module directly from
  my workstation via ftp to a server, and have it work, given that
  sys.path contained the path?

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python libraries portable?

2012-06-07 Thread Corey Richardson
On Thu, 7 Jun 2012 15:09:36 -0800
Tim Johnson   wrote:

>   Does this mean that I could copy my MySQLdb module directly from
>   my workstation via ftp to a server, and have it work, given that
>   sys.path contained the path?
> 

No, absolutely not. MySQLdb is a C extension. Assuming same
architecture and shared libraries, it will *probably* work, but no
guarantees. If any of those are different, even slightly, it will break.

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


Re: Python libraries portable?

2012-06-07 Thread Tim Johnson
* Corey Richardson  [120607 15:20]:
> On Thu, 7 Jun 2012 15:09:36 -0800
> Tim Johnson   wrote:
> 
> >   Does this mean that I could copy my MySQLdb module directly from
> >   my workstation via ftp to a server, and have it work, given that
> >   sys.path contained the path?
> > 
> 
> No, absolutely not. MySQLdb is a C extension. Assuming same
> architecture and shared libraries, it will *probably* work, but no
> guarantees. If any of those are different, even slightly, it will break.
  Yeah, you're right - I knew that and I had forgotten!
  Sorry.
  So what to do if I can't install from the command line?
  I could use python's external command tools like
  subprocess.call(), but am not sure what the implications would be
  since privileges might be limited.

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python libraries portable?

2012-06-07 Thread Corey Richardson
On Thu, 7 Jun 2012 16:43:26 -0800
Tim Johnson   wrote:

>   So what to do if I can't install from the command line?
>   I could use python's external command tools like
>   subprocess.call(), but am not sure what the implications would be
>   since privileges might be limited.
> 

https://github.com/petehunt/PyMySQL/ is your best option, when it comes
to using mysql without C extensions. I don't even know if it works, but
it's the only one I could fine.

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


Re: Python libraries portable?

2012-06-07 Thread Tim Johnson
* Corey Richardson  [120607 17:01]:
> On Thu, 7 Jun 2012 16:43:26 -0800
> Tim Johnson   wrote:
> 
> >   So what to do if I can't install from the command line?
> >   I could use python's external command tools like
> >   subprocess.call(), but am not sure what the implications would be
> >   since privileges might be limited.
> > 
> 
> https://github.com/petehunt/PyMySQL/ is your best option, when it comes
> to using mysql without C extensions. I don't even know if it works, but
> it's the only one I could fine.
   Thanks, but I need to add my own thread about how to install on a
   server without the command line being available? I kind of
   hijacked this one.. Will post tomorrow.
   cheers
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what gui designer is everyone using

2012-06-07 Thread CM
On Jun 5, 10:10 am, Mark R Rivet  wrote:
> I want a gui designer that writes the gui code for me. I don't want to
> write gui code. what is the gui designer that is most popular?
> I tried boa-constructor, and it works, but I am concerned about how
> dated it seems to be with no updates in over six years.

Boa Constructor.  Very happy with it.  Mostly use it for the IDE these
days, as it already served to help build the GUI.



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