Re: [python-win32] Problem reading a shortcut (.lnk) with cPython 3.7 (32 bit)

2019-06-19 Thread David Hughes


On 18/06/2019 22:38, Tim Roberts wrote:

David Hughes wrote:


I'm in the process of upgrading my software from Python 2.7 to 3.7 
now that wxPython has been migrated to 3. As part of a procedure for 
upgrading an end user's own installation I check for it's location 
via the desktop shortcut that Innosetup created during the original 
installation.


That's not a particularly good method in the general case.  I don't 
find much use for the desktop icon, so I suppress it.  You might be 
better served to use the registry, in 
HKEY_LOCAL_MACHINE\Software\Python\PythonCore.  32-bit installations 
will be in HKEY_LOCAL_MACHINE\Software\WOW6432Node\Python\PythonCore 
(if you're reading from a 64-bit app).


My apologies, I should have made it clear the shortcut is to the 
stand-alone executable (py2exe/PyInstaller) version of my own software.


I have a procedure for doing this that worked/works fine with Python 
2.7 that is very similar to the one published in 
/http://timgolden.me.uk/python/win32_how_do_i/read-a-shortcut.html/. 
Neither mine nor Tim's works under Python 3.7 (I haven't checked any 
other version of 3). With Tim's version, when the line


    name, _ = link.GetPath (shell.SLGP_UNCPRIORITY)

is executed, after a delay it responds with /aborted (disconnected)/ 
and the program terminates, as does mine.


Is it possible you have installed a 32-bit Python on a 64-bit system?  
Theoretically, you should be able to use CLSID_ShellLink from either 
one, but I'm trying to narrow things down.  Tim's code works fine for 
me with Python 3.7.2 (64 bit) on Windows 10. 


The problem first arose in a 32 bit Python installed on a 64 bit Windows 
10 but the same error also occurs with 64 bit Python. However, both of 
these are virtual environments installed using venv. When I tried Tim's 
program using the original system-installed Pythons both the 32 and 64 
bit versions of 3.7 work fine.


Aha! To make the system-installed Pythons work I had to pip install 
pywin32 and this installed version 224. Both the virtual environments 
contained pywin32 version 223. After upgrading to version 224 both now 
work! :))


--
Regards

David Hughes
Forestfield Software

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Problem reading a shortcut (.lnk) with cPython 3.7 (32 bit)

2019-06-18 Thread David Hughes
I'm in the process of upgrading my software from Python 2.7 to 3.7 now 
that wxPython has been migrated to 3. As part of a procedure for 
upgrading an end user's own installation I check for it's location via 
the desktop shortcut that Innosetup created during the original 
installation.


I have a procedure for doing this that worked/works fine with Python 2.7 
that is very similar to the one published in 
/http://timgolden.me.uk/python/win32_how_do_i/read-a-shortcut.html/. 
Neither mine nor Tim's works under Python 3.7 (I haven't checked any 
other version of 3). With Tim's version, when the line


name, _ = link.GetPath (shell.SLGP_UNCPRIORITY)

is executed, after a delay it responds with /aborted (disconnected)/ and 
the program terminates, as does mine.


My knowledge of Python - Win32 interaction is extremely limited so 
anything anyone can tell me about this would be valuable.


--
Regards

David Hughes
Forestfield Software

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] com_error in win32com/client.Moniker (2)

2012-12-06 Thread David Hughes

Tim Golden wrote*
*

I had  someone with a very similar error contact me recently. (I'm the
author of the wmi module). In that case it turned out to be a borked
Windows configuration. Can you access WMI on that machine by, eg, VBS or
Powershell -- ie something built-in?


This probably won't thread properly as I wasn't subscribed when Tim 
wrote the above, and I had to visit the archive.


I have sent the customer a small VBS script I used when I was developing 
the Python WMI version and am awaiting a reply.  I have also found the 
following resources which seem relevant:


http://stackoverflow.com/questions/7078184/unable-to-get-wmi-object-via-getobjectwinmgmts?rq=1

which offers some possible reset/repair options and also leads to the 
Microsoft WMI Diagnosis Utility


http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=7684

--
Regards

David Hughes
Forestfield Software


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] com_error in win32com/client.Moniker

2012-12-05 Thread David Hughes
Originally posted in py2exe-us...@lists.sourceforge.net but re-posted 
here at the suggestion of Mark Hammond:


A customer running my software, distributed via py2exe (Python 2.7.2) is
consistently getting the following error

 Mon Dec 03 13:20:25 2012 
Traceback (most recent call last):
   File "__main__.py", line 838, in 
   File "__main__.py", line 331, in bootstrap
   File "__main__.py", line 358, in chainload
   File "__main__.py", line 834, in _chainload
   File "dietplan6.py", line 342, in 
   File "dietplan6.py", line 332, in main
   File "wx\_core.pyc", line 8631, in __init__
   File "wx\_core.pyc", line 8196, in _BootstrapApp
   File "dietplan6.py", line 171, in OnInit
   File "licence_installed.pyc", line 28, in CheckLicence
   File "licence_installed.pyc", line 105, in InstallLicence
   File "licence_installed.pyc", line 252, in openmasterlicence
   File "licence.pyc", line 314, in IsMasterValid
   File "library\oslib.pyc", line 192, in get_vol_info
   File "wmi.pyc", line 157, in 
   File "win32com\client\__init__.pyc", line 72, in GetObject
   File "win32com\client\__init__.pyc", line 87, in Moniker
com_error: (-2147024770, 'The specified module could not be found.',
None, None)

oslib.pyc", line 192, in get_vol_info contains

from wmi import WMI as WMI

prior to obtaining the details of an attached USB flash drive.

It has been confirmed the error is specific to that particular machine
(running 32 bit Windows 7, I believe). Has anyone come across this problem or 
have any suggestions
please as to probable cause and, of course, solution?


--
Regards

David Hughes
Forestfield Software


___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32