From timr at probo.com Sat Oct 1 01:52:34 2016 From: timr at probo.com (Tim Roberts) Date: Fri, 30 Sep 2016 22:52:34 -0700 Subject: [python-win32] win32com.client: Struggling with dynamic dispatch, behavior differs when debugging In-Reply-To: References: Message-ID: On Sep 30, 2016, at 1:01 AM, Dominik Heller wrote: > >> That's odd. Is your application compiled with -DUNICODE? BSTR is >> always Unicode, but LPCTSTR depends on the compiled character set. I >> would expect it to be LPCWSTR. However, if it works for >> "obj_2.SubObject.DoSomething", then that's not a problem. > > It's compiled with /D "_MBCS" so it should indeed be a wide string. You have that backwards. _MBCS means ANSI. With _MBCS, LPCTSTR == LPCSTR, or "char *". Wide means -D_UNICODE. > But even completely without strings, simple methods won't work on obj_1, > e.g. something like double CosD(double degrees), but will work on SubObj, > e.g. double GetValue(long index). > Long story short, it seems the only thing I can get to work on obj_1 are > methods without any arguments. On SubObj, most things seem to work except > for call-by-ref parameters. I'm afraid I am out of ideas. If the object methods have identical signatures, they should behave identically. > Is there any way to explicitly tell the Python wrapper about the interface > to use without using makeup? It gets all of that through the dispatch interface. If the two functions advertise the same dispatch information, then Python should call them identically. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From francoi.xa1 at gmail.com Thu Oct 6 07:36:26 2016 From: francoi.xa1 at gmail.com (Francoi Xavier) Date: Thu, 6 Oct 2016 17:06:26 +0530 Subject: [python-win32] How can I restrict users from changing ACE? Message-ID: I've just started learning about windows ACL and file permissions. The task here is to make a file/folder read-only and should get deleted/modified only through our client software. I've denied Write, Delete and other permissions for the Lookup Name Everyone which *generally* restricted users from changing the files/folders. But the current user who also happens to be the creator/owner of the file/folder can delete the ACE which has been added and he can gain complete access rights. Is there a way to restrict this behaviour so that users cannot change the file access permissions? Thanks, Francoi -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Oct 6 11:39:09 2016 From: timr at probo.com (Tim Roberts) Date: Thu, 6 Oct 2016 08:39:09 -0700 Subject: [python-win32] How can I restrict users from changing ACE? In-Reply-To: References: Message-ID: Francoi Xavier wrote: > > I've just started learning about windows ACL and file permissions. You have embarked on a twisted, complicated, and vine-encrusted path. Few things in the computing world are as convoluted as the Windows security model. > The task here is to make a file/folder read-only and should get > deleted/modified only through our client software. I've denied Write, > Delete and other permissions for the Lookup Name Everyone > which *generally* restricted users from changing the files/folders. > > But the current user who also happens to be the creator/owner of the > file/folder can delete the ACE which has been added and he can gain > complete access rights. Is there a way to restrict this behaviour so > that users cannot change the file access permissions? That depends on your definition of "user". A user with administrative rights can always elevate himself to take ownership of a file or folder. Once he has ownership, he can modify the permissions. Windows handles this by changing the owner. All of the Windows files and directories are owned by a special user called "TrustedInstaller". Regular users have read permission, but not write or control permission. However, it's still possible to become administrator and change the owner. That's the whole point of an administrative user -- you have control. You can certainly emulate that behavior, by creating a special user just for your software, and changing the file's owner to that user. Whether that's justified in your case is a judgment you'll have to make. Your budget for protection needs to be based on the likelihood of an attack and the cost of a compromise. There is NOTHING you can do that is fail-safe. Remember, Sony went so far as to install a file system filter driver to hide their DRM-related driver files. Even that protection wasn't foolproof. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From eryksun at gmail.com Thu Oct 6 12:01:06 2016 From: eryksun at gmail.com (eryk sun) Date: Thu, 6 Oct 2016 16:01:06 +0000 Subject: [python-win32] How can I restrict users from changing ACE? In-Reply-To: References: Message-ID: On Thu, Oct 6, 2016 at 11:36 AM, Francoi Xavier wrote: > I've just started learning about windows ACL and file permissions. The task > here is to make a file/folder read-only and should get deleted/modified only > through our client software. I've denied Write, Delete and other permissions > for the Lookup Name Everyone which generally restricted users from changing > the files/folders. Don't forget to also deny FILE_DELETE_CHILD access on the directory. Otherwise a user with that right can delete files even when the DACL otherwise denies delete access. > But the current user who also happens to be the creator/owner of the > file/folder can delete the ACE which has been added and he can gain complete > access rights. Is there a way to restrict this behaviour so that users > cannot change the file access permissions? In Vista and later (NT 6+) you can deny WRITE_DAC access to the "OWNER RIGHTS" security principal. The owner of the object won't be able to modify the permissions. From marcus at marcusv.org Wed Oct 19 08:43:39 2016 From: marcus at marcusv.org (Marcus Valentine) Date: Wed, 19 Oct 2016 13:43:39 +0100 Subject: [python-win32] Using win32com.client.GetActiveObject to attach to a specific running Excel application Message-ID: I have a question related to "Attach to a running instance of a COM application" at http://timgolden.me.uk/python/win32_how_do_i/attach-to-a-com-instance.html In my application, I end up with several instances of Excel open, for example, inspecting the Running Object Table as described at http://timgolden.me.uk/python/win32_how_do_i/see-if-an-excel-workbook-is-open.html I can see 12:39:09 PM - INFO - ROT: Found my_results2 12:39:09 PM - INFO - ROT: Found my_results3 12:39:09 PM - INFO - ROT: Found my_results1 When I do xl = win32com.client.GetActiveObject ("Excel.Application") Is there a way of selecting which one of found Excel applications I attach to (the one with the highest number, which was created most recently)? Thanks Marcus Valentine From maxslimmer at gmail.com Sun Oct 23 00:42:29 2016 From: maxslimmer at gmail.com (Max Slimmer III) Date: Sat, 22 Oct 2016 21:42:29 -0700 Subject: [python-win32] adodbapi changing autocommit Message-ID: Setting connection.autocommit = False does not cause a connection.connector.BeginTrans() and so any subsequent connection.commit() raises an exception that there is no open transaction. Is this by design and I'm supposed to explicitly call BeginTrans() when switching autocommit off? Thanks, Max From timr at probo.com Sun Oct 23 17:59:27 2016 From: timr at probo.com (Tim Roberts) Date: Sun, 23 Oct 2016 14:59:27 -0700 Subject: [python-win32] adodbapi changing autocommit In-Reply-To: References: Message-ID: On Oct 22, 2016, at 9:42 PM, Max Slimmer III wrote: > > Setting connection.autocommit = False does not cause a > connection.connector.BeginTrans() and so any subsequent > connection.commit() raises an exception that there is no open > transaction. Is this by design and I'm supposed to explicitly call > BeginTrans() when switching autocommit off? Yes, that's exactly the tradeoff. If you have auto commit on, ADO will wrap each operation in a transaction. If you have auto commit off, then you have to insert the transaction markers yourself. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From maxslimmer at gmail.com Mon Oct 24 12:16:35 2016 From: maxslimmer at gmail.com (Max Slimmer) Date: Mon, 24 Oct 2016 09:16:35 -0700 Subject: [python-win32] python-win32 Digest, Vol 163, Issue 6 In-Reply-To: References: Message-ID: The adodbapi documentation and code implies that with autocommit = False I should only have to call commit (and possibly rollback) and if using the connection as a context manager not even those are required. If autocommit = False is passed on the initial connect the __init__ of the connector handles BeginTrans and subsequent commit and rollbacks also leave me with an open trans. But if I do this: conn = adodbapi.connect(conn_args, autocommit=True) conn.autocommit = False with conn: cur = conn.cursor() cur.execute("insert into table1 (col1) values (?)", ('row5', )) print 'inserted a row' I get an exception that there is not an existing transaction to commit. I created a quick subclass of the Connect class that handles the __setattr__ for 'autocommit' by calling self.BeginTrans() if autocommit = False class MyConnection(adodbapi.Connection): """""" def __setattr__(self, name, value): super(self.__class__, self).__setattr__(name, value) if name == 'autocommit': if (not self._autocommit and self.supportsTransactions and self.transaction_level == 0): self.transaction_level = self.connector.BeginTrans() But of course I also had to re-implement the adodbapi.connect to use my Connection class (is there a better way?). I think what I'm getting at is that allowing the caller to change the autocommit attribute to False on the instance but not beginning a trans (as would happen if the autocommit = False was passed in connect()) seems inconsistent. On Mon, Oct 24, 2016 at 9: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. Re: adodbapi changing autocommit (Tim Roberts) > > > ---------- Forwarded message ---------- > From: Tim Roberts > To: "python-win32 at python.org" > Cc: > Date: Sun, 23 Oct 2016 14:59:27 -0700 > Subject: Re: [python-win32] adodbapi changing autocommit > On Oct 22, 2016, at 9:42 PM, Max Slimmer III wrote: > > > > Setting connection.autocommit = False does not cause a > > connection.connector.BeginTrans() and so any subsequent > > connection.commit() raises an exception that there is no open > > transaction. Is this by design and I'm supposed to explicitly call > > BeginTrans() when switching autocommit off? > > Yes, that's exactly the tradeoff. If you have auto commit on, ADO will > wrap each operation in a transaction. If you have auto commit off, then > you have to insert the transaction markers yourself. > ? > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -- --Max III -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Oct 24 13:10:23 2016 From: timr at probo.com (Tim Roberts) Date: Mon, 24 Oct 2016 10:10:23 -0700 Subject: [python-win32] adodbapi changing autocommit In-Reply-To: References: Message-ID: <1eab87dd-a618-9aa8-e814-2c6f13a7ca48@probo.com> Max Slimmer wrote: > The adodbapi documentation and code implies that with autocommit = > False I should only have to call commit (and possibly rollback) and if > using the connection as a context manager not even those are required. > If autocommit = False is passed on the initial connect the __init__ of > the connector handles BeginTrans and subsequent commit and rollbacks > also leave me with an open trans. Ah, I missed that subtle distinction. Your modification seems reasonable. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From vernondcole at gmail.com Mon Oct 24 17:57:41 2016 From: vernondcole at gmail.com (Vernon D. Cole) Date: Mon, 24 Oct 2016 15:57:41 -0600 Subject: [python-win32] adodbapi changing autocommit In-Reply-To: <1eab87dd-a618-9aa8-e814-2c6f13a7ca48@probo.com> References: <1eab87dd-a618-9aa8-e814-2c6f13a7ca48@probo.com> Message-ID: Wait a bit... Did I just hear that there is a difference in operation between starting a connection with autocommit=false and turning autocommit off during a session? If so, I think that's a bug. PEP-249 has no hook for explicitly starting a transaction, so adodbapi needs to always have done BeginTrans before any meaningful operation. Am I missing something? -- Vernon Cole On Mon, Oct 24, 2016 at 11:10 AM, Tim Roberts wrote: > Max Slimmer wrote: > > The adodbapi documentation and code implies that with autocommit = > > False I should only have to call commit (and possibly rollback) and if > > using the connection as a context manager not even those are required. > > If autocommit = False is passed on the initial connect the __init__ of > > the connector handles BeginTrans and subsequent commit and rollbacks > > also leave me with an open trans. > > Ah, I missed that subtle distinction. Your modification seems reasonable. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > 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 maxslimmer at gmail.com Tue Oct 25 16:53:45 2016 From: maxslimmer at gmail.com (Max Slimmer) Date: Tue, 25 Oct 2016 13:53:45 -0700 Subject: [python-win32] adodbapi changing autocommit In-Reply-To: References: <1eab87dd-a618-9aa8-e814-2c6f13a7ca48@probo.com> Message-ID: Vernon, Yes, that is what I'm saying, I just didn't want to come out shouting "bug". I tried setting up the package test at one point but got stuck somewhere so I'm not sure I'm the person to file the PR (or whatever the process is). But, I'd be happy to file it using whatever the appropriate procedure is (if where we're at isn't enough :)). On Mon, Oct 24, 2016 at 2:57 PM, Vernon D. Cole wrote: > Wait a bit... Did I just hear that there is a difference in operation > between starting a connection with autocommit=false and turning autocommit > off during a session? If so, I think that's a bug. PEP-249 has no hook > for explicitly starting a transaction, so adodbapi needs to always have > done BeginTrans before any meaningful operation. Am I missing something? > -- > Vernon Cole > > > On Mon, Oct 24, 2016 at 11:10 AM, Tim Roberts wrote: > >> Max Slimmer wrote: >> > The adodbapi documentation and code implies that with autocommit = >> > False I should only have to call commit (and possibly rollback) and if >> > using the connection as a context manager not even those are required. >> > If autocommit = False is passed on the initial connect the __init__ of >> > the connector handles BeginTrans and subsequent commit and rollbacks >> > also leave me with an open trans. >> >> Ah, I missed that subtle distinction. Your modification seems reasonable. >> >> -- >> Tim Roberts, timr at probo.com >> Providenza & Boekelheide, Inc. >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > > -- --Max III -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue Oct 25 18:03:59 2016 From: vernondcole at gmail.com (Vernon D. Cole) Date: Tue, 25 Oct 2016 16:03:59 -0600 Subject: [python-win32] adodbapi changing autocommit In-Reply-To: References: <1eab87dd-a618-9aa8-e814-2c6f13a7ca48@probo.com> Message-ID: Please file a bug report at https://sourceforge.net/p/adodbapi/bugs/ . I will rebuild my test environment which has gradually evaporated over time. Make sure to specify which database engine were you running to find the bug. On Tue, Oct 25, 2016 at 2:53 PM, Max Slimmer wrote: > Vernon, > Yes, that is what I'm saying, I just didn't want to come out shouting > "bug". I tried setting up the package test at one point but got stuck > somewhere so I'm not sure I'm the person to file the PR (or whatever the > process is). But, I'd be happy to file it using whatever the appropriate > procedure is (if where we're at isn't enough :)). > > On Mon, Oct 24, 2016 at 2:57 PM, Vernon D. Cole > wrote: > >> Wait a bit... Did I just hear that there is a difference in operation >> between starting a connection with autocommit=false and turning autocommit >> off during a session? If so, I think that's a bug. PEP-249 has no hook >> for explicitly starting a transaction, so adodbapi needs to always have >> done BeginTrans before any meaningful operation. Am I missing something? >> -- >> Vernon Cole >> >> >> On Mon, Oct 24, 2016 at 11:10 AM, Tim Roberts wrote: >> >>> Max Slimmer wrote: >>> > The adodbapi documentation and code implies that with autocommit = >>> > False I should only have to call commit (and possibly rollback) and if >>> > using the connection as a context manager not even those are required. >>> > If autocommit = False is passed on the initial connect the __init__ of >>> > the connector handles BeginTrans and subsequent commit and rollbacks >>> > also leave me with an open trans. >>> >>> Ah, I missed that subtle distinction. Your modification seems >>> reasonable. >>> >>> -- >>> Tim Roberts, timr at probo.com >>> Providenza & Boekelheide, Inc. >>> >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> https://mail.python.org/mailman/listinfo/python-win32 >>> >> >> > > > -- > --Max III > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hartmut.niemann at siemens.com Thu Oct 27 10:45:42 2016 From: hartmut.niemann at siemens.com (Niemann, Hartmut) Date: Thu, 27 Oct 2016 14:45:42 +0000 Subject: [python-win32] pywin32 und pypiwin32: what is the difference? Message-ID: <1AE3002F400CE4498072DFDF74A843CC1F557509@DEFTHW99EH3MSX.ww902.siemens.net> Hello! When looking at an upgrade of pyinstaller, I came across this sentence: "ForWindows, PyWin32 or the more recent pypiwin32, is a prerequisite" What is the difference between these two? I find pypiwin at https://pypi.python.org/pypi/pypiwin32 where I find build 219 dating around New year 2015 giving http://sourceforge.net/projects/pywin32/ as the home page of the project, where I find https://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/ from spring 2014. What should I use? Mit freundlichen Gr??en Dr. Hartmut Niemann Siemens AG MO MLT LM EN CCI 1 Werner-von-Siemens-Str. 67 91052 Erlangen, Deutschland Mobil: +49 173 5342327 mailto:hartmut.niemann at siemens.com www.siemens.com/ingenuityforlife [www.siemens.com/ingenuityforlife] Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; Vorstand: Joe Kaeser, Vorsitzender; Roland Busch, Lisa Davis, Klaus Helmrich, Janina Kugel, Siegfried Russwurm, Ralf P. Thomas; Sitz der Gesellschaft: Berlin und M?nchen, Deutschland; Registergericht: Berlin Charlottenburg, HRB 12300, M?nchen, HRB 6684; WEEE-Reg.-Nr. DE 23691322 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 3536 bytes Desc: image001.gif URL: From tritium-list at sdamon.com Thu Oct 27 15:06:01 2016 From: tritium-list at sdamon.com (tritium-list at sdamon.com) Date: Thu, 27 Oct 2016 15:06:01 -0400 Subject: [python-win32] pywin32 und pypiwin32: what is the difference? In-Reply-To: <1AE3002F400CE4498072DFDF74A843CC1F557509@DEFTHW99EH3MSX.ww902.siemens.net> References: <1AE3002F400CE4498072DFDF74A843CC1F557509@DEFTHW99EH3MSX.ww902.siemens.net> Message-ID: <0d0e01d23085$290c9600$7b25c200$@hotmail.com> Pypiwin32 is a repackaging of pywin32 to use sane packaging tools (namely wheels). Its repackaged by the BDFL of the Twisted project. If you use pip, or virtualenvs (and you should be using pip and virtualenvs, if you are not, start), use pypiwin32. From: python-win32 [mailto:python-win32-bounces+tritium-list=sdamon.com at python.org] On Behalf Of Niemann, Hartmut Sent: Thursday, October 27, 2016 10:46 AM To: python-win32 at python.org Subject: [python-win32] pywin32 und pypiwin32: what is the difference? Hello! When looking at an upgrade of pyinstaller, I came across this sentence: ?ForWindows, PyWin32 or the more recent pypiwin32, is a prerequisite? What is the difference between these two? I find pypiwin at https://pypi.python.org/pypi/pypiwin32 where I find build 219 dating around New year 2015 giving http://sourceforge.net/projects/pywin32/ as the home page of the project, where I find https://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/ from spring 2014. What should I use? Mit freundlichen Gr??en Dr. Hartmut Niemann Siemens AG MO MLT LM EN CCI 1 Werner-von-Siemens-Str. 67 91052 Erlangen, Deutschland Mobil: +49 173 5342327 mailto:hartmut.niemann at siemens.com www.siemens.com/ingenuityforlife Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; Vorstand: Joe Kaeser, Vorsitzender; Roland Busch, Lisa Davis, Klaus Helmrich, Janina Kugel, Siegfried Russwurm, Ralf P. Thomas; Sitz der Gesellschaft: Berlin und M?nchen, Deutschland; Registergericht: Berlin Charlottenburg, HRB 12300, M?nchen, HRB 6684; WEEE-Reg.-Nr. DE 23691322 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 3536 bytes Desc: not available URL: