From kapileyes at gmail.com Thu Jan 1 19:31:11 2015 From: kapileyes at gmail.com (Kapil Dolas) Date: Fri, 2 Jan 2015 00:01:11 +0530 Subject: [python-win32] How to set value for multi-valued property using mapi? In-Reply-To: References: Message-ID: Hi Nick, Thank you for replying. I tried example given by you and it worked. All MV properties are working in the same way, except ones of type PT_MV_BINARY. Can you give me example for setting PT_MV_BINARY values? Thanks and Regards, Kapil -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick at packetfrenzy.com Mon Jan 5 01:16:34 2015 From: nick at packetfrenzy.com (Nick Czeczulin) Date: Mon, 5 Jan 2015 00:16:34 +0000 Subject: [python-win32] How to set value for multi-valued property using mapi? In-Reply-To: References: Message-ID: Kapil Dolas wrote: > Thank you for replying. I tried example given by you and it worked. All MV properties are working in the > same way, except ones of type PT_MV_BINARY. Can you give me example for setting PT_MV_BINARY values? I think you will need to apply this patch for PT_MV_BINARY to work: http://sourceforge.net/p/pywin32/patches/137/ From skippy.hammond at gmail.com Mon Jan 5 06:20:43 2015 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 05 Jan 2015 16:20:43 +1100 Subject: [python-win32] How to set value for multi-valued property using mapi? In-Reply-To: References: Message-ID: <54AA1F2B.1010306@gmail.com> On 5/01/2015 11:16 AM, Nick Czeczulin wrote: > > Kapil Dolas wrote: >> Thank you for replying. I tried example given by you and it worked. All MV properties are working in the >> same way, except ones of type PT_MV_BINARY. Can you give me example for setting PT_MV_BINARY values? > > I think you will need to apply this patch for PT_MV_BINARY to work: http://sourceforge.net/p/pywin32/patches/137/ Oops - that's been pending for about a year - sorry about that. I just pushed it. Mark From conradoplg at gmail.com Tue Jan 6 02:16:49 2015 From: conradoplg at gmail.com (=?UTF-8?B?Q29ucmFkbyBQLiBMLiBHb3V2w6ph?=) Date: Mon, 5 Jan 2015 23:16:49 -0200 Subject: [python-win32] How to create IStream from Python file to use in ctypes Message-ID: I want to call the function GdipLoadImageFromStream(IStream* stream, GpImage **image) using ctypes, and I need to create the first parameter from a Python file (e.g. created with open). Is there a way to do this? I'm aware of win32com.server.util.FileStream and win32com.server.util.wrap which can be used to create a IStream from a file, but the resulting object (PyIStream) is not accepted by ctypes ("ArgumentError: argument 1: : Don't know how to convert parameter 1") Cheers Conrado import ctypes import pythoncom from win32com.server import util from ctypes import wintypes gdiplus = ctypes.windll.gdiplus WNDPROC = wintypes.WINFUNCTYPE(ctypes.c_long, ctypes.c_int, ctypes.c_uint, ctypes.c_int, ctypes.c_int) class GdiplusStartupInput(wintypes.Structure): _fields_ = [ ('GdiplusVersion', ctypes.c_uint), ('DebugEventCallback', ctypes.c_void_p), ('SuppressBackgroundThread', wintypes.BOOL), ('SuppressExternalCodecs', wintypes.BOOL), ] def __init__(self): wintypes.Structure.__init__(self) self.GdiplusVersion = 1 self.DebugEventCallback = None self.SuppressBackgroundThread = 0 self.SuppressExternalCodecs = 0 StartupInput = GdiplusStartupInput() token = ctypes.c_ulong() gdiplus.GdiplusStartup(ctypes.pointer(token), ctypes.pointer(StartupInput), None) f = open(r'test.jpg') img = ctypes.c_void_p() fs = util.FileStream(f) istream = util.wrap(fs, pythoncom.IID_IStream) r = gdiplus.GdipLoadImageFromStream(istream, ctypes.byref(img)) From jrs.idx at ntlworld.com Tue Jan 6 13:50:38 2015 From: jrs.idx at ntlworld.com (John Sampson) Date: Tue, 06 Jan 2015 12:50:38 +0000 Subject: [python-win32] Creating standalone executable Message-ID: <54ABDA1E.5080208@ntlworld.com> Is it possible to create a standalone executable (.EXE file) from a Python script? By 'standalone' I mean an executable file that can be placed in any folder and contains or finds the libraries, modules etc. that it depends on. Regards John Sampson From graemeglass at gmail.com Tue Jan 6 14:07:34 2015 From: graemeglass at gmail.com (Graeme Glass) Date: Tue, 6 Jan 2015 15:07:34 +0200 Subject: [python-win32] Creating standalone executable In-Reply-To: <54ABDA1E.5080208@ntlworld.com> References: <54ABDA1E.5080208@ntlworld.com> Message-ID: Yes it is. http://www.py2exe.org/ http://cx-freeze.sourceforge.net/ On 6 January 2015 at 14:50, John Sampson wrote: > Is it possible to create a standalone executable (.EXE file) from a Python > script? > > By 'standalone' I mean an executable file that can be placed in any folder > and contains or finds the libraries, modules etc. that it depends on. > > Regards > > John Sampson > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrs.idx at ntlworld.com Tue Jan 6 17:59:35 2015 From: jrs.idx at ntlworld.com (John Sampson) Date: Tue, 06 Jan 2015 16:59:35 +0000 Subject: [python-win32] Creating standalone executable In-Reply-To: References: <54ABDA1E.5080208@ntlworld.com> Message-ID: <54AC1477.1080104@ntlworld.com> I tried py2exe but the executable file has to be in a specific folder along with many other files that py2exe generates. It therefore cannot be placed in any folder. As far as I can see cx-freeze produces a folder, not a single file. I am looking for a way of producing a single executable file that can be run in any folder, and nothing else - that is, standalone. Regards John Sampson On 06/01/2015 13:07, Graeme Glass wrote: > Yes it is. > > http://www.py2exe.org/ > http://cx-freeze.sourceforge.net/ > > > > On 6 January 2015 at 14:50, John Sampson > wrote: > > Is it possible to create a standalone executable (.EXE file) from > a Python script? > > By 'standalone' I mean an executable file that can be placed in > any folder and contains or finds the libraries, modules etc. that > it depends on. > > Regards > > John Sampson > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From haraldarminmassa at gmail.com Tue Jan 6 18:22:47 2015 From: haraldarminmassa at gmail.com (Harald Armin Massa[legacy]) Date: Tue, 6 Jan 2015 18:22:47 +0100 Subject: [python-win32] Creating standalone executable In-Reply-To: <54AC1477.1080104@ntlworld.com> References: <54ABDA1E.5080208@ntlworld.com> <54AC1477.1080104@ntlworld.com> Message-ID: John, you should read under http://www.py2exe.org/index.cgi/SingleFileExecutable 1 from distutils.core import setup 2 import py2exe, sys, os 3 4 sys.argv.append('py2exe') 5 6 setup( 7 options = {'py2exe': {'bundle_files': 1}}, 8 windows = [{'script': "single.py"}], 9 zipfile = None, 10 ) the documented secret lies with the bundle_files option. This way you will get down to 1-3 files: 1.) the singe file exe containing Python, your programm and the depending libraries 2.) 2 files from the Microsoft C-runtime. 2015-01-06 17:59 GMT+01:00 John Sampson : > I tried py2exe but the executable file has to be in a specific folder > along with many other files that py2exe generates. It therefore cannot be > placed in any folder. > As far as I can see cx-freeze produces a folder, not a single file. > > I am looking for a way of producing a single executable file that can be > run in any folder, and nothing else - that is, standalone. > > Regards > > John Sampson > > > On 06/01/2015 13:07, Graeme Glass wrote: > > Yes it is. > > http://www.py2exe.org/ > http://cx-freeze.sourceforge.net/ > > > > On 6 January 2015 at 14:50, John Sampson wrote: > >> Is it possible to create a standalone executable (.EXE file) from a >> Python script? >> >> By 'standalone' I mean an executable file that can be placed in any >> folder and contains or finds the libraries, modules etc. that it depends on. >> >> Regards >> >> John Sampson >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -- LightningTalkMan a brand of GHUM GmbH Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zturner at google.com Tue Jan 6 18:22:57 2015 From: zturner at google.com (Zachary Turner) Date: Tue, 06 Jan 2015 17:22:57 +0000 Subject: [python-win32] Creating standalone executable References: <54ABDA1E.5080208@ntlworld.com> <54AC1477.1080104@ntlworld.com> Message-ID: Never used it before, so take this with a grain of salt, but try this: http://nuitka.net/pages/overview.html AFAIK it's still not considered a stable release, but it might be worth checking out. On Tue Jan 06 2015 at 9:00:02 AM John Sampson wrote: > I tried py2exe but the executable file has to be in a specific folder > along with many other files that py2exe generates. It therefore cannot be > placed in any folder. > As far as I can see cx-freeze produces a folder, not a single file. > > I am looking for a way of producing a single executable file that can be > run in any folder, and nothing else - that is, standalone. > > Regards > > > John Sampson > > > On 06/01/2015 13:07, Graeme Glass wrote: > > Yes it is. > > http://www.py2exe.org/ > http://cx-freeze.sourceforge.net/ > > > > On 6 January 2015 at 14:50, John Sampson wrote: > >> Is it possible to create a standalone executable (.EXE file) from a >> Python script? >> >> By 'standalone' I mean an executable file that can be placed in any >> folder and contains or finds the libraries, modules etc. that it depends on. >> >> Regards >> >> John Sampson >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From haraldarminmassa at gmail.com Tue Jan 6 18:24:43 2015 From: haraldarminmassa at gmail.com (Harald Armin Massa[legacy]) Date: Tue, 6 Jan 2015 18:24:43 +0100 Subject: [python-win32] Creating standalone executable In-Reply-To: References: <54ABDA1E.5080208@ntlworld.com> <54AC1477.1080104@ntlworld.com> Message-ID: John, you should read under http://www.py2exe.org/index.cgi/SingleFileExecutable 1 from distutils.core import setup 2 import py2exe, sys, os 3 4 sys.argv.append('py2exe') 5 6 setup( 7 options = {'py2exe': {'bundle_files': 1}}, 8 windows = [{'script': "single.py"}], 9 zipfile = None, 10 ) the documented secret lies with the bundle_files option. This way you will get down to 1-3 files: 1.) the singe file exe containing Python, your programm and the depending libraries 2.) 2 files from the Microsoft C-runtime. on recent Windows usually those C-Runtimes are present. To get them mangled into the single exe-file there is no ready made tool available; and the majority agrees that those libraries would not be licenced for this usage (they are licenced for redistribution). best wishes, Harald 2015-01-06 18:22 GMT+01:00 Harald Armin Massa[legacy] < haraldarminmassa at gmail.com>: > John, > > you should read under > > http://www.py2exe.org/index.cgi/SingleFileExecutable > > 1 from distutils.core import setup 2 import py2exe, sys, os 3 4 sys.argv.append('py2exe') 5 6 setup( 7 options = {'py2exe': {'bundle_files': 1}}, 8 windows = [{'script': "single.py"}], 9 zipfile = None, 10 ) > > > the documented secret lies with the bundle_files option. > > This way you will get down to 1-3 files: > > 1.) the singe file exe containing Python, your programm and the depending > libraries > 2.) 2 files from the Microsoft C-runtime. > > 2015-01-06 17:59 GMT+01:00 John Sampson : > >> I tried py2exe but the executable file has to be in a specific folder >> along with many other files that py2exe generates. It therefore cannot be >> placed in any folder. >> As far as I can see cx-freeze produces a folder, not a single file. >> >> I am looking for a way of producing a single executable file that can be >> run in any folder, and nothing else - that is, standalone. >> >> Regards >> >> John Sampson >> >> >> On 06/01/2015 13:07, Graeme Glass wrote: >> >> Yes it is. >> >> http://www.py2exe.org/ >> http://cx-freeze.sourceforge.net/ >> >> >> >> On 6 January 2015 at 14:50, John Sampson wrote: >> >>> Is it possible to create a standalone executable (.EXE file) from a >>> Python script? >>> >>> By 'standalone' I mean an executable file that can be placed in any >>> folder and contains or finds the libraries, modules etc. that it depends on. >>> >>> Regards >>> >>> John Sampson >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> https://mail.python.org/mailman/listinfo/python-win32 >>> >> >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> >> > > > -- > LightningTalkMan > a brand of GHUM GmbH > Spielberger Stra?e 49 > 70435 Stuttgart > 0173/9409607 > > -- LightningTalkMan a brand of GHUM GmbH Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdmain at comcast.net Tue Jan 6 18:30:32 2015 From: jdmain at comcast.net (J.D. Main) Date: Tue, 06 Jan 2015 10:30:32 -0700 Subject: [python-win32] Creating standalone executable In-Reply-To: <54AC1477.1080104@ntlworld.com> References: <54ABDA1E.5080208@ntlworld.com> <54AC1477.1080104@ntlworld.com> Message-ID: <54AC1BB8.1040209@comcast.net> I've had good success with PyInstaller. https://github.com/pyinstaller/pyinstaller/wiki I like it better than Py2Exe - it seems to "just work" without a lot of fiddling. JDM On 1/6/2015 9:59 AM, John Sampson wrote: > I tried py2exe but the executable file has to be in a specific folder > along with many other files that py2exe generates. It therefore cannot > be placed in any folder. > As far as I can see cx-freeze produces a folder, not a single file. > > I am looking for a way of producing a single executable file that can > be run in any folder, and nothing else - that is, standalone. > > Regards > > John Sampson > > On 06/01/2015 13:07, Graeme Glass wrote: >> Yes it is. >> >> http://www.py2exe.org/ >> http://cx-freeze.sourceforge.net/ >> >> >> >> On 6 January 2015 at 14:50, John Sampson > > wrote: >> >> Is it possible to create a standalone executable (.EXE file) from >> a Python script? >> >> By 'standalone' I mean an executable file that can be placed in >> any folder and contains or finds the libraries, modules etc. that >> it depends on. >> >> Regards >> >> John Sampson >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> >> > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaelwtsn4 at gmail.com Tue Jan 6 19:38:14 2015 From: michaelwtsn4 at gmail.com (Michael Watson) Date: Tue, 6 Jan 2015 13:38:14 -0500 Subject: [python-win32] python-win32 Digest, Vol 142, Issue 5 In-Reply-To: References: Message-ID: I am giving a pretty simple overview of how to use InnoSetup and py2exe to distribute Python apps at PyTennessee. https://www.pytennessee.org/proposals/114/ You can use the bundle_files option (mentioned above) to cut down the number of additional files, then use InnoSetup to package everything together into a single .msi for distribution (there will still be 3 files once installed). On Tue, Jan 6, 2015 at 12:30 PM, wrote: > Send python-win32 mailing list submissions to > python-win32 at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/python-win32 > or, via email, send a message with subject or body 'help' to > python-win32-request at python.org > > You can reach the person managing the list at > python-win32-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of python-win32 digest..." > > > Today's Topics: > > 1. Re: Creating standalone executable (Zachary Turner) > 2. Re: Creating standalone executable (Harald Armin Massa[legacy]) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 06 Jan 2015 17:22:57 +0000 > From: Zachary Turner > To: John Sampson , python foro > > Subject: Re: [python-win32] Creating standalone executable > Message-ID: > < > CAAErz9hVH0mi+DsN250eY3jtqbUUGx4RnjNfJrcPiLn9ZJ2wxA at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Never used it before, so take this with a grain of salt, but try this: > http://nuitka.net/pages/overview.html AFAIK it's still not considered a > stable release, but it might be worth checking out. > > On Tue Jan 06 2015 at 9:00:02 AM John Sampson > wrote: > > > I tried py2exe but the executable file has to be in a specific folder > > along with many other files that py2exe generates. It therefore cannot be > > placed in any folder. > > As far as I can see cx-freeze produces a folder, not a single file. > > > > I am looking for a way of producing a single executable file that can be > > run in any folder, and nothing else - that is, standalone. > > > > Regards > > > > > > John Sampson > > > > > > On 06/01/2015 13:07, Graeme Glass wrote: > > > > Yes it is. > > > > http://www.py2exe.org/ > > http://cx-freeze.sourceforge.net/ > > > > > > > > On 6 January 2015 at 14:50, John Sampson wrote: > > > >> Is it possible to create a standalone executable (.EXE file) from a > >> Python script? > >> > >> By 'standalone' I mean an executable file that can be placed in any > >> folder and contains or finds the libraries, modules etc. that it > depends on. > >> > >> Regards > >> > >> John Sampson > >> _______________________________________________ > >> python-win32 mailing list > >> python-win32 at python.org > >> https://mail.python.org/mailman/listinfo/python-win32 > >> > > > > > > _______________________________________________ > > python-win32 mailing list > > python-win32 at python.org > > https://mail.python.org/mailman/listinfo/python-win32 > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/python-win32/attachments/20150106/47e43b52/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Tue, 6 Jan 2015 18:24:43 +0100 > From: "Harald Armin Massa[legacy]" > To: "Harald Armin Massa[legacy]" > Cc: python foro > Subject: Re: [python-win32] Creating standalone executable > Message-ID: > dZRjbMnnXp9fYA6caA at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > John, > > you should read under > > http://www.py2exe.org/index.cgi/SingleFileExecutable > > 1 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_1 > > > from distutils.core import setup 2 > < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_2 > > > import py2exe, sys, os 3 > < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_3 > > > 4 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_4 > > > sys.argv.append('py2exe') 5 > < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_5 > > > 6 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_6 > > > setup( 7 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_7 > > > options = {'py2exe': {'bundle_files': 1}}, 8 > < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_8 > > > windows = [{'script': "single.py"}], 9 > < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_9 > > > zipfile = None, 10 > < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_10 > > > ) > > > the documented secret lies with the bundle_files option. > > This way you will get down to 1-3 files: > > 1.) the singe file exe containing Python, your programm and the depending > libraries > 2.) 2 files from the Microsoft C-runtime. > > on recent Windows usually those C-Runtimes are present. To get them mangled > into the single exe-file there is no ready made tool available; and the > majority agrees that those libraries would not be licenced for this usage > (they are licenced for redistribution). > > best wishes, > > Harald > > > > 2015-01-06 18:22 GMT+01:00 Harald Armin Massa[legacy] < > haraldarminmassa at gmail.com>: > > > John, > > > > you should read under > > > > http://www.py2exe.org/index.cgi/SingleFileExecutable > > > > 1 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_1> > from distutils.core import setup 2 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_2> > import py2exe, sys, os 3 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_3> > 4 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_4> > sys.argv.append('py2exe') 5 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_5> > 6 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_6> > setup( 7 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_7> > options = {'py2exe': {'bundle_files': 1}}, 8 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_8> > windows = [{' > script': "single.py"}], 9 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_9> > zipfile = None, 10 < > http://www.py2exe.org/index.cgi/SingleFileExecutable#CA-7615755cbd8c1a2a3a7d2b593a265f3ed4c42c76_10> > ) > > > > > > the documented secret lies with the bundle_files option. > > > > This way you will get down to 1-3 files: > > > > 1.) the singe file exe containing Python, your programm and the depending > > libraries > > 2.) 2 files from the Microsoft C-runtime. > > > > 2015-01-06 17:59 GMT+01:00 John Sampson : > > > >> I tried py2exe but the executable file has to be in a specific folder > >> along with many other files that py2exe generates. It therefore cannot > be > >> placed in any folder. > >> As far as I can see cx-freeze produces a folder, not a single file. > >> > >> I am looking for a way of producing a single executable file that can be > >> run in any folder, and nothing else - that is, standalone. > >> > >> Regards > >> > >> John Sampson > >> > >> > >> On 06/01/2015 13:07, Graeme Glass wrote: > >> > >> Yes it is. > >> > >> http://www.py2exe.org/ > >> http://cx-freeze.sourceforge.net/ > >> > >> > >> > >> On 6 January 2015 at 14:50, John Sampson wrote: > >> > >>> Is it possible to create a standalone executable (.EXE file) from a > >>> Python script? > >>> > >>> By 'standalone' I mean an executable file that can be placed in any > >>> folder and contains or finds the libraries, modules etc. that it > depends on. > >>> > >>> Regards > >>> > >>> John Sampson > >>> _______________________________________________ > >>> python-win32 mailing list > >>> python-win32 at python.org > >>> https://mail.python.org/mailman/listinfo/python-win32 > >>> > >> > >> > >> > >> _______________________________________________ > >> python-win32 mailing list > >> python-win32 at python.org > >> https://mail.python.org/mailman/listinfo/python-win32 > >> > >> > > > > > > -- > > LightningTalkMan > > a brand of GHUM GmbH > > Spielberger Stra?e 49 > > 70435 Stuttgart > > 0173/9409607 > > > > > > > -- > LightningTalkMan > a brand of GHUM GmbH > Spielberger Stra?e 49 > 70435 Stuttgart > 0173/9409607 > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/python-win32/attachments/20150106/2765367c/attachment.html > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > > ------------------------------ > > End of python-win32 Digest, Vol 142, Issue 5 > ******************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at blindza.co.za Tue Jan 6 21:21:31 2015 From: jacob at blindza.co.za (Jacob Kruger) Date: Tue, 6 Jan 2015 22:21:31 +0200 Subject: [python-win32] Creating standalone executable In-Reply-To: <54AC1BB8.1040209@comcast.net> References: <54ABDA1E.5080208@ntlworld.com> <54AC1477.1080104@ntlworld.com> <54AC1BB8.1040209@comcast.net> Message-ID: <61B2DAB8B8994A8BA81F38C9B770BE6B@JakesPC> Was also going to mention pyInstaller - once it's installed, there'll be an executable in your python/scripts directory, and something like the following command line from your directory where your source is will try to generate a single file executable - something like the following: c:\python27\scripts\pyinstaller.exe scriptName.py --onefile Not sure it also works perfectly with required files/libraries, etc., and generally stick to cx_freeze myself, but, this does work for a cleaner bit of output... Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ----- Original Message ----- From: J.D. Main To: python-win32 at python.org Sent: Tuesday, January 06, 2015 7:30 PM Subject: Re: [python-win32] Creating standalone executable I've had good success with PyInstaller. https://github.com/pyinstaller/pyinstaller/wiki I like it better than Py2Exe - it seems to "just work" without a lot of fiddling. JDM On 1/6/2015 9:59 AM, John Sampson wrote: I tried py2exe but the executable file has to be in a specific folder along with many other files that py2exe generates. It therefore cannot be placed in any folder. As far as I can see cx-freeze produces a folder, not a single file. I am looking for a way of producing a single executable file that can be run in any folder, and nothing else - that is, standalone. Regards John Sampson On 06/01/2015 13:07, Graeme Glass wrote: Yes it is. http://www.py2exe.org/ http://cx-freeze.sourceforge.net/ On 6 January 2015 at 14:50, John Sampson wrote: Is it possible to create a standalone executable (.EXE file) from a Python script? By 'standalone' I mean an executable file that can be placed in any folder and contains or finds the libraries, modules etc. that it depends on. Regards John Sampson _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 ------------------------------------------------------------------------------ _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zachary.ware+pydev at gmail.com Tue Jan 6 18:05:04 2015 From: zachary.ware+pydev at gmail.com (Zachary Ware) Date: Tue, 6 Jan 2015 11:05:04 -0600 Subject: [python-win32] Creating standalone executable In-Reply-To: <54AC1477.1080104@ntlworld.com> References: <54ABDA1E.5080208@ntlworld.com> <54AC1477.1080104@ntlworld.com> Message-ID: On Tue, Jan 6, 2015 at 10:59 AM, John Sampson wrote: > I tried py2exe but the executable file has to be in a specific folder along > with many other files that py2exe generates. It therefore cannot be placed > in any folder. > As far as I can see cx-freeze produces a folder, not a single file. > > I am looking for a way of producing a single executable file that can be run > in any folder, and nothing else - that is, standalone. Check the 'bundle' option of py2exe. I've not yet had a project where I could use it to its full extent so I don't know for sure that it works, but py2exe does have the option to bundle everything into the .exe (if you meet the right conditions). -- Zach From jrs.idx at ntlworld.com Wed Jan 7 11:38:35 2015 From: jrs.idx at ntlworld.com (John Sampson) Date: Wed, 07 Jan 2015 10:38:35 +0000 Subject: [python-win32] Creating standalone executable In-Reply-To: <54AC1BB8.1040209@comcast.net> References: <54ABDA1E.5080208@ntlworld.com> <54AC1477.1080104@ntlworld.com> <54AC1BB8.1040209@comcast.net> Message-ID: <54AD0CAB.4090502@ntlworld.com> Many thanks - by specifying '-F' I was able to produce an .exe file which appeared in the 'build' folder. This could be moved to another folder and still work, which is what I was looking for. My only question is about the other files in the 'build' folder and its subfolders. Are these still needed? If so, what if I make another standalone executable? Is there a need for another 'build' folder tree for it, to exist as well as the 'build' folder tree for the first standalone executable? Regards John Sampson On 06/01/2015 17:30, J.D. Main wrote: > I've had good success with PyInstaller. > > https://github.com/pyinstaller/pyinstaller/wiki > > I like it better than Py2Exe - it seems to "just work" without a lot > of fiddling. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kapileyes at gmail.com Fri Jan 16 11:43:21 2015 From: kapileyes at gmail.com (Kapil Dolas) Date: Fri, 16 Jan 2015 16:13:21 +0530 Subject: [python-win32] Possible memory leak in pywin32 Message-ID: Hi, I am using pywin32's mapi module to read data from PSTs. I have shared my program which reads email and attachment data here (http://pastebin.com/2AXy3BVH). Currently, program is not storing any of the read data. But, still I can see gradual increase in memory usage when I run the program over large PST. That PST contains around 9000 emails and it has 9 GB of data. Max size of email is 24 MB only. For this PST, program's initial memory usage is about 10 MB, but it gradually increases and reaches to 40-45 MB. I don't know why this memory usage increases up to this value. I have tried using pympler to find the root cause, but without any success. It appears that memory increase is not due to python objects. Can you point out the reason behind (gradual) increase in memory usage? Is it due to the memory leak in pywin32, or any mistakes in my program? Regards, Kapil Dolas -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Fri Jan 16 18:41:08 2015 From: timr at probo.com (Tim Roberts) Date: Fri, 16 Jan 2015 09:41:08 -0800 Subject: [python-win32] Possible memory leak in pywin32 In-Reply-To: References: Message-ID: <54B94D34.2010008@probo.com> Kapil Dolas wrote: > > I am using pywin32's mapi module to read data from PSTs. I have shared > my program which reads email and attachment datahere > (http://pastebin.com/2AXy3BVH). > Currently, program is not storing any of the read data. But, still I > can see gradual increase in memory usage when I run the program over > large PST. That PST contains around 9000 emails and it has 9 GB of > data. Max size of email is 24 MB only. For this PST, program's initial > memory usage is about 10 MB, but it gradually increases and reaches to > 40-45 MB. I don't know why this memory usage increases up to this > value. I have tried using pympler to find the root cause, but without > any success. It appears that memory increase is not due to python > objects. Can you point out the reason behind (gradual) increase in > memory usage? Is it due to the memory leak in pywin32, or any mistakes > in my program? > MAPI is the poor neglected stepchild in the Windows world. It is functional, but it has received relatively little optimization attention. My guess is you're just seeing memory being used by MAPI itself, perhaps building an index of your mammoth PST. For what it's worth, 45 MB is nothing. Thunderbird balloons to 400MB on my machine. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From michaelwtsn4 at gmail.com Fri Jan 16 19:32:59 2015 From: michaelwtsn4 at gmail.com (Michael Watson) Date: Fri, 16 Jan 2015 13:32:59 -0500 Subject: [python-win32] python-win32 Digest, Vol 142, Issue 8 In-Reply-To: References: Message-ID: Are you doing anything with threading (I see you are making a call to pythoncom.GetInterfaceCount()? If so check out http://stackoverflow.com/questions/16367328/memory-leak-in-threaded-com-object-with-python/16617092#16617092 I've had an issues with a leak and win32 and this took care of it. I have had a couple other problems with win32 and memory leaks and eventually I just throw the code execution in a separate python.exe process using multiprocessing so that the entire memory space is isolated and released when I end that process. Not very clean, but it works. On Fri, Jan 16, 2015 at 6:00 AM, wrote: > Send python-win32 mailing list submissions to > python-win32 at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/python-win32 > or, via email, send a message with subject or body 'help' to > python-win32-request at python.org > > You can reach the person managing the list at > python-win32-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of python-win32 digest..." > > > Today's Topics: > > 1. Possible memory leak in pywin32 (Kapil Dolas) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 16 Jan 2015 16:13:21 +0530 > From: Kapil Dolas > To: python-win32 at python.org > Subject: [python-win32] Possible memory leak in pywin32 > Message-ID: > < > CAJPvLSHB4q6jcmWevkxh9TOWfjU4N8R9FcgVxB6-YL8E-s4hqw at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Hi, > > I am using pywin32's mapi module to read data from PSTs. I have shared my > program which reads email and attachment data here > (http://pastebin.com/2AXy3BVH). Currently, > program is not storing any of the read data. But, still I can see gradual > increase in memory usage when I run the program over large PST. That PST > contains around 9000 emails and it has 9 GB of data. Max size of email is > 24 MB only. For this PST, program's initial memory usage is about 10 MB, > but it gradually increases and reaches to 40-45 MB. I don't know why this > memory usage increases up to this value. I have tried using pympler to find > the root cause, but without any success. It appears that memory increase is > not due to python objects. Can you point out the reason behind (gradual) > increase in memory usage? Is it due to the memory leak in pywin32, or any > mistakes in my program? > > Regards, > Kapil Dolas > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/python-win32/attachments/20150116/5108d64b/attachment-0001.html > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > > ------------------------------ > > End of python-win32 Digest, Vol 142, Issue 8 > ******************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alptungazkul at hotmail.com Sun Jan 18 18:02:01 2015 From: alptungazkul at hotmail.com (=?windows-1254?B?QWxwIFR1bmdhINZ6a3Vs?=) Date: Sun, 18 Jan 2015 19:02:01 +0200 Subject: [python-win32] Storing Passwords. Message-ID: Hello, I am working on a project where my program need to access the servers with the passwords i store in a text file. Is there a neat way of storing passwords other than text files? Users will never need to recover their passwords but the program itself have to. Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From alptungazkul at hotmail.com Sun Jan 18 19:19:39 2015 From: alptungazkul at hotmail.com (=?windows-1254?B?QWxwIFR1bmdhINZ6a3Vs?=) Date: Sun, 18 Jan 2015 20:19:39 +0200 Subject: [python-win32] Storing Passwords. In-Reply-To: References: , Message-ID: It does not the matter of extension, the point is users shouldn't be able to access the previously entered passwords. For instance if encrypting is the answer, which libraries does people generally use. Date: Sun, 18 Jan 2015 18:16:08 +0000 Subject: Re: [python-win32] Storing Passwords. From: joss at jossgray.net To: alptungazkul at hotmail.com CC: python-win32 at python.org Why don't you want to use a text file? On 18 Jan 2015 18:11, "Alp Tunga ?zkul" wrote: Hello, I am working on a project where my program need to access the servers with the passwords i store in a text file. Is there a neat way of storing passwords other than text files? Users will never need to recover their passwords but the program itself have to. Thanks in advance! _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From joss at jossgray.net Sun Jan 18 19:16:08 2015 From: joss at jossgray.net (Joss Gray) Date: Sun, 18 Jan 2015 18:16:08 +0000 Subject: [python-win32] Storing Passwords. In-Reply-To: References: Message-ID: Why don't you want to use a text file? On 18 Jan 2015 18:11, "Alp Tunga ?zkul" wrote: > Hello, > > I am working on a project where my program need to access the servers with > the passwords i store in a text file. > > Is there a neat way of storing passwords other than text files? Users will > never need to recover their passwords but the program itself have to. > > Thanks in advance! > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From calderon.christian760 at gmail.com Sun Jan 18 20:41:33 2015 From: calderon.christian760 at gmail.com (Christian Calderon) Date: Sun, 18 Jan 2015 11:41:33 -0800 Subject: [python-win32] Storing Passwords. In-Reply-To: References: Message-ID: Why don't you just store the hash of the password? On Sunday, January 18, 2015, Alp Tunga ?zkul wrote: > It does not the matter of extension, the point is users shouldn't be able > to access the previously entered passwords. > > For instance if encrypting is the answer, which libraries does people > generally use. > > > Why don't you want to use a text file? > On 18 Jan 2015 18:11, "Alp Tunga ?zkul" > wrote: > > Hello, > > I am working on a project where my program need to access the servers with > the passwords i store in a text file. > > Is there a neat way of storing passwords other than text files? Users will > never need to recover their passwords but the program itself have to. > > Thanks in advance! > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > > https://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alptungazkul at hotmail.com Sun Jan 18 21:11:47 2015 From: alptungazkul at hotmail.com (=?windows-1254?B?QWxwIFR1bmdhINZ6a3Vs?=) Date: Sun, 18 Jan 2015 22:11:47 +0200 Subject: [python-win32] Storing Passwords. In-Reply-To: References: , , , Message-ID: As far as i know Username + Password =(MD5/SHA) Hash. And it is irreversible. I need the actual Username and Password to login to Servers (WMI). Because lets say there is 10 different servers with 10 different credentials that my user use to access those servers, i need to store user given credentials for the next session. Date: Sun, 18 Jan 2015 11:41:33 -0800 Subject: Re: [python-win32] Storing Passwords. From: calderon.christian760 at gmail.com To: alptungazkul at hotmail.com CC: joss at jossgray.net; python-win32 at python.org Why don't you just store the hash of the password? On Sunday, January 18, 2015, Alp Tunga ?zkul wrote: It does not the matter of extension, the point is users shouldn't be able to access the previously entered passwords. For instance if encrypting is the answer, which libraries does people generally use. Why don't you want to use a text file? On 18 Jan 2015 18:11, "Alp Tunga ?zkul" wrote: Hello, I am working on a project where my program need to access the servers with the passwords i store in a text file. Is there a neat way of storing passwords other than text files? Users will never need to recover their passwords but the program itself have to. Thanks in advance! _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jan 19 08:07:48 2015 From: timr at probo.com (Tim Roberts) Date: Sun, 18 Jan 2015 23:07:48 -0800 Subject: [python-win32] Storing Passwords. In-Reply-To: References: <,> <,> <,> Message-ID: <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> On Jan 18, 2015, at 12:11 PM, Alp Tunga ?zkul > wrote: As far as i know Username + Password =(MD5/SHA) Hash. And it is irreversible. I need the actual Username and Password to login to Servers (WMI). Because lets say there is 10 different servers with 10 different credentials that my user use to access those servers, i need to store user given credentials for the next session. There is simply no general solution. If your program can recover the plaintext password, then anyone with access to the text files can recover the plaintext password. If you don?t want to store the passwords, then your only solution is to ask the user to enter them every time. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bhood2 at comcast.net Mon Jan 19 13:27:35 2015 From: bhood2 at comcast.net (Bob Hood) Date: Mon, 19 Jan 2015 05:27:35 -0700 Subject: [python-win32] Storing Passwords. In-Reply-To: <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> References: <, > <, > <, > <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> Message-ID: <54BCF837.3070004@comcast.net> On 1/19/2015 12:07 AM, Tim Roberts wrote: > On Jan 18, 2015, at 12:11 PM, Alp Tunga ?zkul > wrote: >> >> As far as i know Username + Password =(MD5/SHA) Hash. And it is >> irreversible. I need the actual Username and Password to login to Servers >> (WMI). >> >> Because lets say there is 10 different servers with 10 different >> credentials that my user use to access those servers, i need to store user >> given credentials for the next session. > > There is simply no general solution. If your program can recover the > plaintext password, then anyone with access to the text files can recover > the plaintext password. > > If you don?t want to store the passwords, then your only solution is to ask > the user to enter them every time. I'm probably missing some crucial point here, but with Python being the host environment, why wouldn't the Python "keyring" module provide the hardened storage the OP is seeking? Each major OS (Windows, OS X and Linux) has an operating system-hosted location for storing sensitive data--such as passwords--so they cannot easily be accessed. The "keyring" provides a framework for accessing each. Absolutely no need to store them in plain text files on any OS. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at blindza.co.za Mon Jan 19 13:36:29 2015 From: jacob at blindza.co.za (Jacob Kruger) Date: Mon, 19 Jan 2015 14:36:29 +0200 Subject: [python-win32] Implementing an instance of an external/physical .dll file? Message-ID: I have a .dll pulled from following hub: https://github.com/qtnc/UniversalSpeech What's the easiest/simplest way to then implement/instantiate an instance of it working via file path? If possible, and, currently working with python 3.4, on a windows7 64 bit machine, FWIW. Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul_koning at dell.com Mon Jan 19 15:48:28 2015 From: paul_koning at dell.com (Paul Koning) Date: Mon, 19 Jan 2015 09:48:28 -0500 Subject: [python-win32] Storing Passwords. In-Reply-To: <54BCF837.3070004@comcast.net> References: <, > <, > <, > <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> <54BCF837.3070004@comcast.net> Message-ID: <33769047-9190-43FA-A722-25C1D39BE098@dell.com> > On Jan 19, 2015, at 7:27 AM, Bob Hood wrote: > > On 1/19/2015 12:07 AM, Tim Roberts wrote: >> On Jan 18, 2015, at 12:11 PM, Alp Tunga ?zkul wrote: >>> >>> As far as i know Username + Password =(MD5/SHA) Hash. And it is irreversible. I need the actual Username and Password to login to Servers (WMI). >>> >>> Because lets say there is 10 different servers with 10 different credentials that my user use to access those servers, i need to store user given credentials for the next session. >> >> There is simply no general solution. If your program can recover the plaintext password, then anyone with access to the text files can recover the plaintext password. >> >> If you don?t want to store the passwords, then your only solution is to ask the user to enter them every time. > > I'm probably missing some crucial point here, but with Python being the host environment, why wouldn't the Python "keyring" module provide the hardened storage the OP is seeking? Each major OS (Windows, OS X and Linux) has an operating system-hosted location for storing sensitive data--such as passwords--so they cannot easily be accessed. The "keyring" provides a framework for accessing each. > > Absolutely no need to store them in plain text files on any OS. The advantage of text files is that it makes it clear that the storage is NOT secure. The drawback of other schemes is that they may also be insecure, but give the user an illusion of security. For example, if your script can extract the secret, so presumably can any other script or program. If so, why not use a text file? At least that way it?s clear that the barn door is wide open. Yes, OSs have some way of storing sensitive data. If security matters, you should look closely at how those things work, and whether they actually deliver the security required for whatever data you?re putting there. You should also document clearly how things are stored, so that users of your software can independently make that evaluation for themselves. paul From bhood2 at comcast.net Mon Jan 19 16:20:07 2015 From: bhood2 at comcast.net (Bob Hood) Date: Mon, 19 Jan 2015 08:20:07 -0700 Subject: [python-win32] Storing Passwords. In-Reply-To: <33769047-9190-43FA-A722-25C1D39BE098@dell.com> References: <, > <, > <, > <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> <54BCF837.3070004@comcast.net> <33769047-9190-43FA-A722-25C1D39BE098@dell.com> Message-ID: <54BD20A7.3010607@comcast.net> On 1/19/2015 7:48 AM, Paul Koning wrote: >> On Jan 19, 2015, at 7:27 AM, Bob Hood wrote: >> >> On 1/19/2015 12:07 AM, Tim Roberts wrote: >>> On Jan 18, 2015, at 12:11 PM, Alp Tunga ?zkul wrote: >>>> As far as i know Username + Password =(MD5/SHA) Hash. And it is irreversible. I need the actual Username and Password to login to Servers (WMI). >>>> >>>> Because lets say there is 10 different servers with 10 different credentials that my user use to access those servers, i need to store user given credentials for the next session. >>> There is simply no general solution. If your program can recover the plaintext password, then anyone with access to the text files can recover the plaintext password. >>> >>> If you don?t want to store the passwords, then your only solution is to ask the user to enter them every time. >> I'm probably missing some crucial point here, but with Python being the host environment, why wouldn't the Python "keyring" module provide the hardened storage the OP is seeking? Each major OS (Windows, OS X and Linux) has an operating system-hosted location for storing sensitive data--such as passwords--so they cannot easily be accessed. The "keyring" provides a framework for accessing each. >> >> Absolutely no need to store them in plain text files on any OS. > The advantage of text files is that it makes it clear that the storage is NOT secure. The drawback of other schemes is that they may also be insecure, but give the user an illusion of security. For example, if your script can extract the secret, so presumably can any other script or program. If so, why not use a text file? At least that way it?s clear that the barn door is wide open. Agreed. However, most of the time, those who have compromised your system are doing a smash-and-grab where they are just looking for files they can copy. It takes more time and effort to find (or upload) a program that they can execute to extract "hidden" information than to simply discover a file called "passwords.txt" and copy that to their local system. Sony did this--quite literally had a file called "passwords.txt" that quite literally contained user names and passwords. It's understood that storing these things in an operating system-specific "vault" would not be 100% safe, but, in the end, it certainly would have been more of a deterrent than just putting your passwords into a plain text file. From rays at blue-cove.com Mon Jan 19 17:21:50 2015 From: rays at blue-cove.com (R Schumacher) Date: Mon, 19 Jan 2015 08:21:50 -0800 Subject: [python-win32] Storing Passwords. In-Reply-To: <54BD20A7.3010607@comcast.net> References: <, > <, > <, > <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> <54BCF837.3070004@comcast.net> <33769047-9190-43FA-A722-25C1D39BE098@dell.com> <54BD20A7.3010607@comcast.net> Message-ID: <201501191621.t0JGLs0c002359@blue-cove.com> At 07:20 AM 1/19/2015, Bob Hood wrote: >On 1/19/2015 7:48 AM, Paul Koning wrote: > > > The advantage of text files is that it makes it clear that the > storage is NOT secure. The drawback of other schemes is that they > may also be insecure, but give the user an illusion of > security. For example, if your script can extract the secret, so > presumably can any other script or program. If so, why not use a > text file? At least that way it's clear that the barn door is wide open. > >Agreed. However, most of the time, those who have compromised your system are >doing a smash-and-grab where they are just looking for files they can copy. >It takes more time and effort to find (or upload) a program that they can >execute to extract "hidden" information than to simply discover a file called >"passwords.txt" and copy that to their local system. If Python (pywin32 say?) can do IO on password data, then presumably anyone who gains shell access can also, trivially. Take Active Directory security, for instance; the OP might benefit from this discussion: http://stackoverflow.com/questions/7111618/win32-how-to-validate-credentials-against-active-directory So, if one gains shell access, then a few milliseconds later easily employs http://docs.activestate.com/activepython/2.5/pywin32/html/com/help/active_directory.html where even in the supposedly "invalid" methods in the SO link one could run millions of Exception-tests in seconds, testing the hashed, "securely stored" passwords. There is some benefit to using OS objects in that hackers with only access through http/ftp can't do a grab-and-go. Unless of course they have access to copy the DB file, then beating on it later, for days, is possible. From timr at probo.com Mon Jan 19 20:17:18 2015 From: timr at probo.com (Tim Roberts) Date: Mon, 19 Jan 2015 11:17:18 -0800 Subject: [python-win32] Implementing an instance of an external/physical .dll file? In-Reply-To: References: Message-ID: <54BD583E.40802@probo.com> Jacob Kruger wrote: > I have a .dll pulled from following hub: > https://github.com/qtnc/UniversalSpeech > > What's the easiest/simplest way to then implement/instantiate an > instance of it working via file path? > > If possible, and, currently working with python 3.4, on a windows7 64 > bit machine, FWIW. You can use the ctypes module to access virtually any arbitrary DLL. That's what they mean when they talk about an FFI library. There's a learning curve, but essentially anything is possible. Let me caution you, however, that the DLL in that release is a 32-bit DLL. If you are using 32-bit Python, you're OK. If you're using 64-bit Python, you can't use the binary. You'd have to build it from source. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From greg.ewing at canterbury.ac.nz Mon Jan 19 21:51:13 2015 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 20 Jan 2015 09:51:13 +1300 Subject: [python-win32] Storing Passwords. In-Reply-To: <54BCF837.3070004@comcast.net> References: <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> <54BCF837.3070004@comcast.net> Message-ID: <54BD6E41.9020601@canterbury.ac.nz> Bob Hood wrote: > I'm probably missing some crucial point here, but with Python being the > host environment, why wouldn't the Python "keyring" module provide the > hardened storage the OP is seeking? The same problem arises. If the program can get the password out of the keyring, then so can any user who is capable of running the program. If nothing else, by inserting a print statement into the program at the point just after it has retrieved the password. Keyrings allow a user to keep his or her passwords secret from *other* users. The OP seems to want to keep the *user* of the password from being able to know it, which is fundamentally impossible. The best you can do is obfuscate it, but with Python code being so easy to reverse-engineer, you can't get much security that way. -- Greg From jacob at blindza.co.za Mon Jan 19 22:20:00 2015 From: jacob at blindza.co.za (Jacob Kruger) Date: Mon, 19 Jan 2015 23:20:00 +0200 Subject: [python-win32] Implementing an instance of an external/physical .dll file? In-Reply-To: <54BD583E.40802@probo.com> References: <54BD583E.40802@probo.com> Message-ID: ----- Original Message ----- > You can use the ctypes module to access virtually any arbitrary DLL. > That's what they mean when they talk about an FFI library. There's a > learning curve, but essentially anything is possible. Ok, both of the following code snippets execute without any errors/issues: from ctypes import * import os #first one uS = windll.LoadLibrary(os.path.realpath("UniversalSpeech.dll")) #second one uSc = cdll.LoadLibrary(os.path.realpath("UniversalSpeech.dll")) #end code But, issue then is that am really not sure how to then work with functions/methods 'exposed' by the instance/DLL, since if look at some of the ctypes tutorial material, it seems like you need to already know exactly what the .dll offers, etc., to then set up/implement wrappers/pointers to things like functions, etc.? > > Let me caution you, however, that the DLL in that release is a 32-bit > DLL. If you are using 32-bit Python, you're OK. If you're using 64-bit > Python, you can't use the binary. You'd have to build it from source. I specifically stick to 32-bit python, in case it will affect target, etc. > > -- > Tim Roberts, timr at probo.com But, for example, when working with another alternative that has been registered on system, and then using win32com.client, can just make function calls, etc., but, think that one relates to that .dll having been run through an effective regsvr32? So, something along the lines of referring to it using it's ProgID: #start code import win32com.client spk = win32com.client.Dispatch("Say.Tools") spk.Say("hello world") #end code Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." From vernondcole at gmail.com Mon Jan 19 23:30:07 2015 From: vernondcole at gmail.com (Vernon D. Cole) Date: Mon, 19 Jan 2015 15:30:07 -0700 Subject: [python-win32] Resetting passwords Message-ID: As an aside to the recent discussion on storing passwords... Is there a way to (re)set Windows passwords using a pre-computed hash? I can use win32net.NetUserSetInfo() to reset a password, if I use the plain text of the password. My goal is to remotely set passwords on an arbitrary group of Windows computers, without storing the plain text of the passwords. If I store the hash values, the control system would be much less insecure than if I store the plain text. [Explanation: My goal is to add password-setting capability for Windows in saltstack . It can now be done only in Linux, BSD, and Solaris. Of course I would need to provide a different hash for Windows. If it worked only on recent version of Windows that would be okay. ] -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Jan 20 09:26:10 2015 From: timr at probo.com (Tim Roberts) Date: Tue, 20 Jan 2015 00:26:10 -0800 Subject: [python-win32] Storing Passwords. In-Reply-To: <54BD6E41.9020601@canterbury.ac.nz> References: <7FD2651A-A441-4723-8A7E-5BD303123FA1@probo.com> <54BCF837.3070004@comcast.net> <54BD6E41.9020601@canterbury.ac.nz> Message-ID: <715E455E-E9AE-496C-91A6-20BFA905446B@probo.com> On Jan 19, 2015, at 12:51 PM, Greg Ewing wrote: > > The same problem arises. If the program can get the password > out of the keyring, then so can any user who is capable of > running the program. ... > > Keyrings allow a user to keep his or her passwords secret > from *other* users. The OP seems to want to keep the *user* > of the password from being able to know it, which is > fundamentally impossible. Actually, I don?t think that?s correct. I think he is trying to remotely administer a number of systems, and he just wants to be able to do logins for remote administration without having to retype the authentication every time. It?s the kind of thing where a Linux user would use ssh with a key forwarding agent. I started to ?pooh pooh? the keyring suggestion as well, and as I was typing my reply I realized it was pretty much the right answer. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Tue Jan 20 09:32:50 2015 From: timr at probo.com (Tim Roberts) Date: Tue, 20 Jan 2015 00:32:50 -0800 Subject: [python-win32] Implementing an instance of an external/physical .dll file? In-Reply-To: References: <54BD583E.40802@probo.com> Message-ID: <68553335-9B77-4EE3-B608-699FF09B9EFA@probo.com> On Jan 19, 2015, at 1:20 PM, Jacob Kruger wrote: > > ----- Original Message ----- >> You can use the ctypes module to access virtually any arbitrary DLL. >> That's what they mean when they talk about an FFI library. There's a >> learning curve, but essentially anything is possible. > > Ok, both of the following code snippets execute without any errors/issues: > from ctypes import * > import os > #first one > uS = windll.LoadLibrary(os.path.realpath("UniversalSpeech.dll")) > > #second one > uSc = cdll.LoadLibrary(os.path.realpath("UniversalSpeech.dll")) > #end code > > But, issue then is that am really not sure how to then work with > functions/methods 'exposed' by the instance/DLL, since if look at some of > the ctypes tutorial material, it seems like you need to already know exactly > what the .dll offers, etc., to then set up/implement wrappers/pointers to > things like functions, etc.? Yes, of course you do. You can?t possibly expect to use a DLL without knowing how to use it. Unless someone has already done so, you will have to translate the C prototypes for all of the DLL?s exported functions into Python ctypes declarations (or, at least, the functions you need to use). > But, for example, when working with another alternative that has been > registered on system, and then using win32com.client, can just make function > calls, etc., but, think that one relates to that .dll having been run > through an effective regsvr32? Yes, for DLLs that are COM servers, the DLL (or its type library) contains enough information about the parameters and parameter types that the win32com module can automatically generate the Python code to convert between them. This DLL is not a COM server, so you have to do all of that by hand.. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Tue Jan 20 09:49:00 2015 From: timr at probo.com (Tim Roberts) Date: Tue, 20 Jan 2015 00:49:00 -0800 Subject: [python-win32] Resetting passwords In-Reply-To: References: Message-ID: <9D41AED5-8FC9-4E50-A19F-57B41CA271B2@probo.com> On Jan 19, 2015, at 2:30 PM, Vernon D. Cole wrote: > > Is there a way to (re)set Windows passwords using a pre-computed hash? > > I can use win32net.NetUserSetInfo() to reset a password, if I use the plain text of the password. My goal is to remotely set passwords on an arbitrary group of Windows computers, without storing the plain text of the passwords. If I store the hash values, the control system would be much less insecure than if I store the plain text. Not as far as I know. That API can only be used by an elevated application running as domain administrator or local administrator, which already implies a raised level of trust. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Wed Jan 21 05:09:09 2015 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 21 Jan 2015 15:09:09 +1100 Subject: [python-win32] Possible memory leak in pywin32 In-Reply-To: References: Message-ID: <54BF2665.1050103@gmail.com> It's certainly possible, but tracking a pywin32 leak down from such scant information is not really possible. If you can tweak your program to narrow down a leak we might have more luck - eg, add pointless loops that repeat the same operation a thousand times in various places, see how they change the leak behaviour, then rinse and repeat until you can see a significant leak from a single MAPI operation so repeated. Mark On 16/01/2015 9:43 PM, Kapil Dolas wrote: > Hi, > > I am using pywin32's mapi module to read data from PSTs. I have shared > my program which reads email and attachment datahere > (http://pastebin.com/2AXy3BVH). > Currently, program is not storing any of the read data. But, still I can > see gradual increase in memory usage when I run the program over large > PST. That PST contains around 9000 emails and it has 9 GB of data. Max > size of email is 24 MB only. For this PST, program's initial memory > usage is about 10 MB, but it gradually increases and reaches to 40-45 > MB. I don't know why this memory usage increases up to this value. I > have tried using pympler to find the root cause, but without any > success. It appears that memory increase is not due to python objects. > Can you point out the reason behind (gradual) increase in memory usage? > Is it due to the memory leak in pywin32, or any mistakes in my program? > > Regards, > Kapil Dolas > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > From nick at packetfrenzy.com Wed Jan 21 10:34:26 2015 From: nick at packetfrenzy.com (Nick Czeczulin) Date: Wed, 21 Jan 2015 01:34:26 -0800 Subject: [python-win32] Possible memory leak in pywin32 In-Reply-To: References: Message-ID: <54BF72A2.7040901@packetfrenzy.com> On 1/16/2015 2:43 AM, Kapil Dolas wrote: > I am using pywin32's mapi module to read data from PSTs. I have shared > my program which reads email and attachment datahere > (http://pastebin.com/2AXy3BVH). > Currently, program is not storing any of the read data. But, still I can > see gradual increase in memory usage when I run the program over large > PST. That PST contains around 9000 emails and it has 9 GB of data. Max > size of email is 24 MB only. For this PST, program's initial memory > usage is about 10 MB, but it gradually increases and reaches to 40-45 > MB. I don't know why this memory usage increases up to this value. I > have tried using pympler to find the root cause, but without any > success. It appears that memory increase is not due to python objects. > Can you point out the reason behind (gradual) increase in memory usage? > Is it due to the memory leak in pywin32, or any mistakes in my program? You can try these changes and see if it helps mitigate some of the bloat your are experiencing in the script you linked: 1. Only call MAPIInitialize() once on the main thread before you do any other mapi calls. Then call MAPIUninitialize() before exiting the process. It's been documented that the outlook mapi dll intentionally leaked the heap as a workaround in previous versions. If you are creating/destroying multiple instances of MAPIReadTest(), that may be contributing to some of the bloat you are seeing. 2. Instead of walking the folder hierarchy and opening/caching multiple folder entries, you can also try using GetHierarchyTable(mapi.CONVENIENT_DEPTH) instead to get the entry id's and process them in sequence. hth, -nick From 2281570025 at qq.com Thu Jan 22 09:10:14 2015 From: 2281570025 at qq.com (=?utf-8?B?aU1hdGg=?=) Date: Thu, 22 Jan 2015 16:10:14 +0800 Subject: [python-win32] not defined ?SPIF_UPDATEINIFILE, SPIF_SENDCHANGE, SPIF_SENDWININICHANGE Message-ID: it seems ?SPIF_UPDATEINIFILE, SPIF_SENDCHANGE, SPIF_SENDWININICHANGE not defined in Pywin32, what should do if I want to use this constant ? ?what the value of each ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jan 22 19:24:33 2015 From: timr at probo.com (Tim Roberts) Date: Thu, 22 Jan 2015 10:24:33 -0800 Subject: [python-win32] not defined ?SPIF_UPDATEINIFILE, SPIF_SENDCHANGE, SPIF_SENDWININICHANGE In-Reply-To: References: Message-ID: <54C14061.6050104@probo.com> iMath wrote: > it seems ?SPIF_UPDATEINIFILE, SPIF_SENDCHANGE, SPIF_SENDWININICHANGE > not defined in Pywin32, what should do if I want to use this constant? ? > what the value of each ? Of course they are defined, in the win32con module, where all good constants live. C:\tmp>python Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import win32con >>> win32con.SPIF_UPDATEINIFILE 1 >>> win32con.SPIF_SENDCHANGE 2 >>> -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc.