Tuesday, April 13, 2010

comp.lang.python - 25 new messages in 12 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Constructing an if statement from the client data in python - 4 messages, 3
authors
http://groups.google.com/group/comp.lang.python/t/6c5a7a542eb39dbd?hl=en
* Handling quotes in xml.dom text nodes - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/0b2a583f147f1cd7?hl=en
* curious about python version numbers - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/f8a5028affe772ed?hl=en
* how to get text from a html file? - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/9f64ab3d5ee968ba?hl=en
* HTMLParser can't read japanese - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/86fb4a74b8ae55ba?hl=en
* Python, CGI and Sqlite3 - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/cb8538e05d7dd01f?hl=en
* A 'foolproof' way to query inheritance tree? numbers.Real in 2.6) - 2
messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/bd97c8e475e4da67?hl=en
* Download Visual Studio Express 2008 now - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/65e34924e7d42c90?hl=en
* packaging multiple python scripts as Windows exe file - 2 messages, 2
authors
http://groups.google.com/group/comp.lang.python/t/3ef1def17875655c?hl=en
* Creating a standalone application - 3 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/c7afc0febb46bcdc?hl=en
* mailbox multipart - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/18cb036d827f5de9?hl=en
* when should I explicitely close a file? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/af8041d4cf076178?hl=en

==============================================================================
TOPIC: Constructing an if statement from the client data in python
http://groups.google.com/group/comp.lang.python/t/6c5a7a542eb39dbd?hl=en
==============================================================================

== 1 of 4 ==
Date: Tues, Apr 13 2010 9:25 am
From: Benjamin Kaplan


All the operators are available as functions in the operator module.
Just use a dict to select the correct function.


import operator

ops = {"and": operator.and_, "or": operator.or_}

op1 = ops[lo1]
op3 = ops[lo3]

if op3( op1( condition1, condition2), condition4) :
#do something

On Tue, Apr 13, 2010 at 11:56 AM, Vishal Rana <ranavishal@gmail.com> wrote:
>
> Hi,
>
> I need to construct an if statement from the data coming from the client as below:
>
> conditions: condition1, condition2, condition3, condition4 logical operators: lo1, lo2, lo3 (Possible values: "and" "or")
>
> Eg.
>
> if condition1 lo1 condition2 lo3 condition4:
>
>     # Do something
>
> I can think of eval/exec but not sure how safe they are! Any better approach or alternative? Appreciate your responses :)
>
> PS: Client-side: Flex, Server-side: Python, over internet
>
> Thanks
>
> Vishal
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


== 2 of 4 ==
Date: Tues, Apr 13 2010 10:58 am
From: Terry Reedy


On 4/13/2010 11:56 AM, Vishal Rana wrote:
> Hi,
>
> I need to construct an if statement from the data coming from the client
> as below:
>
> conditions: condition1, condition2, condition3, condition4 logical
> operators: lo1, lo2, lo3 (Possible values: "and" "or")
>
> Eg.
>
> |if condition1 lo1 condition2 lo3 condition4:
>
> # Do something
>
> |
>
> I can think of eval/exec but not sure how safe they are! Any better
> approach or alternative? Appreciate your responses :)
>
> PS: Client-side: Flex, Server-side: Python, over internet

Unless Python on the server is properly sandboxed (not easy), this is
not safe. Consider 'conditions' like

10000**10000
__import__('subprocess').Popen(['format', 'C:']) # don't test this !!!

I may not have the latter exactly correct but you should get the idea.
So sandboxing requires OS supervision and limitation of time and space
consumption as well as removal from Python of dangerous builtins and
modules.

Terry Jan Reedy

== 3 of 4 ==
Date: Tues, Apr 13 2010 12:29 pm
From: Chris Rebert


On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana <ranavishal@gmail.com> wrote:
> Hi,
>
> I need to construct an if statement from the data coming from the client as
> below:
>
> conditions: condition1, condition2, condition3, condition4 logical
> operators: lo1, lo2, lo3 (Possible values: "and" "or")
>
> Eg.
>
> if condition1 lo1 condition2 lo3 condition4:
>
>     # Do something
>
> I can think of eval/exec but not sure how safe they are! Any better approach
> or alternative? Appreciate your responses :)
>
> PS: Client-side: Flex, Server-side: Python, over internet

Do you literally get a string, or do/could you get the expression in a
more structured format?

Cheers,
Chris
--
http://blog.rebertia.com


== 4 of 4 ==
Date: Tues, Apr 13 2010 1:08 pm
From: Chris Rebert


> On Tue, Apr 13, 2010 at 12:29 PM, Chris Rebert <clp2@rebertia.com> wrote:
>> On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana <ranavishal@gmail.com> wrote:
>> > Hi,
>> >
>> > I need to construct an if statement from the data coming from the client
>> > as
>> > below:
>> >
>> > conditions: condition1, condition2, condition3, condition4 logical
>> > operators: lo1, lo2, lo3 (Possible values: "and" "or")
>> >
>> > Eg.
>> >
>> > if condition1 lo1 condition2 lo3 condition4:
>> >
>> >     # Do something
>> >
>> > I can think of eval/exec but not sure how safe they are! Any better
>> > approach
>> > or alternative? Appreciate your responses :)
>> >
>> > PS: Client-side: Flex, Server-side: Python, over internet
>>
>> Do you literally get a string, or do/could you get the expression in a
>> more structured format?

On Tue, Apr 13, 2010 at 12:46 PM, Vishal Rana <ranavishal@gmail.com> wrote:
> Its a form at the client side where you can construct a query
> using different conditions and logical operators.
> I can take it in any format!, currently it comes as a parameters to an RPC.

Well, then if possible, I'd have the form send it back in a Lisp-like
format and run it through a simple evaluator:

def and_(conds, context):
for cond in conds:
if not evaluate(cond, context):
return False
return True

def or_(conds, context):
for cond in conds:
if evaluate(cond, context):
return True
return False

def greater_than(pair, context):
left, right = [context[name] for name in pair]
return left > right

OPNAME2FUNC = {"and" : and_, "or" : or_, ">" : greater_than}

def evaluate(expr, context):
op_name, operands = expr[0], expr[1:]
return OPNAME2FUNC[op_name](operands, context)

expression = ["and", [">", "x", "y"], ["or", [">", "y", "z"], [">", "x", "z"]]]
variables = {"x" : 7, "y" : 3, "z" : 5}
print evaluate(expression, variables)

If it's just ands and ors of bare variables (no '>' or analogous
operations), the code can be simplified a bit.

Cheers,
Chris
--
http://blog.rebertia.com

==============================================================================
TOPIC: Handling quotes in xml.dom text nodes
http://groups.google.com/group/comp.lang.python/t/0b2a583f147f1cd7?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Apr 13 2010 9:35 am
From: Stefan Behnel


Chaim Krause, 13.04.2010 17:26:
> I am building a web page (HTML 4.01 Transitional) using
> xml.dom.minidom. I have created a<script> node and I have added the
> Javascript as a child text node. The issue is that the Javascript
> includes quotes that I want to survive when I write the XML to a file.
> The issue for me is that they are translated into&quot;.

You should use an HTML generator tool rather than a generic XML tool like
xml.dom.minidom. You need something that knows that the <script> tag
contains CDATA content in HTML, and that can serialise in an HTML aware way
(self-closing tags, etc.).

Check the Python Wiki or PyPI, they have tons of HTML generators.

Stefan

== 2 of 2 ==
Date: Tues, Apr 13 2010 9:45 am
From: Chaim Krause


Stefan,

Thank you. The reason that I am using xml.dom.minidom is that I am
restricted to a stock RHEL5 stack. That means 2.4 with nothing added.
(Welcome to US Army IT !!!)

But, I figured out that I need to back up from xml.dom.minidom to
xml.dom and then I can use createCDATASection and get what I need.

Now I am off to fix the issue solving this unmasked. (Google Maps API
v3 doesn't like to be in an HTML 4.01 Transitional page. Ugh)

Thanks

==============================================================================
TOPIC: curious about python version numbers
http://groups.google.com/group/comp.lang.python/t/f8a5028affe772ed?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Apr 13 2010 10:28 am
From: Terry Reedy


On 4/13/2010 9:54 AM, Alex Hall wrote:
> Thanks, everyone, for the answers! I am still on 2.6 since so many
> packages rely on it. I got 3.1 at first, but I could not get much to
> work with it so I installed 2.6 and have only found one package which
> refuses to work, instead of a lot of them.

2.7, now in beta, is aimed at a June release with 3.2 to follow maybe in
Dec.

I believe the numpy folks are targeting 3.2. That will enable packages
that depend on numpy to do the same.


==============================================================================
TOPIC: how to get text from a html file?
http://groups.google.com/group/comp.lang.python/t/9f64ab3d5ee968ba?hl=en
==============================================================================

== 1 of 3 ==
Date: Tues, Apr 13 2010 11:12 am
From: Chris Colbert


On Tue, Apr 13, 2010 at 1:58 PM, varnikat t <varnikat22@gmail.com> wrote:
>
> Hi,
> Can anyone tell me how to get text from a html file?I am trying to display
> the text of an html file in textview(of glade).If i directly display the
> file,it shows with html tags and attributes, etc. in textview.I don't want
> that.I just want the text.
> Can someone help me with this?
>
>
> Regards
> Varnika Tewari
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>

You should look into beautiful soup

http://www.crummy.com/software/BeautifulSoup/


== 2 of 3 ==
Date: Tues, Apr 13 2010 11:22 am
From: Grant Edwards


On Tue, Apr 13, 2010 at 1:58 PM, varnikat t <varnikat22@gmail.com> wrote:

> Can anyone tell me how to get text from a html file?I am trying to display
> the text of an html file in textview(of glade).If i directly display the
> file,it shows with html tags and attributes, etc. in textview.I don't want
> that.I just want the text.

[Parent article is unavailable on gmane, so my reply isn't quite in
the right place in the tree]

I generally just use something like this:

Popen(['w3m','-dump',filename],stdout=PIPE).stdout.read()

I'm sure there are more complex ways...

--
Grant Edwards grant.b.edwards Yow! I'm having fun
at HITCHHIKING to CINCINNATI
gmail.com or FAR ROCKAWAY!!


== 3 of 3 ==
Date: Tues, Apr 13 2010 11:26 am
From: Stefan Behnel


varnikat t, 13.04.2010 19:58:
> Can anyone tell me how to get text from a html file?I am trying to display
> the text of an html file in textview(of glade).If i directly display the
> file,it shows with html tags and attributes, etc. in textview.I don't want
> that.I just want the text.
> Can someone help me with this?

E.g. using lxml.html:

import lxml.html as H
html = H.parse("the_html_file.html")
print H.tostring(html, method="text")

Stefan


==============================================================================
TOPIC: HTMLParser can't read japanese
http://groups.google.com/group/comp.lang.python/t/86fb4a74b8ae55ba?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Apr 13 2010 11:51 am
From: John Nagle


Yes. Try "cmd /u" to get a Unicode console.

HTMLparser should already have converted from Shift-JIS
to Unicode, so the "print" is outputting Unicode.

John Nagle

Stefan Behnel wrote:
> Dodo, 13.04.2010 13:40:
>> Here's a small script to generate again the error
>> running windows 7 with python 3.1
>>
>> FILE : parseShift.py
>>
>> import urllib.request as url
>> from html.parser import HTMLParser
>>
>> class myParser(HTMLParser):
>> def handle_starttag(self, tag, attrs):
>> print("Start of %s tag : %s" % (tag, attrs))
>
> You problem is the last line. Your terminal does not support printing
> the text, so you get an exception here.
>
> Either change your terminal encoding to a suitable encoding, or write
> the text to an encoded file instead (see the 'encoding' option of the
> open() function for that).
>
> Stefan
>

==============================================================================
TOPIC: Python, CGI and Sqlite3
http://groups.google.com/group/comp.lang.python/t/cb8538e05d7dd01f?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Apr 13 2010 11:36 am
From: Tim Chase


On 04/13/2010 12:41 PM, Majdi Sawalha wrote:
> import sqlite3
>
> statement? and it gives the following error
> ImportError: No module named sqlite3,
>
> i tried it on python shell and all statements are work well.

A couple possible things are happening but here are a few that
pop to mind:

1) you're running different versions of python (sqlite was
bundled beginning in 2.5, IIRC) so when you run from a shell, you
get python2.5+ but your CGI finds an older version. Your CGI can
dump the value of sys.version which you can compare with your
shell's version

2) the $PYTHONPATH is different between the two. Check the
contents of sys.path in both the shell and the CGI program to see
if they're the same. You might also dump the results of
os.environ.get('PYTHONPATH', None) to see if an environment
variable specifies the $PYTHONPATH differently

3) while it reads correctly above, it's theoretically possible
that you have a spelling error like "import sqllite3"? I've been
stung once or twice by this sort of problem so it's not entirely
impossible :)

-tkc

== 2 of 2 ==
Date: Tues, Apr 13 2010 11:54 am
From: "Ahmed, Shakir"


-----Original Message-----
From: python-list-bounces+shahmed=sfwmd.gov@python.org
[mailto:python-list-bounces+shahmed=sfwmd.gov@python.org] On Behalf Of
Tim Chase
Sent: Tuesday, April 13, 2010 2:36 PM
To: Majdi Sawalha
Cc: python-list@python.org
Subject: Re: Python, CGI and Sqlite3

On 04/13/2010 12:41 PM, Majdi Sawalha wrote:
> import sqlite3
>
> statement? and it gives the following error
> ImportError: No module named sqlite3,
>
> i tried it on python shell and all statements are work well.

A couple possible things are happening but here are a few that
pop to mind:

1) you're running different versions of python (sqlite was
bundled beginning in 2.5, IIRC) so when you run from a shell, you
get python2.5+ but your CGI finds an older version. Your CGI can
dump the value of sys.version which you can compare with your
shell's version

2) the $PYTHONPATH is different between the two. Check the
contents of sys.path in both the shell and the CGI program to see
if they're the same. You might also dump the results of
os.environ.get('PYTHONPATH', None) to see if an environment
variable specifies the $PYTHONPATH differently

3) while it reads correctly above, it's theoretically possible
that you have a spelling error like "import sqllite3"? I've been
stung once or twice by this sort of problem so it's not entirely
impossible :)

-tkc

Tim is right, following import works fine with me.

import sqlite3


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


==============================================================================
TOPIC: A 'foolproof' way to query inheritance tree? numbers.Real in 2.6)
http://groups.google.com/group/comp.lang.python/t/bd97c8e475e4da67?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Apr 13 2010 12:15 pm
From: Hans Mulder


Steven D'Aprano wrote:

> Given a class C, is there some way to find out what classes
> issubclass(C, X) will return true for? Obviously you can get a partial
> list, by walking the MRO, but is there a list somewhere of which ABCs
> consider C a subclass?
>
> Presumably the general answer is No, because any class X could happen to
> have a __subclasscheck__ method that returns True when called with C.

New style class method __subclasses__ that returns a list of the immediate
subclasses. By recursing down from object, you can make a list of all new
style classes in your current interpreter. Then use issubclass to find
the ones that consider themselves subclasses of C.

-- HansM


== 2 of 2 ==
Date: Tues, Apr 13 2010 12:33 pm
From: Chris Rebert


On Tue, Apr 13, 2010 at 12:15 PM, Hans Mulder <hansmu@xs4all.nl> wrote:
> Steven D'Aprano wrote:
>> Given a class C, is there some way to find out what classes
>> issubclass(C, X) will return true for? Obviously you can get a partial
>> list, by walking the MRO, but is there a list somewhere of which ABCs
>> consider C a subclass?
>>
>> Presumably the general answer is No, because any class X could happen to
>> have a __subclasscheck__ method that returns True when called with C.
>
> New style class method __subclasses__ that returns a list of the immediate
> subclasses.  By recursing down from object, you can make a list of all new
> style classes in your current interpreter.  Then use issubclass to find
> the ones that consider themselves subclasses of C.

Being pedantic here, but your last statement is the wrong way around:
C is the one who decides which classes should be considered its
subclasses.

Cheers,
Chris
--
http://blog.rebertia.com

==============================================================================
TOPIC: Download Visual Studio Express 2008 now
http://groups.google.com/group/comp.lang.python/t/65e34924e7d42c90?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Apr 13 2010 12:43 pm
From: "Michel Claveau - MVP"


Hi!

Thanks for this idea.

Michel Claveau


== 2 of 2 ==
Date: Tues, Apr 13 2010 1:40 pm
From: Irmen de Jong


On 12-4-2010 22:36, Martin v. Loewis wrote:

> If you are planning to build Python extension modules in the next five
> years, I recommend that you obtain a copy of VS Express, just in case
> Microsoft removes it from their servers.

Thanks for the idea Martin. However I've changed the post title a little because at
first I skipped this post because I thought that it was product spam ;-)

Irmen de Jong.


==============================================================================
TOPIC: packaging multiple python scripts as Windows exe file
http://groups.google.com/group/comp.lang.python/t/3ef1def17875655c?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Apr 13 2010 12:56 pm
From: Mike Driscoll


On Apr 12, 5:20 pm, Alex Hall <mehg...@gmail.com> wrote:
> Hi all,
> While my project is still suffering from major import problems, I will
> soon have to try to package it as a Windows executable file. I do not
> want an installer; I want the user to be able to run the program for
> as long as they want, then to quit (by using a command from inside the
> program) and that is it. Nothing to install, no files to copy, no
> registry editing, just start and use it until done.
>
> I know about the popular solutions for this sort of thing, but I read
> that a DLL is required, and that this dll cannot be (legally)
> distributed by myself? A few questions here:
> 1. Did I read this wrong / is this outdated? Please answer 'yes' as
> this will be a real pain to deal with.
>
> 2. If I must have it but can distribute it, where should it go so my
> program can find it?
>
> 3. If the user must download it for legal reasons, instead of me
> giving it to them, can I just have a Python script take care of it and
> put it in the same directory as the program, so the program can find
> it, or do I need to register the dll with the system? If I need to
> register, does this require admin login?
>
> Thanks as always!
>
> --
> Have a great day,
> Alex (msg sent from GMail website)
> mehg...@gmail.com;http://www.facebook.com/mehgcap


Without knowing the exact DLL you're thinking of, we can't be sure
what the answer is. But I think you're talking about a certain MS DLL
that Python distributes. If so, I've read multiple threads on this
topic that claim that since Python distributes it, there is an implied
permission that you can as well. Since I'm not a lawyer, I can't say
for sure, but the articles I've seen are pretty convincing.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org


== 2 of 2 ==
Date: Tues, Apr 13 2010 1:42 pm
From: Joaquin Abian


On Apr 13, 9:56 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
> On Apr 12, 5:20 pm, Alex Hall <mehg...@gmail.com> wrote:
>
>
>
> > Hi all,
> > While my project is still suffering from major import problems, I will
> > soon have to try to package it as a Windows executable file. I do not
> > want an installer; I want the user to be able to run the program for
> > as long as they want, then to quit (by using a command from inside the
> > program) and that is it. Nothing to install, no files to copy, no
> > registry editing, just start and use it until done.
>
> > I know about the popular solutions for this sort of thing, but I read
> > that a DLL is required, and that this dll cannot be (legally)
> > distributed by myself? A few questions here:
> > 1. Did I read this wrong / is this outdated? Please answer 'yes' as
> > this will be a real pain to deal with.
>
> > 2. If I must have it but can distribute it, where should it go so my
> > program can find it?
>
> > 3. If the user must download it for legal reasons, instead of me
> > giving it to them, can I just have a Python script take care of it and
> > put it in the same directory as the program, so the program can find
> > it, or do I need to register the dll with the system? If I need to
> > register, does this require admin login?
>
> > Thanks as always!
>
> > --
> > Have a great day,
> > Alex (msg sent from GMail website)
> > mehg...@gmail.com;http://www.facebook.com/mehgcap
>
> Without knowing the exact DLL you're thinking of, we can't be sure
> what the answer is. But I think you're talking about a certain MS DLL
> that Python distributes. If so, I've read multiple threads on this
> topic that claim that since Python distributes it, there is an implied
> permission that you can as well. Since I'm not a lawyer, I can't say
> for sure, but the articles I've seen are pretty convincing.
>
> -------------------
> Mike Driscoll
>
> Blog:  http://blog.pythonlibrary.org

the OP probably means MSVCR71.dll that is needed to make single file
executables with py2exe.
This has been discussed elsewhere. Look at http://www.py2exe.org/index.cgi/Tutorial#Step5

joaquin

==============================================================================
TOPIC: Creating a standalone application
http://groups.google.com/group/comp.lang.python/t/c7afc0febb46bcdc?hl=en
==============================================================================

== 1 of 3 ==
Date: Tues, Apr 13 2010 2:02 pm
From: Luis Quesada


Dear all,
I am getting an "expected string without null bytes" error when using
cxfreeze for creating a standalone application (in Linux-Ubuntu). None
of my files has null bytes. I also tried pyinstaller but I got the error
attached at the end.
My program runs fine when executed from eclipse. What is the easiest
way of creating a standalone application? Is there a way of creating the
executable file from eclipse/pydev?
Cheers,
Luis

cxfreeze's output
lquesada@lquesada-laptop:~/workspace/MetroNode/src/models$ cxfreeze
uncovered.py --target-dir dist
copying /usr/lib/pymodules/python2.6/cx_Freeze/bases/Console ->
dist/uncovered
copying /usr/lib/libpython2.6.so.1.0 -> dist/libpython2.6.so.1.0
Traceback (most recent call last):
File "/usr/bin/cxfreeze", line 5, in <module>
main()
File "/usr/lib/pymodules/python2.6/cx_Freeze/main.py", line 170, in main
freezer.Freeze()
File "/usr/lib/pymodules/python2.6/cx_Freeze/freezer.py", line 405,
in Freeze
self._FreezeExecutable(executable)
File "/usr/lib/pymodules/python2.6/cx_Freeze/freezer.py", line 173,
in _FreezeExecutable
exe.copyDependentFiles, scriptModule)
File "/usr/lib/pymodules/python2.6/cx_Freeze/freezer.py", line 333,
in _WriteModules
initModule = finder.IncludeFile(initScript, "cx_Freeze__init__")
File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 386, in
IncludeFile
deferredImports)
File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 259, in
_LoadModule
module.code = compile(fp.read() + "\n", path, "exec")
TypeError: compile() expected string without null bytes
lquesada@lquesada-laptop:~/workspace/MetroNode/src/models$

======================================================================
pyinstaller's output

lquesada@lquesada-laptop:~/workspace/MetroNode/src/models$ python
~/pyinstaller-1.4/Build.py uncovered.spec
checking Analysis
building Analysis because outAnalysis0.toc non existent
running Analysis outAnalysis0.toc
Analyzing: /home/lquesada/pyinstaller-1.4/support/_mountzlib.py
Analyzing: /home/lquesada/pyinstaller-1.4/support/useUnicode.py
Analyzing: uncovered.py
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_conflict.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_nodesel.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_vars.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_heur.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_branch.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_sepa.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_prop.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_presol.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_soln.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_cons.so:
No such file or directory
ldd:
/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_scip.so:
No such file or directory
Warnings written to
/home/lquesada/workspace/MetroNode/src/models/warnuncovered.txt
checking PYZ
rebuilding outPYZ1.toc because outPYZ1.pyz is missing
building PYZ outPYZ1.toc
checking PKG
rebuilding outPKG3.toc because outPKG3.pkg is missing
building PKG outPKG3.pkg
Cannot find ('zibopt._conflict.so',
'/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_conflict.so',
1, 'b')
Traceback (most recent call last):
File "/home/lquesada/pyinstaller-1.4/Build.py", line 1160, in <module>
main(args[0], configfilename=opts.configfile)
File "/home/lquesada/pyinstaller-1.4/Build.py", line 1148, in main
build(specfile)
File "/home/lquesada/pyinstaller-1.4/Build.py", line 1111, in build
execfile(spec)
File "uncovered.spec", line 14, in <module>
console=1 )
File "/home/lquesada/pyinstaller-1.4/Build.py", line 661, in __init__
strip_binaries=self.strip, upx_binaries=self.upx, crypt=self.crypt)
File "/home/lquesada/pyinstaller-1.4/Build.py", line 561, in __init__
self.__postinit__()
File "/home/lquesada/pyinstaller-1.4/Build.py", line 196, in __postinit__
self.assemble()
File "/home/lquesada/pyinstaller-1.4/Build.py", line 618, in assemble
archive.build(self.name, mytoc)
File "/home/lquesada/pyinstaller-1.4/archive.py", line 229, in build
self.add(tocentry) # the guts of the archive
File "/home/lquesada/pyinstaller-1.4/carchive.py", line 235, in add
s = open(pathnm, 'rb').read()
IOError: [Errno 20] Not a directory:
'/usr/local/lib/python2.6/dist-packages/python_zibopt-0.5.beta_r97-py2.6-linux-i686.egg/zibopt/_conflict.so'


== 2 of 3 ==
Date: Tues, Apr 13 2010 2:42 pm
From: Lawrence D'Oliveiro


In message <kZ4xn.868$I8.457@news.indigo.ie>, Luis Quesada wrote:

> I am getting an "expected string without null bytes" error when using
> cxfreeze for creating a standalone application (in Linux-Ubuntu).

Why bother? Every decent Linux system will have Python available. Why not
just distribute it as a script?


== 3 of 3 ==
Date: Tues, Apr 13 2010 3:11 pm
From: Luis Quesada


Lawrence D'Oliveiro wrote:
> In message <kZ4xn.868$I8.457@news.indigo.ie>, Luis Quesada wrote:
>
>> I am getting an "expected string without null bytes" error when using
>> cxfreeze for creating a standalone application (in Linux-Ubuntu).
>
> Why bother? Every decent Linux system will have Python available. Why not
> just distribute it as a script?

Well every decent Linux system will have Java available too but it is
still preferable to distribute jar files. The point is that I don't want
to force my users to install all the packages that I had to install.
Cheers,
Luis

==============================================================================
TOPIC: mailbox multipart
http://groups.google.com/group/comp.lang.python/t/18cb036d827f5de9?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Apr 13 2010 2:54 pm
From: janwillem


I am trying to analyze mailboxes using an iterator:
for key, message in mbox.iteritems():

When message is a simple mail message['date'] results the date.
When, however, it is a multipart message this results in None. How can
you full proof get the "date", "from" and "to" of of a multipart mail
using python?
Thanks janwillem


==============================================================================
TOPIC: when should I explicitely close a file?
http://groups.google.com/group/comp.lang.python/t/af8041d4cf076178?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Apr 13 2010 3:24 pm
From: Chris Rebert


On Tue, Apr 13, 2010 at 3:01 PM, gelonida <gelonida@gmail.com> wrote:
> Hi,
>
> I've been told, that following code snippet is not good.
>
> open("myfile","w").write(astring) , because I'm neither explicitely
> closing nor using the new 'with' syntax.
>
> What exactly is the impact of not closing the file explicitely
> (implicitley with a 'with' block)?
>
> Even with my example
> I'd expected to get an exception raised if not all data could have
> been written.
>
> I'd also expected, that all write data is flushed as soon as the
> filehandle is out of scope (meaning in the next line of my source
> code).

That extremely-quick responsiveness of the garbage-collection
machinery is only guaranteed by CPython, not the language
specification itself, and indeed some of the other implementations
*explicitly don't* make that guarantee (and hence the data may not get
flushed in a timely manner on those implementations). And portability
of code is encouraged, hence the admonishment you encountered.

Cheers,
Chris
--
http://blog.rebertia.com


== 2 of 2 ==
Date: Tues, Apr 13 2010 3:01 pm
From: gelonida


Hi,


I've been told, that following code snippet is not good.


open("myfile","w").write(astring) , because I'm neither explicitely
closing nor using the new 'with' syntax.

What exactly is the impact of not closing the file explicitely
(implicitley with a 'with' block)?


Even with my example
I'd expected to get an exception raised if not all data could have
been written.

I'd also expected, that all write data is flushed as soon as the
filehandle is out of scope (meaning in the next line of my source
code).


Thanks for explaining me exactly what kind of evil I could encounter
with not explicitely closing.

==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate