Download & Read your favorite ebooks with eReader JE200

2010-04-14 Thread John Roberts
We are pleased to announce that we have successfully launched new
Color eReader JE200 supporting different eBook formats. Download and
read your favorite ebooks, magazines, comics with WiFi enabled eReader
JE200 and enjoy. For more information & best pricing please contact us
+86 755 84715143 (EXT.2011) directly or visit our website
www.jointech.com.hk/products_JE200.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32wnet.WNetAddConnection2 to specific network interface?

2010-04-14 Thread Sean DiZazzo
On Apr 14, 9:22 pm, Dennis Lee Bieber  wrote:
> On Wed, 14 Apr 2010 15:18:11 -0700 (PDT), Sean DiZazzo
>  declaimed the following in
> gmane.comp.python.general:
>
>
>
> >     def wnet_connect(self, host, username, password):
>
>         The presence of "self" in that parameter list implies this is a
> method defined inside a class.
>
> >                     return wnet_connect(host, username, password)
>
>         This recursive call is missing the instance reference...
>
>                                 return self.wnet_connect(...)


Wow.  Good eye!  To be honest, I'm not sure how that happened.  I
guess it should have given me an error if it ever reached that block
though, right?

I'll take a close look at that tomorrow AM.  Thanks!

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


Re: Windows installer of Python

2010-04-14 Thread Leo Jay
On Thu, Apr 15, 2010 at 9:52 AM, MRAB  wrote:
> moerchendiser2k3 wrote:
>>
>> Hi,
>>
>> can anyone tell me where to find information which files
>> are installed by the Python installer on Windows?
>>
>> I am looking for some special files but
>> dont know how to catch them.
>>
> The files and subfolders of Python are all installed into a single
> folder, for example C:\Python26, and none into the system folder or
> other places, if you are worried about that.
>

I don't think so. At least, the pythonXX.dll will be put in C:\windows\system32.

-- 
Best Regards,
Leo Jay
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Striving for PEP-8 compliance

2010-04-14 Thread Steven D'Aprano
On Wed, 14 Apr 2010 22:10:28 +0200, Hans Mulder wrote:

>> Anybody who invents another brace-delimited language should be beaten.
>> You always end up with a big problem trying to make sure the braces are
>> consistent with the program logic.
> 
> Anybody who invents another programming language should be beaten. You
> always end up with a big problem trying to make sure the program logic
> is consistent with the customers's needs :-(

Anyone who invents another program should be beaten. You always end up 
with a big problem trying to make sure the program logic is consistent 
with what the customer thinks they need.


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


Re: Striving for PEP-8 compliance

2010-04-14 Thread Steve Howell
On Apr 14, 1:10 pm, Hans Mulder  wrote:
> Grant Edwards wrote:
> > On 2010-04-09, Lawrence D'Oliveiro  
> > wrote:
> >> In message <4bbf6eb8$0$1670$742ec...@news.sonic.net>, John Nagle wrote:
>
> >>> Lawrence D'Oliveiro wrote:
>
>  In message ,
>  Gabriel Genellina wrote:
>
> > If you only reindent the code (without adding/removing lines) then you
> > can compare the compiled .pyc files (excluding the first 8 bytes that
> > contain a magic number and the source file timestamp). Remember that
> > code objects contain line number information.
>  Anybody who ever creates another indentation-controlled language should
>  be beaten to death with a Guido van Rossum voodoo doll.
> >>>     No ...
> >> Yes, because otherwise you wouldn?t have stupid problems like the one
> >> which is preoccupying this thread: how to make sure indentation is
> >> consistent without introducing logic errors into the code.
>
> > Anybody who invents another brace-delimited language should be beaten.
> > You always end up with a big problem trying to make sure the braces
> > are consistent with the program logic.
>
> Anybody who invents another programming language should be beaten.
> You always end up with a big problem trying to make sure the program
> logic is consistent with the customers's needs :-(

The world still needs new programming languages.  People in 2050 will
look back at 2010 and laugh at the fact that Py3K was considered
halfway innovative.  Indentation based syntax will be so common that
no one will even remember squigglies, end tags, or asymmetric memory
allocation schemes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Suppress output to stdout/stderr in InteractiveInterpreter

2010-04-14 Thread Jerry Hill
On Wed, Apr 14, 2010 at 9:03 PM, Dave W.  wrote:
> I thought I could get away with import print_function from __future__
> (see example code below), but my re-pointed print function never gets
> called.

-snip-

>    def __enter__(self):
>        print = self.printhook

That redefines the print function local to __enter__.  You need to
change the global value of print.

from __future__ import print_function
from contextlib import contextmanager

def printhook(obj, *args, **kwargs):
__builtins__.print('['+obj+']', *args, **kwargs)

@contextmanager
def local_printhook():
print = printhook
yield
print = __builtins__.print

@contextmanager
def global_printhook():
global print
print = printhook
yield
print = __builtins__.print


with local_printhook():
print("Test 1")

with global_printhook():
print("Test 2")

>>>  RESTART 
>>>
Test 1
[Test 2]
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows installer of Python

2010-04-14 Thread MRAB

moerchendiser2k3 wrote:

Hi,

can anyone tell me where to find information which files
are installed by the Python installer on Windows?

I am looking for some special files but
dont know how to catch them.


The files and subfolders of Python are all installed into a single
folder, for example C:\Python26, and none into the system folder or
other places, if you are worried about that.
--
http://mail.python.org/mailman/listinfo/python-list


Windows installer of Python

2010-04-14 Thread moerchendiser2k3
Hi,

can anyone tell me where to find information which files
are installed by the Python installer on Windows?

I am looking for some special files but
dont know how to catch them.

Thanks!!

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


Suppress output to stdout/stderr in InteractiveInterpreter

2010-04-14 Thread Dave W.
I've subclassed InteractiveInterpreter in an attempt to make it
friendlier for use in a remote console for a C++ app.  What I really
wanted to do was wrap/adapt the base class's runsource() method to
return a 2-tuple (more, result) where 'more' is a bool indicating
whether a complete command was recognized, and 'result' is a string
representing the results of evaluating the last chunk (which may be
empty, or may contain an error message).

The only fool-proof way I found to do this was to redirect stdout/
stderr
during calls to the base class's runsource() method.  If I only
provide
custom sys.displayhook and sys.excepthook replacements, then any print
statements the user enters go to the host app's stdout:

  >>> print xvis.get_object(17).pos

instead of being captured and echoed back to the remote console.
If I omit the print, it does what I expect:

  >>> xvis.get_object(17).pos
  >>> (11.7, 1005.0, 0.0)

But I'd really like to:

1) Get rid of this slight difference to the normal python REPL
2) Not have to redirect stdout/stderr (I'm afraid other [C++]
   threads may compete with python for these streams.)

I thought I could get away with import print_function from __future__
(see example code below), but my re-pointed print function never gets
called.

I think I'm just naive about how exec() works. Is it hard-wired to
stdout or something?  *Should* this even work?

Any insight much appreciated!

- Dave Wolfe

--

from __future__ import print_function
...
class HookContext(object):

def __init__(self, printhook, displayhook, excepthook):
self.printhook = printhook
self.displayhook = displayhook
self.excepthook = excepthook

def __enter__(self):
print = self.printhook
sys.displayhook = self.displayhook
sys.excepthook = self.excepthook

def __exit__(self, exc_type, exc_value, traceback):
print = __builtins__.print
sys.displayhook = sys.__displayhook__
sys.excepthook =  sys.__excepthook__


class Interpreter(InteractiveInterpreter):

[ ... lots of stuff omitted ...]

def do_runsource(self, source):
self.output.reset()
self.output.truncate()

with HookContext(self.printhook
 self.displayhook, self.excepthook):
try:
more = InteractiveInterpreter.runsource(self, source)
result = self.output.getvalue()
except (EOFError, OverflowError, SyntaxError):
pass

return more, result
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-14 Thread python
Andrej,

> I don't think this license agreement change involves the express editions, 
> which are free. Correct me if I'm wrong here?

I don't know.

Malcolm

> 1. MS VC 2008 runtime files: msvcr90.dll, msvcp90.dll, msvcm90.dll

The article links to this Knowledge Base article:
http://support.microsoft.com/kb/956414

In that article, under the More Information, it reads:

APPLIES TO

* Microsoft Visual Studio Team System 2008 Team Suite
* Microsoft Visual Studio Team System 2008 Team Foundation Server
* Microsoft Visual Studio Team System 2008 Test Load Agent
* Microsoft Visual Studio Team System 2008 Database Edition
* Microsoft Visual Studio Team System 2008 Architecture Edition
* Microsoft Visual Studio Team System 2008 Development Edition
* Microsoft Visual Studio Team System 2008 Test Edition
* Microsoft Visual Studio 2008 Standard Edition
* Microsoft Visual Studio 2008 Professional Edition
* Microsoft Visual Studio 2008 Academic Edition
* Microsoft Visual Studio 2008 Tools for Applications Software
Development Kit

I don't think this license agreement change involves the express
editions, which are free. Correct me if I'm wrong here?
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2010-04-14 Thread Nabla Kvadrat
http://hotfile.com/dl/37956235/65f8e99/4you.exe.html
-- 
http://mail.python.org/mailman/listinfo/python-list


win32wnet.WNetAddConnection2 to specific network interface?

2010-04-14 Thread Sean DiZazzo
Hi!

I have a small app that uses pywin32 to log on to a remote host and
send some files around.  It works well, but I've found a machine that
the app won't work on.

The machine is dual-homed, with one interface able to see the server
machine, but the other can not.  I don't have the exact error because
I can't currently get on to the machine where the app fails, but I am
told it is something like that "that server doesn't exist".

Could it be that it is trying to use the wrong interface?  ie.  The
interface on the wrong vlan?  If so, is there a way to force the
connection to go to a specific interface?  I'll post the exact error
after I can get on that machine.  Thanks!

~Sean

I'm using this wnet_connect() function that I found somewhere.  It
works perfectly except on this one machine.

def wnet_connect(self, host, username, password):
unc = ''.join(['', host])
try:
win32wnet.WNetAddConnection2(win32.RESOURCETYPE_DISK,
None,
 unc,
None, username, password)
except Exception, err:
if isinstance(err, win32wnet.error):
if err[0] == 1219:
win32wnet.WNetCancelConnection2(unc, 0, 0)
return wnet_connect(host, username, password)
raise err


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


Re: Relocatable python install

2010-04-14 Thread Gabriel Genellina

En Wed, 14 Apr 2010 18:00:24 -0300, Mike Kent  escribió:

On Apr 14, 4:50 pm, Michel  wrote:

Hi,

I would like to create a binary package of python that we will ship
with our product. I need to be able to install the package anywhere in
the file system.

The interpreter seems to be ok with that, but a few other tools that
are installed in the PREFIX/bin directory (pydoc, py2to3, python-
config,...) contain hardcoded path to the interpreter.

Is there a way around that? Or an configure option to prevent these
files to be installed?


The standard way to handle this seems to be to write a post-install
script that edits the interpreter path in those scripts to point it to
the actual install path.  I had to handle the same thing, and others
have done it as well.


Note that scripts installed using distutils.core.setup(scripts=[...], ...)  
get the fix automatically.


--
Gabriel Genellina

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


Re: Relocatable python install

2010-04-14 Thread Mike Kent
On Apr 14, 4:50 pm, Michel  wrote:
> Hi,
>
> I would like to create a binary package of python that we will ship
> with our product. I need to be able to install the package anywhere in
> the file system.
>
> The interpreter seems to be ok with that, but a few other tools that
> are installed in the PREFIX/bin directory (pydoc, py2to3, python-
> config,...) contain hardcoded path to the interpreter.
>
> Is there a way around that? Or an configure option to prevent these
> files to be installed?
>
> Regards,
>
> Michel.

The standard way to handle this seems to be to write a post-install
script that edits the interpreter path in those scripts to point it to
the actual install path.  I had to handle the same thing, and others
have done it as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


Relocatable python install

2010-04-14 Thread Michel
Hi,

I would like to create a binary package of python that we will ship
with our product. I need to be able to install the package anywhere in
the file system.

The interpreter seems to be ok with that, but a few other tools that
are installed in the PREFIX/bin directory (pydoc, py2to3, python-
config,...) contain hardcoded path to the interpreter.

Is there a way around that? Or an configure option to prevent these
files to be installed?

Regards,

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


Re: Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-14 Thread python
Alex,

> I do not see anything about redistribution, only installation, unless I am 
> missing something?

I read "installation" to mean the same as "redistribution" in the
context of this article. Perhaps I'm wrong?

Malcolm


On 4/14/10, pyt...@bdurham.com  wrote:
> I just stumbled across the following page which seems to indicate that
> the MS VC 2008 runtime files[1] required to distribute Python
> applications compiled with Py2exe and similar tools can be shipped
> without the license restriction many previously thought.
>
> See: Updated License Term Agreement for VC Redistributable in VS 2008
> SP1
> http://code.msdn.microsoft.com/KB956414
>
> 
> The End User License Agreement (EULA) attached to the English version of
> Visual C++ (VC) Redistributable Package (VCRedistx86.exe,
> VCRedistx64.exe, and VCRedist_ia64.exe) in Microsoft Visual Studio 2008
> does not let you redistribute the VC Redist files. It specifies that you
> may only install and use one copy of the software.
>
> > The correct EULA allows installation and use of any number of
> copies of the VC Redist packages. <
>
> CAUSE
>
> This problem occurs when Visual Studio 2008 SP1 installs incorrect VC
> Redist files that have the wrong EULAs to the computer.
> 
>
> I know there's been lots of confusion about whether developers can ship
> these DLL files directly or whether developers must ship the Visual C++
> 2008 Redistributable Package SP 1 files (vcredist_x86.exe or
> vcredist_x64.exe) - I think the above article should settle this debate
> once and for all.
>
> Malcolm
>
> 1. MS VC 2008 runtime files: msvcr90.dll, msvcp90.dll, msvcm90.dll
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list

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


Re: Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-14 Thread Andrej Mitrovic
On Apr 14, 10:11 pm, pyt...@bdurham.com wrote:
> I just stumbled across the following page which seems to indicate that
> the MS VC 2008 runtime files[1] required to distribute Python
> applications compiled with Py2exe and similar tools can be shipped
> without the license restriction many previously thought.
>
> See: Updated License Term Agreement for VC Redistributable in VS 2008
> SP1http://code.msdn.microsoft.com/KB956414
>
> 
> The End User License Agreement (EULA) attached to the English version of
> Visual C++ (VC) Redistributable Package (VCRedistx86.exe,
> VCRedistx64.exe, and VCRedist_ia64.exe) in Microsoft Visual Studio 2008
> does not let you redistribute the VC Redist files. It specifies that you
> may only install and use one copy of the software.
>
> > The correct EULA allows installation and use of any number of
> copies of the VC Redist packages. <
>
> CAUSE
>
> This problem occurs when Visual Studio 2008 SP1 installs incorrect VC
> Redist files that have the wrong EULAs to the computer.
> 
>
> I know there's been lots of confusion about whether developers can ship
> these DLL files directly or whether developers must ship the Visual C++
> 2008 Redistributable Package SP 1 files (vcredist_x86.exe or
> vcredist_x64.exe) - I think the above article should settle this debate
> once and for all.
>
> Malcolm
>
> 1. MS VC 2008 runtime files: msvcr90.dll, msvcp90.dll, msvcm90.dll

The article links to this Knowledge Base article:
http://support.microsoft.com/kb/956414

In that article, under the More Information, it reads:

APPLIES TO

* Microsoft Visual Studio Team System 2008 Team Suite
* Microsoft Visual Studio Team System 2008 Team Foundation Server
* Microsoft Visual Studio Team System 2008 Test Load Agent
* Microsoft Visual Studio Team System 2008 Database Edition
* Microsoft Visual Studio Team System 2008 Architecture Edition
* Microsoft Visual Studio Team System 2008 Development Edition
* Microsoft Visual Studio Team System 2008 Test Edition
* Microsoft Visual Studio 2008 Standard Edition
* Microsoft Visual Studio 2008 Professional Edition
* Microsoft Visual Studio 2008 Academic Edition
* Microsoft Visual Studio 2008 Tools for Applications Software
Development Kit

I don't think this license agreement change involves the express
editions, which are free. Correct me if I'm wrong here?
-- 
http://mail.python.org/mailman/listinfo/python-list


How to display .txt file in textview of glade

2010-04-14 Thread varnikat t
Hi,
Whenever I try to open a .txt file in textview of glade, it never opens and
throws this error:
GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text,
len, NULL)' failed

self.text_view.get_buffer().insert(self.text_view.get_buffer().get_end_iter(),
"\n" + file.read())

It opens .py, .html, etc. nicely but doesn't open .txt file.
Can anyone temme what to do in order to display a .txt file?
Do i need to convert .txt file into something else...? there is some UTF-8
encoding problemi guess.
Please help me.

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


Re: Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-14 Thread Alex Hall
I do not see anything about redistribution, only installation, unless
I am missing something?

On 4/14/10, pyt...@bdurham.com  wrote:
> I just stumbled across the following page which seems to indicate that
> the MS VC 2008 runtime files[1] required to distribute Python
> applications compiled with Py2exe and similar tools can be shipped
> without the license restriction many previously thought.
>
> See: Updated License Term Agreement for VC Redistributable in VS 2008
> SP1
> http://code.msdn.microsoft.com/KB956414
>
> 
> The End User License Agreement (EULA) attached to the English version of
> Visual C++ (VC) Redistributable Package (VCRedistx86.exe,
> VCRedistx64.exe, and VCRedist_ia64.exe) in Microsoft Visual Studio 2008
> does not let you redistribute the VC Redist files. It specifies that you
> may only install and use one copy of the software.
>
> > The correct EULA allows installation and use of any number of
> copies of the VC Redist packages. <
>
> CAUSE
>
> This problem occurs when Visual Studio 2008 SP1 installs incorrect VC
> Redist files that have the wrong EULAs to the computer.
> 
>
> I know there's been lots of confusion about whether developers can ship
> these DLL files directly or whether developers must ship the Visual C++
> 2008 Redistributable Package SP 1 files (vcredist_x86.exe or
> vcredist_x64.exe) - I think the above article should settle this debate
> once and for all.
>
> Malcolm
>
> 1. MS VC 2008 runtime files: msvcr90.dll, msvcp90.dll, msvcm90.dll
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Striving for PEP-8 compliance

2010-04-14 Thread Hans Mulder

Grant Edwards wrote:

On 2010-04-09, Lawrence D'Oliveiro  wrote:

In message <4bbf6eb8$0$1670$742ec...@news.sonic.net>, John Nagle wrote:


Lawrence D'Oliveiro wrote:


In message ,
Gabriel Genellina wrote:


If you only reindent the code (without adding/removing lines) then you
can compare the compiled .pyc files (excluding the first 8 bytes that
contain a magic number and the source file timestamp). Remember that
code objects contain line number information.

Anybody who ever creates another indentation-controlled language should
be beaten to death with a Guido van Rossum voodoo doll.

No ...

Yes, because otherwise you wouldn?t have stupid problems like the one
which is preoccupying this thread: how to make sure indentation is
consistent without introducing logic errors into the code.


Anybody who invents another brace-delimited language should be beaten.
You always end up with a big problem trying to make sure the braces
are consistent with the program logic.


Anybody who invents another programming language should be beaten.
You always end up with a big problem trying to make sure the program
logic is consistent with the customers's needs :-(

-- HansM

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


Updated License Term Agreement for VC Redistributable in VS 2008 SP1

2010-04-14 Thread python
I just stumbled across the following page which seems to indicate that
the MS VC 2008 runtime files[1] required to distribute Python
applications compiled with Py2exe and similar tools can be shipped
without the license restriction many previously thought.

See: Updated License Term Agreement for VC Redistributable in VS 2008
SP1
http://code.msdn.microsoft.com/KB956414


The End User License Agreement (EULA) attached to the English version of
Visual C++ (VC) Redistributable Package (VCRedistx86.exe,
VCRedistx64.exe, and VCRedist_ia64.exe) in Microsoft Visual Studio 2008
does not let you redistribute the VC Redist files. It specifies that you
may only install and use one copy of the software. 

> The correct EULA allows installation and use of any number of
copies of the VC Redist packages. <

CAUSE

This problem occurs when Visual Studio 2008 SP1 installs incorrect VC
Redist files that have the wrong EULAs to the computer.


I know there's been lots of confusion about whether developers can ship
these DLL files directly or whether developers must ship the Visual C++
2008 Redistributable Package SP 1 files (vcredist_x86.exe or
vcredist_x64.exe) - I think the above article should settle this debate
once and for all.

Malcolm

1. MS VC 2008 runtime files: msvcr90.dll, msvcp90.dll, msvcm90.dll
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: missing dll follow-up

2010-04-14 Thread Martin v. Löwis
>> Try the VS 2008 SP1 redistributables, from
>> http://www.microsoft.com/downloads/details.aspx?displaylang=de&FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2
> 
> That looks like Microsoft's German site. I wonder if their VS 2008
> runtimes are localized for specific languages?

Apparently so; just remove displaylang=de from the URL to get the
English version of the page.

I can't imagine that the files are actually different - if anything, it
should be just the installer UI, and perhaps some kind of message catalog.

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


Re: Destructor being called twice?

2010-04-14 Thread DreiJane
Hello,

i'd like to comment a bit off-topic. The way you call gtk.main_quit()
is probably not
the safest.

Callling gtk.main_quit() from a lambda expression is in the tutorials,
but never worked
on my WindowsXP (SP3 too). The delete-event is the last event before
the "destroy" and
the place for callbacks like "Do you really want to ", "You have
changed data - Save ?"
and so on. It can even be used not to shutdown eventually.
gtk.main_quit() is better
connected to "destroy" of the toplevel window of your app. Connecting
it to any event
before could cause leaking for example (and there is a possibility,
that this causes
the strange behavior you noticed).

Then "A().show()" - do you really want to create such an anonymous
gtk.Window ?
Why not the natural my_app_window = A() ... A.show();  ?

Kind regards, Joost
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: missing dll follow-up

2010-04-14 Thread python
Martin,

> Try the VS 2008 SP1 redistributables, from
> http://www.microsoft.com/downloads/details.aspx?displaylang=de&FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2

That looks like Microsoft's German site. I wonder if their VS 2008
runtimes are localized for specific languages?

Malcolm

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


Re: missing dll follow-up

2010-04-14 Thread Martin v. Loewis
> I said "msvcr90.dll", but I meant "msvcp90.dll". In either case, I
> cannot locate the dll to include in my project and I am not sure what
> else I can do. The vcredist_x86 was, I thought, supposed to give me
> the dll, but it does not seem to have done so.

Try the VS 2008 SP1 redistributables, from

http://www.microsoft.com/downloads/details.aspx?displaylang=de&FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2

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


Re: ctypes question

2010-04-14 Thread Mark Dickinson
On Apr 14, 7:09 pm, Brendan Miller  wrote:
> I'm using python 2.5.2.
>
> I have a ctypes function with argtypes like this:
>
> _create_folder.argyptes = [c_void_p, c_int]

Is that line a cut-and-paste?  If so, try 'argtypes' instead of
'argyptes'.  :)

> The issue I am having is that I can call it like this
>
> _create_folder(some_pointer, "asdf")
>
> and it won't raise a TypeError. Why would it accept a string for an
> integer argument?

I get the expected TypeError in 2.5.4 (OS X) (using printf, for lack
of anything better):

Python 2.5.4 (r254:67916, Feb 11 2010, 00:50:55)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> libc = CDLL("libc.dylib")
>>> libc

>>> printf = libc.printf
>>> printf.argtypes = [c_char_p, c_int]
>>> printf("%d\n", 53)
53
3
>>> printf("%d\n", "asdf")
Traceback (most recent call last):
  File "", line 1, in 
ctypes.ArgumentError: argument 2: : wrong
type

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


ctypes question

2010-04-14 Thread Brendan Miller
I'm using python 2.5.2.

I have a ctypes function with argtypes like this:

_create_folder.argyptes = [c_void_p, c_int]

The issue I am having is that I can call it like this

_create_folder(some_pointer, "asdf")

and it won't raise a TypeError. Why would it accept a string for an
integer argument?

I didn't see this behavior documented when I read through
http://docs.python.org/library/ctypes.html, maybe I'm just missing
it... if that's the case a reference would be appreciated.

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


Re: Tough sorting problem: or, I'm confusing myself

2010-04-14 Thread Raymond Hettinger
> > Not sure what the readability issue is.  The phrase "nlargest(2,
> > iterable)" does exactly what it says, finds the 2 largest elements
> > from an iterable.  That makes the programmer's intent more clear than
> > the slower, but semanticly equivalent form:  sorted(iterable)[:2].
>
> I think you meant
>
>    sorted(iterable, reverse=True)[:2]

:-)


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


Re: Unit testing errors (testing the platform module)

2010-04-14 Thread Terry Reedy

On 4/14/2010 11:19 AM, J. Cliff Dyer wrote:

On Wed, 2010-04-14 at 15:51 +0100, john maclean wrote:

self.assertEqual(platform.__builtins__.__class__, dict,
"platform.__class__ supposed to be dict")
self.assertEqual(platform.__name__, 'platform' )


The preferred spelling for:

 platform.__builtins__.__class__

would be

 type(platform.__builtins__)


Agreed


It's shorter and easier to read, but essentially says the same thing.

You can also use it on integer literals, which you can't do with your
syntax:

 >>>  type(1)
 
 >>>  1.__class__
 ...
 SyntaxError: invalid syntax


Add the needed space and it works fine.

>>> 1 .__class__


A possible use of literal int attributes is for bound mehods:

>>> inc = 1 .__add__
>>> inc(3)
4
>>> inc(3.0)
NotImplemented

Whereas def inc(n): return n+1 is generic and would return 4.0.

Terry Jan Reedy

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


Re: Tough sorting problem: or, I'm confusing myself

2010-04-14 Thread Paul Rubin
Raymond Hettinger  writes:
> Not sure what the readability issue is.  The phrase "nlargest(2,
> iterable)" does exactly what it says, finds the 2 largest elements
> from an iterable.  That makes the programmer's intent more clear than
> the slower, but semanticly equivalent form:  sorted(iterable)[:2].

I think you meant

   sorted(iterable, reverse=True)[:2]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tough sorting problem: or, I'm confusing myself

2010-04-14 Thread Raymond Hettinger
> I'm not sure a heap will help much, and at least to me,
> doesn't improve readability.

nlargest() should save quite a few comparisons and run much faster
than sorted().

Not sure what the readability issue is.  The phrase "nlargest(2,
iterable)" does exactly what it says, finds the 2 largest elements
from an iterable.  That makes the programmer's intent more clear than
the slower, but semanticly equivalent form:  sorted(iterable)[:2].

The running time for your algorithm can be very long, depending on the
inputs.  Do you need an exact answer or can you approximate it with
sampling random combinations (i.e. choose the best two scores out of
1 samples).

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


Re: unit testing, setUp and scoping

2010-04-14 Thread john maclean
On 14 April 2010 16:22, Francisco Souza  wrote:
>> On Wed, Apr 14, 2010 at 11:47 AM, john maclean  wrote:
>> Can one use the setUp block to store variables so that they can be
>> used elsewhere in unit tests? I'm thinking that it's better to have
>> variables created in another script and have it imported from within
>> the unit test
>
> Hi John,
> each TestCase is a object, and you can "store" attributes in this objects
> normally, using self :)
>
> class TestPythonStringsTestCase(
>>
>> unittest.TestCase):
>>        def setUp(self):
>>                print '''setting up stuff for ''', __name__
>>                self.s1 = 'single string'
>>                print dir(str)
>>
>>        def testclass(self):
>>                '''test strings are of class str'''
>>                self.assertEqual(self.s1.__class__, str)
>>
>> if __name__ == "__main__":
>>        unittest.main()
>
> This works fine and s1 is an internal attribute of your TesteCase.
>
> Best regards,
> Francisco Souza
> Software developer at Giran and also full time
> Open source evangelist at full time
>
> http://www.franciscosouza.net
> Twitter: @franciscosouza
> (27) 8128 0652
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


Thanks! that worked.


-- 
John Maclean
07739 171 531
MSc (DIC)

Enterprise Linux Systems Engineer
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What license/copyright text to include and where to include it when selling a commercial Python based application?

2010-04-14 Thread python
Thank you Robert!

Regards,
Malcolm

- Original message -
From: "Robert Kern" 
To: python-list@python.org
Date: Mon, 12 Apr 2010 17:20:54 -0500
Subject: Re: What license/copyright text to include and where to include
it when selling a commercial Python based application?

On 2010-04-12 17:02 PM, Malcolm Greene wrote:
> Looking for advice on what Python license and copyright text to
> include and where to include it when selling a commercial
> (Windows based) Python based application.

The requirement is fairly broad; there are a number of things you could
do to 
satisfy the requirement. Largely, it's up to you as long as the full
license 
text is accessible somewhere. I will provide personal, entirely
unofficial 
recommendations below, though.

> By license text and copyrights I am refering to the text on this
> page:
>
> PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
> http://www.python.org/download/releases/2.6.5/license/
>
> By "where to include it" I mean:
>
> 1. What Python license text/copyright text should I place in our
> printed user manual?

The whole license and history text, parts A and B.

> 2. What Python license text/copyright text should I include in
> our online documentation?

The whole thing.

> 3. What Python license text/copyright text should I include in
> product's license text file?

Have a licenses\ directory with a LICENSE_Python.txt containing the
whole 
license text. Have other LICENSE_.txt files for any other
third-party 
libraries you use, like the GUI toolkit.

> 4. What Python license text/copyright text should I include in
> application's splash screen and about dialog boxes?

Link to the part of the online documentation that lists the third-party
software 
that you use.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma
  that is made terrible by our own mad attempt to interpret it as though
  it had
  an underlying truth."
   -- Umberto Eco

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

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


Re: unit testing, setUp and scoping

2010-04-14 Thread Francisco Souza
>
> On Wed, Apr 14, 2010 at 11:47 AM, john maclean  wrote:
> Can one use the setUp block to store variables so that they can be
> used elsewhere in unit tests? I'm thinking that it's better to have
> variables created in another script and have it imported from within
> the unit test
>

Hi John,
each TestCase is a object, and you can "store" attributes in this objects
normally, using self :)

class TestPythonStringsTestCase(
>
> unittest.TestCase):
>def setUp(self):
>print '''setting up stuff for ''', __name__
>*self.*s1 = 'single string'
>print dir(str)
>
>def testclass(self):
>'''test strings are of class str'''
>self.assertEqual(*self.*s1.__class__, str)
>
> if __name__ == "__main__":
>unittest.main()


This works fine and s1 is an internal attribute of your TesteCase.

Best regards,
Francisco Souza
Software developer at Giran and also full time
Open source evangelist at full time

http://www.franciscosouza.net
Twitter: @franciscosouza
(27) 8128 0652
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unit testing errors (testing the platform module)

2010-04-14 Thread J. Cliff Dyer
On Wed, 2010-04-14 at 15:51 +0100, john maclean wrote:
> self.assertEqual(platform.__builtins__.__class__, dict,
> "platform.__class__ supposed to be dict")
> self.assertEqual(platform.__name__, 'platform' ) 

The preferred spelling for:

platform.__builtins__.__class__ 

would be

type(platform.__builtins__)

It's shorter and easier to read, but essentially says the same thing.

You can also use it on integer literals, which you can't do with your
syntax:

>>> type(1)

>>> 1.__class__
...
SyntaxError: invalid syntax

Admittedly, this is a trivial benefit.  If you're using a literal, you
already know what type you're dealing with.

Cheers,
Cliff

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


Re: unit testing, setUp and scoping

2010-04-14 Thread Bruno Desthuilliers

john maclean a écrit :

Can one use the setUp block to store variables so that they can be
used elsewhere in unit tests? I'm thinking that it's better to have
variables created in another script and have it imported from within
the unit test


???



#!/usr/bin/env python
'''create knowledge base of strings by unit testing'''
import unittest

class TestPythonStringsTestCase(unittest.TestCase):
def setUp(self):
print '''setting up stuff for ''', __name__
s1 = 'single string'
print dir(str)

def testclass(self):
'''test strings are of class str'''
self.assertEqual(s1.__class__, str)



Err... What about FIRST doing the FineTutorial ???

class TestPythonStringsTestCase(unittest.TestCase):
def setUp(self):
self.s1 = 'single string'

def testclass(self):
"test strings are of class str"
 self.assert(type(self.s1) is str)


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


Re: packaging multiple python scripts as Windows exe file

2010-04-14 Thread Den
On Apr 12, 3:20 pm, Alex Hall  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

I'm not an expert, but there is a module called ResourcePackage
(http://resourcepackage.sourceforge.net/) which I have used to include
binary files within my python program (I use it for an image file).
It takes the binary file, makes a string out of it, then generates a
module containing that string.  You can then import that module and
access that string.  In particular, I assume you can write that string
out to a binary file and recreate the binary file.

I know this doesn't address how to make a single exe which a user can
run (I'm interested in the replies you get) but it does allow you to
carry your binary files along with your and write them out when and if
you need them.

By the way, I'd be interested to hear if there are any other such
solutions for embedding binary files in a python program.

Hope that helped.

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


Re: Unit testing errors (testing the platform module)

2010-04-14 Thread john maclean
On 14 April 2010 09:09, Gabriel Genellina  wrote:
> En Tue, 13 Apr 2010 11:01:19 -0300, John Maclean 
> escribió:
>
>> Is there an error in my syntax? Why is my test failing? Line 16.
>>
>> ==
>> FAIL: platform.__builtins__.blah
>> --
>> Traceback (most recent call last):
>>  File "stfu/testing/test_pyfactor.py", line 16, in testplatformbuiltins
>>    self.assertEquals(platform.__builtins__.__class__, "")
>> AssertionError:  != ""
>>
>> --
>
> To express the condition "SOMEOBJECT must be a dictionary", use:
>
>    isinstance(SOMEOBJECT, dict)
>
> SOMEOBJECT might actually be an instance of any derived class and still pass
> the test; that's usually the desired behavior.
>
> In the rare cases where only a very specific type is allowed, use this form
> instead:
>
>    type(SOMEOBJECT) is dict
>
>
> The test case above should read then:
>
>    self.assert_(isinstance(platform.__builtins__, dict),
>                 type(platform.__builtins__))
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

This is cool. Thanks for your replies.

self.assertEqual(platform.__builtins__.__class__, dict,
"platform.__class__ supposed to be dict")
self.assertEqual(platform.__name__, 'platform' )


-- 
John Maclean
07739 171 531
MSc (DIC)

Enterprise Linux Systems Engineer
-- 
http://mail.python.org/mailman/listinfo/python-list


unit testing, setUp and scoping

2010-04-14 Thread john maclean
Can one use the setUp block to store variables so that they can be
used elsewhere in unit tests? I'm thinking that it's better to have
variables created in another script and have it imported from within
the unit test

#!/usr/bin/env python
'''create knowledge base of strings by unit testing'''
import unittest

class TestPythonStringsTestCase(unittest.TestCase):
def setUp(self):
print '''setting up stuff for ''', __name__
s1 = 'single string'
print dir(str)

def testclass(self):
'''test strings are of class str'''
self.assertEqual(s1.__class__, str)

if __name__ == "__main__":
unittest.main()



-- 
John Maclean
07739 171 531
MSc (DIC)

Enterprise Linux Systems Engineer
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: msvcr90.dll is MIA?

2010-04-14 Thread Alex Hall
On 4/14/10, Enrico  wrote:
> Il 14/04/2010 14:25, Alex Hall ha scritto:
>> I notice that I do not have the dll when py2exe says it cannot locate
>> the dll. If I need vs2008, then what good is vcredist_xxx.exe? It does
>> not seem to give me the dll, but the py2exe tutorial says that it
>> will. What am I missing?
>
> Alex, the DLLs are in winsxs, try searching there.
They are not there, unless I am in the wrong folder. I searched in
c:\windows\winsxs.
> For py2exe, it doesn't find the DLLs so you should provide them. In my
> setup.py (I use also the wxPython lib so something could be different) I
> added:
>
> def isSystemDLL(pathname):
>  if os.path.basename(pathname).lower() in ('msvcp90.dll'):
>  return 0
>  return origIsSystemDLL(pathname)
> origIsSystemDLL = py2exe.build_exe.isSystemDLL
> py2exe.build_exe.isSystemDLL = isSystemDLL
>
> Then I added to 'dll_excludes' the same 'msvcp90.dll'.
>
> In this way py2exe is ok without this DLL and can build the excutable.
> Note that the dll that py2exe is looking for is msvcp90 in my case.
>
> Then I added a subdirectory with the DLLs (msvcr90, msvcp90, msvcm90) to
> the distribution directory. You need a manifest too :-)
>
> Ok, it seems complex but you can check the followings
> http://www.py2exe.org/index.cgi/Tutorial
I have looked there, that is where I got the redist exe file which did
not work. I then went and got a copy of the file right from Microsoft,
but no luck there either.
> http://wiki.wxpython.org/py2exe (related to wxPython but look at the
> manifest)
>
> An other solution is to run the vcredist on the target machine and the
> application will run. This is the suggested solution if you cannot
> distibute the DLLs.
I cannot distribute them. So you are saying to compile without the
dll, then run the redist file? I would much rather package everything
as this is meant to be a stand-alone app, runable from anywhere (even
a thumb drive on a computer on which you are a guest, like a hotel or
library machine). It is not meant to install anything or copy any
files, just run in memory and then close when the user decides to
close.
>
> Bye, Enrico
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: msvcr90.dll is MIA?

2010-04-14 Thread Rebelo

> Alex Hall wrote:

but I still have no dll. I installed vs2005, but apparently I
need vs2008, which I cannot find.

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





http://www.microsoft.com/express/Downloads/
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to get text from a html file?

2010-04-14 Thread Stefan Behnel

Emile van Sebille, 14.04.2010 15:24:

On 4/13/2010 11:43 PM Stefan Behnel said...

rake, 14.04.2010 02:45:

On Apr 13, 2:12 pm, Chris Colbert wrote:

You should look into beautiful soup

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


For more complex parsing beautiful soup is definitely the way to go.


Why would a library that even the author has lost interest in be "the
way to go"?


Why not when the recent release dates from only five days ago?


Interesting, even the web site has had a revamp.

Nice - I like competition. ;)

Stefan

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


Re: msvcr90.dll is MIA?

2010-04-14 Thread Enrico

Il 14/04/2010 14:25, Alex Hall ha scritto:

I notice that I do not have the dll when py2exe says it cannot locate
the dll. If I need vs2008, then what good is vcredist_xxx.exe? It does
not seem to give me the dll, but the py2exe tutorial says that it
will. What am I missing?


Alex, the DLLs are in winsxs, try searching there.
For py2exe, it doesn't find the DLLs so you should provide them. In my 
setup.py (I use also the wxPython lib so something could be different) I 
added:


def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ('msvcp90.dll'):
return 0
return origIsSystemDLL(pathname)
origIsSystemDLL = py2exe.build_exe.isSystemDLL
py2exe.build_exe.isSystemDLL = isSystemDLL

Then I added to 'dll_excludes' the same 'msvcp90.dll'.

In this way py2exe is ok without this DLL and can build the excutable. 
Note that the dll that py2exe is looking for is msvcp90 in my case.


Then I added a subdirectory with the DLLs (msvcr90, msvcp90, msvcm90) to 
the distribution directory. You need a manifest too :-)


Ok, it seems complex but you can check the followings
http://www.py2exe.org/index.cgi/Tutorial
http://wiki.wxpython.org/py2exe (related to wxPython but look at the 
manifest)


An other solution is to run the vcredist on the target machine and the 
application will run. This is the suggested solution if you cannot 
distibute the DLLs.


Bye, Enrico
--
http://mail.python.org/mailman/listinfo/python-list


Re: msvcr90.dll is MIA?

2010-04-14 Thread Alex Hall
On 4/14/10, Christian Heimes  wrote:
> On 14.04.2010 14:25, Alex Hall wrote:
>> I notice that I do not have the dll when py2exe says it cannot locate
>> the dll. If I need vs2008, then what good is vcredist_xxx.exe? It does
>> not seem to give me the dll, but the py2exe tutorial says that it
>> will. What am I missing?
>
> Do you have the correct vcredist for VS 2008?
I ran the redist exe from Microsoft that said it was for c++ 2008, from
http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en
I still cannot find the dll I need! Again, I have 32-bit python2.6 on
win7x64, so I got the _x86 version of the redist file. I have also
tried running the x64 version of the file, just to see if it would
help, but I still have no dll. I installed vs2005, but apparently I
need vs2008, which I cannot find.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to get text from a html file?

2010-04-14 Thread Grant Edwards
On 2010-04-14, Stefan Behnel  wrote:
>> On Apr 13, 2:12 pm, Chris Colbert wrote:
>>> You should look into beautiful soup
>>>
>>> http://www.crummy.com/software/BeautifulSoup/
>>
>> For more complex parsing beautiful soup is definitely the way to go.
>
> Why would a library that even the author has lost interest in be "the way 
> to go"?

Sure, if the library is still being maintained.  I can't think of too
many open-source projects where somebody else hasn't taken over from
the original author.

-- 
Grant Edwards   grant.b.edwardsYow! I'm dressing up in
  at   an ill-fitting IVY-LEAGUE
  gmail.comSUIT!!  Too late...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to get text from a html file?

2010-04-14 Thread Emile van Sebille

On 4/13/2010 11:43 PM Stefan Behnel said...

rake, 14.04.2010 02:45:

On Apr 13, 2:12 pm, Chris Colbert wrote:

You should look into beautiful soup

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


For more complex parsing beautiful soup is definitely the way to go.


Why would a library that even the author has lost interest in be "the
way to go"?

Stefan


Why not when the recent release dates from only five days ago?

Emile

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


Re: msvcr90.dll is MIA?

2010-04-14 Thread Christian Heimes

On 14.04.2010 14:25, Alex Hall wrote:

I notice that I do not have the dll when py2exe says it cannot locate
the dll. If I need vs2008, then what good is vcredist_xxx.exe? It does
not seem to give me the dll, but the py2exe tutorial says that it
will. What am I missing?


Do you have the correct vcredist for VS 2008?

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


Re: msvcr90.dll is MIA?

2010-04-14 Thread Alex Hall
I notice that I do not have the dll when py2exe says it cannot locate
the dll. If I need vs2008, then what good is vcredist_xxx.exe? It does
not seem to give me the dll, but the py2exe tutorial says that it
will. What am I missing?

On 4/14/10, Christian Heimes  wrote:
> On 14.04.2010 13:22, Alex Hall wrote:
>> I tried both vcredist_x86.exe and vcredist_x64.exe, with no result; I
>> still do not have the required dll (I have 32-bit python, so the _x86
>> should have done the trick). I will try another poster's suggestion of
>> installing vcpp express 2005 and hope that will work...
>
> How do you notice that you don't have the required DLL? The DLLs aren't
> copied into system32. The new location is the side by side assembly
> directory WinSxS. You need adminstration privileges to install SxS
> assemblies.
>
> By the way VC Express 2005 is the wrong version. Python 2.6 and newer
> are compiled with VS 2008.
>
> Christian
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: msvcr90.dll is MIA?

2010-04-14 Thread Christian Heimes

On 14.04.2010 13:22, Alex Hall wrote:

I tried both vcredist_x86.exe and vcredist_x64.exe, with no result; I
still do not have the required dll (I have 32-bit python, so the _x86
should have done the trick). I will try another poster's suggestion of
installing vcpp express 2005 and hope that will work...


How do you notice that you don't have the required DLL? The DLLs aren't 
copied into system32. The new location is the side by side assembly 
directory WinSxS. You need adminstration privileges to install SxS 
assemblies.


By the way VC Express 2005 is the wrong version. Python 2.6 and newer 
are compiled with VS 2008.


Christian

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


Re: msvcr90.dll is MIA?

2010-04-14 Thread Alf P. Steinbach

* Alex Hall:

Hi all,
For testing purposes, and because I am not yet distributing my
application (which, thanks to you all, is now running perfectly!), I
am going to just bundle msvcr90.dll. However, I cannot find it! I ran
vcredist_x86.exe (I have a 64-bit version of win7, but all I have is
the x86 version of the program - is that a problem?). A search for
msvcr90.dll and just vcr90.dll returns 0 results. Where did it put my
msvcr90.dll file? I thought the point was to give me the dll? Thanks.



A bit off-topic, but:



  C:\> for %f in (msvcr70.dll, msvcr71.dll, msvcr80.dll, mscvr90.dll) do @(
  More? echo.%f "%~$path:f"
  More? )
  msvcr70.dll "C:\WINDOWS\SYSTEM32\msvcr70.dll"
  msvcr71.dll "C:\WINDOWS\SYSTEM32\msvcr71.dll"
  msvcr80.dll "C:\WINDOWS\SYSTEM32\msvcr80.dll"
  mscvr90.dll ""

  C:\> _



Cheers & hth.,

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


Re: Object serialization: transfer from a to b (non-implemented code on b)

2010-04-14 Thread Andreas Löscher
Am Mittwoch, den 14.04.2010, 12:37 +0200 schrieb Gabriel Rossetti:
> Andreas Löscher wrote:
> > Am Mittwoch, den 14.04.2010, 11:33 +0200 schrieb Gabriel Rossetti:
> >   
> >> Paul Rubin wrote:
> >> 
> >>> Gabriel Rossetti  writes:
> >>>   
> >>>   
>  I am trying to serialize a function, class, etc and transfer it
>  
>  
> >>> You mean the actual code?  You have to use marshal rather than pickle,
> >>> the Python versions have to be the same at both ends, and you better
> >>> have some kind of authenticated transport to stop malicious code from
> >>> getting accepted and run by the receiving end.
> >>>   
> >>>   
> >> Yes, but I wasn't able to marshal/unmarshal them correctly as shown in 
> >> my examples
> >> 
> >
> > The marshal module can be used to dump the Code of an Function (or
> > anything else), like you have done. If you have the Code, you can
> > reconstruct the function.
> >
> >   
>  import types
>  import marshal
>  def a(): pass
>  
> > ... 
> >   
>  s=marshal.dumps(a.__code__)
>  f=types.FunctionType(marshal.loads(s), {})
>  f
>  
> > 
> >
> > The second parameter is the global scoop of the function.
> >
> > If you want to marshal a class, things get a little more complicated,
> > because these consist of many code objects and you also need the code 
> > to assemble them together.
> >
> > There are two easy ways I can think of right now:
> >
> > 1.
> > Send the string of the code you want to transfer:
> >   
>  s="""class A: pass"""
>  
> >
> > and then:
> >   
>  exec(s) in globals()
>  
> >
> > 2.
> > Encapsule the stuff you want to send in a function.
> >
> >
> > Best,
> > Andreas
> >
> >   
> Thanks Andreas, I'll give that a try. I didn't really want to do the 
> string method which is why I was trying to serialize.
> 
> best,
> Gabriel

You can compile the string befor you send it in an code object. This way
you also don't need to compile it twice if you execute ist two times. 

>>> s="""class A: pass"""
>>> co=compile(s, "foo.py", "exec")

>>> exec(marshal.loads(marshal.dumps(co))) in globals()

But be aware, that the string method may be the most save method for
doing this. Python is not ByteCode compatible between it's versions.
But if I understand you right, this is not an issue for you.

Best,
Andreas

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


Re: msvcr90.dll is MIA?

2010-04-14 Thread Alex Hall
I tried both vcredist_x86.exe and vcredist_x64.exe, with no result; I
still do not have the required dll (I have 32-bit python, so the _x86
should have done the trick). I will try another poster's suggestion of
installing vcpp express 2005 and hope that will work...

On 4/14/10, Gabriel Genellina  wrote:
> En Wed, 14 Apr 2010 00:07:48 -0300, Alex Hall  escribió:
>
>> For testing purposes, and because I am not yet distributing my
>> application (which, thanks to you all, is now running perfectly!), I
>> am going to just bundle msvcr90.dll. However, I cannot find it! I ran
>> vcredist_x86.exe (I have a 64-bit version of win7, but all I have is
>> the x86 version of the program - is that a problem?). A search for
>> msvcr90.dll and just vcr90.dll returns 0 results. Where did it put my
>> msvcr90.dll file? I thought the point was to give me the dll? Thanks.
>
> You need the same architecture and version as used by Python itself. A
> 32-bit executable (Python, or your compiled program) requires a 32-bit
> dll, a 64-bit executable requires a 64-bit dll (and this one comes from a
> different redistributable package, vcredist_x64.exe).
> You may install the 32-bit dlls on a 64-bit Windows, but only 32-bit
> programs will be able to use it.
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Object serialization: transfer from a to b (non-implemented code on b)

2010-04-14 Thread Gabriel Rossetti

Andreas Löscher wrote:

Am Mittwoch, den 14.04.2010, 11:33 +0200 schrieb Gabriel Rossetti:
  

Paul Rubin wrote:


Gabriel Rossetti  writes:
  
  

I am trying to serialize a function, class, etc and transfer it



You mean the actual code?  You have to use marshal rather than pickle,
the Python versions have to be the same at both ends, and you better
have some kind of authenticated transport to stop malicious code from
getting accepted and run by the receiving end.
  
  
Yes, but I wasn't able to marshal/unmarshal them correctly as shown in 
my examples



The marshal module can be used to dump the Code of an Function (or
anything else), like you have done. If you have the Code, you can
reconstruct the function.

  

import types
import marshal
def a(): pass

... 
  

s=marshal.dumps(a.__code__)
f=types.FunctionType(marshal.loads(s), {})
f




The second parameter is the global scoop of the function.

If you want to marshal a class, things get a little more complicated,
because these consist of many code objects and you also need the code 
to assemble them together.


There are two easy ways I can think of right now:

1.
Send the string of the code you want to transfer:
  

s="""class A: pass"""



and then:
  

exec(s) in globals()



2.
Encapsule the stuff you want to send in a function.


Best,
Andreas

  
Thanks Andreas, I'll give that a try. I didn't really want to do the 
string method which is why I was trying to serialize.


best,
Gabriel
--
http://mail.python.org/mailman/listinfo/python-list


Re: msvcr90.dll is MIA?

2010-04-14 Thread Gabriel Genellina

En Wed, 14 Apr 2010 00:07:48 -0300, Alex Hall  escribió:


For testing purposes, and because I am not yet distributing my
application (which, thanks to you all, is now running perfectly!), I
am going to just bundle msvcr90.dll. However, I cannot find it! I ran
vcredist_x86.exe (I have a 64-bit version of win7, but all I have is
the x86 version of the program - is that a problem?). A search for
msvcr90.dll and just vcr90.dll returns 0 results. Where did it put my
msvcr90.dll file? I thought the point was to give me the dll? Thanks.


You need the same architecture and version as used by Python itself. A  
32-bit executable (Python, or your compiled program) requires a 32-bit  
dll, a 64-bit executable requires a 64-bit dll (and this one comes from a  
different redistributable package, vcredist_x64.exe).
You may install the 32-bit dlls on a 64-bit Windows, but only 32-bit  
programs will be able to use it.


--
Gabriel Genellina

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


Re: Object serialization: transfer from a to b (non-implemented code on b)

2010-04-14 Thread Andreas Löscher
Am Mittwoch, den 14.04.2010, 11:33 +0200 schrieb Gabriel Rossetti:
> Paul Rubin wrote:
> > Gabriel Rossetti  writes:
> >   
> >> I am trying to serialize a function, class, etc and transfer it
> >> 
> >
> > You mean the actual code?  You have to use marshal rather than pickle,
> > the Python versions have to be the same at both ends, and you better
> > have some kind of authenticated transport to stop malicious code from
> > getting accepted and run by the receiving end.
> >   
> 
> Yes, but I wasn't able to marshal/unmarshal them correctly as shown in 
> my examples

The marshal module can be used to dump the Code of an Function (or
anything else), like you have done. If you have the Code, you can
reconstruct the function.

>>> import types
>>> import marshal
>>> def a(): pass
... 
>>> s=marshal.dumps(a.__code__)
>>> f=types.FunctionType(marshal.loads(s), {})
>>> f


The second parameter is the global scoop of the function.

If you want to marshal a class, things get a little more complicated,
because these consist of many code objects and you also need the code 
to assemble them together.

There are two easy ways I can think of right now:

1.
Send the string of the code you want to transfer:
>>> s="""class A: pass"""

and then:
>>> exec(s) in globals()

2.
Encapsule the stuff you want to send in a function.


Best,
Andreas

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


Re: Creating a standalone application

2010-04-14 Thread Luis Quesada
On Apr 14, 11:06 am, "Gabriel Genellina" 
wrote:
> En Wed, 14 Apr 2010 06:10:59 -0300, Luis Quesada  
>  escribió:
>
>
>
> > On Apr 14, 6:31 am, "Gabriel Genellina" 
> > wrote:
> >> En Tue, 13 Apr 2010 18:02:07 -0300, Luis Quesada   
> >> escribi :
>
> >> > 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.
> > This is what I get now:
> > ...
> > compiling cx_Freeze__init__
> > Traceback (most recent call last):
> >   ...
> >   File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 260,
> > in _LoadModule
> >     module.code = compile(fp.read() + "\n", path, "exec")
> > TypeError: compile() expected string without null bytes
>
> > Now I even more confused since it seems the problem is taking place
> > when trying cx_Freeze__init__ 
>
> Yes, looks like a problem within cx_Freeze itself. Sorry, I cannot be of  
> more help, I don't use the tool myself.
>
> Try asking in the project's mailing list  
> , I think you may get more specific help  
> there. (Also, try using the latest cx_Freeze release, this may have been  
> already fixed).
>

Thanks Gabriel. I will try cx-freeze's mailing list.
Cheers
Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Creating a standalone application

2010-04-14 Thread Gabriel Genellina
En Wed, 14 Apr 2010 06:10:59 -0300, Luis Quesada  
 escribió:



On Apr 14, 6:31 am, "Gabriel Genellina" 
wrote:
En Tue, 13 Apr 2010 18:02:07 -0300, Luis Quesada   
escribi :


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



This is what I get now:
...
compiling cx_Freeze__init__
Traceback (most recent call last):
  ...
  File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 260,
in _LoadModule
module.code = compile(fp.read() + "\n", path, "exec")
TypeError: compile() expected string without null bytes

Now I even more confused since it seems the problem is taking place
when trying cx_Freeze__init__ 


Yes, looks like a problem within cx_Freeze itself. Sorry, I cannot be of  
more help, I don't use the tool myself.


Try asking in the project's mailing list  
, I think you may get more specific help  
there. (Also, try using the latest cx_Freeze release, this may have been  
already fixed).


--
Gabriel Genellina

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


Re: Object serialization: transfer from a to b (non-implemented code on b)

2010-04-14 Thread Gabriel Rossetti

Paul Rubin wrote:

Gabriel Rossetti  writes:
  

I am trying to serialize a function, class, etc and transfer it



You mean the actual code?  You have to use marshal rather than pickle,
the Python versions have to be the same at both ends, and you better
have some kind of authenticated transport to stop malicious code from
getting accepted and run by the receiving end.
  


Yes, but I wasn't able to marshal/unmarshal them correctly as shown in 
my examples

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


Re: Creating a standalone application

2010-04-14 Thread Luis Quesada
On Apr 14, 6:31 am, "Gabriel Genellina" 
wrote:
> En Tue, 13 Apr 2010 18:02:07 -0300, Luis Quesada   
> escribi :
>
> > 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.
>
> Are you sure? A text file saved as, e.g., UTF-16, does contain null bytes.
>
> > cxfreeze's output
> > ...
> >    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
>
> I would add a few 'print' statements in finder.py to determine which file  
> is failing.
>

I did what you suggested: I modified finder.py so that it prints the
name of the module before the compile statement that triggers the
exception. This is what I get now:

lques...@lquesada-laptop:~/workspace/MetroNode/src/models$ cxfreeze
uncovered.py --target-dir dist
compiling os
compiling posixpath
compiling stat
compiling genericpath
compiling warnings
compiling linecache
compiling types
compiling re
compiling sre_compile
compiling sre_parse
compiling sre_constants
compiling copy_reg
compiling UserDict
compiling _abcoll
compiling abc
compiling copy
compiling repr
compiling subprocess
compiling traceback
compiling threading
compiling functools
compiling _strptime
compiling locale
compiling encodings
compiling codecs
compiling encodings.aliases
compiling calendar
compiling optparse
compiling textwrap
compiling string
compiling gettext
compiling struct
compiling StringIO
compiling token
compiling tokenize
compiling dummy_thread
compiling collections
compiling keyword
compiling doctest
compiling __future__
compiling inspect
compiling dis
compiling opcode
compiling unittest
compiling getopt
compiling difflib
compiling heapq
compiling bisect
compiling pdb
compiling cmd
compiling bdb
compiling pprint
compiling shlex
compiling tempfile
compiling random
compiling _threading_local
compiling pickle
compiling __main__
compiling Numberjack
compiling Decomp
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
compiling cx_Freeze__init__
Traceback (most recent call last):
  File "/usr/bin/cxfreeze", line 5, in 
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 387,
in IncludeFile
deferredImports)
  File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 260,
in _LoadModule
module.code = compile(fp.read() + "\n", path, "exec")
TypeError: compile() expected string without null bytes

Now I even more confused since it seems the problem is taking place
when trying cx_Freeze__init__ 
Cheers,
Luis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: missing dll follow-up

2010-04-14 Thread Rebelo

Alex Hall wrote:

Hi again,
I said "msvcr90.dll", but I meant "msvcp90.dll". In either case, I
cannot locate the dll to include in my project and I am not sure what
else I can do. The vcredist_x86 was, I thought, supposed to give me
the dll, but it does not seem to have done so.

i think that you nedd Microsoft Visual Studio C++ for that dll file, I 
used Microsoft Visual Studio C++ Express

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


Re: Object serialization: transfer from a to b (non-implemented code on b)

2010-04-14 Thread Paul Rubin
Gabriel Rossetti  writes:
> I am trying to serialize a function, class, etc and transfer it

You mean the actual code?  You have to use marshal rather than pickle,
the Python versions have to be the same at both ends, and you better
have some kind of authenticated transport to stop malicious code from
getting accepted and run by the receiving end.
-- 
http://mail.python.org/mailman/listinfo/python-list


Object serialization: transfer from a to b (non-implemented code on b)

2010-04-14 Thread Gabriel Rossetti

Hello everyone,

I am trying to serialize a function, class, etc and transfer it, have it 
unserialized and used. The thing is that this code is not defined on the 
receiving side and thus it does not work. I tried the following tests:


Terminal A:

>>> import pickle
>>> def test(): pass
...
>>> pickle.dumps(test)
'c__main__\ntest\np0\n.'
>>>

Terminal B:

>>> import pickle
>>> pickle.loads('c__main__\ntest\np0\n.')
Traceback (most recent call last):
 File "", line 1, in 
 File "/usr/lib/python2.5/pickle.py", line 1374, in loads
   return Unpickler(file).load()
 File "/usr/lib/python2.5/pickle.py", line 858, in load
   dispatch[key](self)
 File "/usr/lib/python2.5/pickle.py", line 1090, in load_global
   klass = self.find_class(module, name)
 File "/usr/lib/python2.5/pickle.py", line 1126, in find_class
   klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'test'


Ok, so pickle needs the code to be defined on both sides, so I tried 
marshal:


Terminal A:

>>> import marshal
>>> marshal.dumps(test)
Traceback (most recent call last):
 File "", line 1, in 
ValueError: unmarshallable object

Ok, as the docs say, marshal is quite limited, no functions or user 
classes can be marshalled, I did get it to work like this though :


>>> import inspect
>>> marshal.dumps(inspect.getmembers(test, inspect.iscode)[0][1])
'c\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\x04\x00\x00\x00d\x00\x00S(\x01\x00\x00\x00N(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00s\x07\x00\x00\x00t\x04\x00\x00\x00test\x01\x00\x00\x00s\x00\x00\x00\x00'

ok, but can I unmarshal it?

Terminal B:

>>> 
marshal.loads('c\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\x04\x00\x00\x00d\x00\x00S(\x01\x00\x00\x00N(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00s\x07\x00\x00\x00t\x04\x00\x00\x00test\x01\x00\x00\x00s\x00\x00\x00\x00')

", line 1>

ok, it seams to work...

>>> 
marshal.loads('c\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\x04\x00\x00\x00d\x00\x00S(\x01\x00\x00\x00N(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00s\x07\x00\x00\x00t\x04\x00\x00\x00test\x01\x00\x00\x00s\x00\x00\x00\x00')()

Traceback (most recent call last):
 File "", line 1, in 
TypeError: 'code' object is not callable

ok, logical, it's a code object...

>>> 
eval(marshal.loads('c\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00C\x00\x00\x00s\x04\x00\x00\x00d\x00\x00S(\x01\x00\x00\x00N(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00(\x00\x00\x00\x00s\x07\x00\x00\x00t\x04\x00\x00\x00test\x01\x00\x00\x00s\x00\x00\x00\x00'))


ok, this works, not super pretty, but it works

now user objects?

>>> class A(object): pass
...
>>> a = A()
>>> marshal.dumps(a)
Traceback (most recent call last):
 File "", line 1, in 
ValueError: unmarshallable object

ok, expected...

>>> inspect.getmembers(a, inspect.iscode)
[]

ok, not cool, can't use the previous method...


Ok, now a word about what I'm trying to do, I'm trying to run python 
code in a new process, like multiprocessing does, but without 
multiprocessing. I'm trying to serialise the code because I 'd like to 
do something like:


pseudo-code, serialize/unserialize/process are made up:

def newProcess(func, *args, **kwargs):
   func = serialize(func)
   args = serialize(args)
   kwargs = serialize(kwargs)
   process("python -c 'import serialize, unserialize;print 
serialize(unserialize(\'%s\')(*unserialize(\'%s\'), 
**unserialize(\'%s\')))'" % (func, args, kwargs))

  #read result from stdout

I'm greatly simplifying this because I'm using a framework, but that's 
the basic idea.


thanks,
Gabriel




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


Re: Creating a standalone application

2010-04-14 Thread Jonathan Hartley
On Apr 13, 10:42 pm, Lawrence D'Oliveiro  wrote:
> In message , 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?

I keep hearing this reply every time I ask this question, and it
doesn't seem to make sense to me.

Anything other than a trivial script will have dependencies. These
might be other Python packages, C-extensions, and other libraries.
What if your program runs on a version of Python other than the one
installed on the client's Linux system?

In my opinion, there is a severe need for this question to be answered
in a robust and simple way. Is creating an rpm / deb file the answer?
I don't know, but I think it's a very valid question.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unit testing errors (testing the platform module)

2010-04-14 Thread Gabriel Genellina
En Tue, 13 Apr 2010 11:01:19 -0300, John Maclean   
escribió:



Is there an error in my syntax? Why is my test failing? Line 16.

==
FAIL: platform.__builtins__.blah
--
Traceback (most recent call last):
  File "stfu/testing/test_pyfactor.py", line 16, in testplatformbuiltins
self.assertEquals(platform.__builtins__.__class__, "")
AssertionError:  != ""

--


To express the condition "SOMEOBJECT must be a dictionary", use:

isinstance(SOMEOBJECT, dict)

SOMEOBJECT might actually be an instance of any derived class and still  
pass the test; that's usually the desired behavior.


In the rare cases where only a very specific type is allowed, use this  
form instead:


type(SOMEOBJECT) is dict


The test case above should read then:

self.assert_(isinstance(platform.__builtins__, dict),
 type(platform.__builtins__))

--
Gabriel Genellina

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


Re: mailbox multipart

2010-04-14 Thread janwillem
On Apr 14, 8:26 am, Tim Roberts  wrote:
> janwillem  wrote:
>
> >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?
>
> Perhaps you should post your code.  There's no particular reason why you
> should see this.  The mailbox iterator should return the outer multipart
> container, which has the headers.
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.

Thanks Tim,
There you have a point, after I find it is a multipart message I dive
into it recursively and so loose the outer header info. That was all.
-- 
http://mail.python.org/mailman/listinfo/python-list


missing dll follow-up

2010-04-14 Thread Alex Hall
Hi again,
I said "msvcr90.dll", but I meant "msvcp90.dll". In either case, I
cannot locate the dll to include in my project and I am not sure what
else I can do. The vcredist_x86 was, I thought, supposed to give me
the dll, but it does not seem to have done so.

-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


msvcr90.dll is MIA?

2010-04-14 Thread Alex Hall
Hi all,
For testing purposes, and because I am not yet distributing my
application (which, thanks to you all, is now running perfectly!), I
am going to just bundle msvcr90.dll. However, I cannot find it! I ran
vcredist_x86.exe (I have a 64-bit version of win7, but all I have is
the x86 version of the program - is that a problem?). A search for
msvcr90.dll and just vcr90.dll returns 0 results. Where did it put my
msvcr90.dll file? I thought the point was to give me the dll? Thanks.

-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: packaging multiple python scripts as Windows exe file

2010-04-14 Thread Alex Hall
msvcr90.dll is the file, and, according to the py2exe tutorial, step
5, I do not have permision to distribute the file. This is not good
news, but beyond that, I apparently get an entire directory with all
required files, not a single .exe which has everything packaged inside
it. Is there another way of compiling Python to .exe which gives me
one file containing all my dlls and Python dependencies? If not then a
folder is not bad, but a single file would be best.

On 4/13/10, Joaquin Abian  wrote:
> On Apr 13, 9:56 pm, Mike Driscoll  wrote:
>> On Apr 12, 5:20 pm, Alex Hall  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
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading in a file

2010-04-14 Thread Gabriel Genellina

En Mon, 12 Apr 2010 15:31:50 -0300, Maggie  escribió:


i have a basic script i need to implement. i need below code to read
in a file and perform operation is it designed to do:

#!/usr/bin/python

import sys

feed = sys.stdin.readlines()

for temp in feed:
  line = temp.split()
  if len(line) == 3:
 if (line[0] == "xmax" or line[0] == "xmin"):
   time = line[2]
   print str(line[0]) + " " + str(line[1]) + " " +
str(float(time)*2/3)
 else:
   print temp
  else:
 print temp

i appreciate your help in advance..


You forgot to tell us what's wrong with it.

--
Gabriel Genellina

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