473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

winapi32.GetFileVersionInfo() - problem

I need to be able to programatically get the version info from a windows
DLL preferably in the same format as what is displayed in the properties
tab.

I was overjoyed to find Mark Hammond's Python Extensions
(http://starship.python.net/crew/mhammond/) The package includes a
little demo program "filevers.py" distributed in the win32api download
that does exactly what I need.

Unfortunately I get this error when I execute the script:

C:\work>getfilever.py
Traceback (most recent call last):
File "C:\work\getfilever.py", line 8, in ?
d=win32api.GetFileVersionInfo(fname, '\\')
pywintypes.error: (1812, 'GetFileVersionInfo:GetFileVersionInfoSize',
'The specified image file did not contain a resource section.')

Anybody know what this means, or more importantly, if there is a
work-around? "fname", in the code snippit above, contains the name of a
DLL compiled with MS Visual Studio .NET 2003.

Thanks,

Jul 18 '05 #1
2 4983
> <snip the fourth and hopefully last repost>

Do you actually think anybody will reply to your mail if you keep repostingat
this frequency? It'll rather make most people here kill-file you.

One post is enough; we've seen your problem, and it seems as though nobody
here has a better solution than what Dennis Lee Bieber has already offered.

Just to make sure you understand what he said, I'll repeat it here: Your DLL
doesn't contain a resources section, which in turn contains the version
information you're asking for. So, please start reading MSDN and the VC++
documentation on how to add this information to your DLL.

If you wish to catch the exception that's raised (because the resource block
isn't present), use something like the following:

try:
d = win32api.GetFileVersionInfo(fname,r"\")
except:
d = None

if d is None:
print "No version info in file!"
else:
<do something with the version info>

--
--- Heiko.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBCQ/zvf0bpgh6uVAMRAhDoAJ9q7KMdPZZWjSqE/TalM/rxfcBoggCeMz+q
k5kvMLFFiDUMYTQwk9VWDSo=
=yQI2
-----END PGP SIGNATURE-----

Jul 18 '05 #2
Dennis Lee Bieber wrote:
<heh> And the only reason I could state that so quickly was that
I've been tasked, at work, with creating a "configuration" report
reporting the version(s) [file/product] of a whole slew of DLLs (I'm
running a multi-level directory walk from subsystem roots).


Yes, answering this question certainly requires detailed knowledge of
Win32. Unfortunately/However/Factually this is really what the OP needs
to do now: go and understand Win32. Apparently, doesn't/didn't know
how Windows stores the version information. What is worse is that it
did not occur to him that his code (and the Python implementation behind
it, and the Microsoft API behind that) are all correct, and that the
problem really is in the file.

Regards,
Martin
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Fabster | last post by:
Below is a code part I got somewhere and works fine for retrieving a version from a single file. Now I want to retrieve all .dll, .ocx and ..exe file versions from my harddisk in all directory's. I...
1
by: xytho33 | last post by:
I need to be able to programatically get the version info from a windows DLL preferably in the same format as what is displayed in the properties tab. I was overjoyed to find Mark Hammond's...
2
by: xytho33 | last post by:
I need to be able to programatically get the version info from a windows DLL preferably in the same format as what is displayed in the properties tab. I was overjoyed to find Mark Hammond's...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
117
by: Peter Olcott | last post by:
www.halting-problem.com
18
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.