Hi Steve, qgis --version works as expected (tested in Linux). Can you test on Windows, please?
Regards, Jorge Gustavo On 27/03/20 04:29, Steve Malers wrote: > QGIS list: > > I have tried to find the answer for this and hope the user community > can help. I need a robust and consistent way to determine the QGIS > version on the command line that I can call from a bat file on Windows > (and similar on Linux), something like: qgis-bin.exe --version > > Background: I am developing a complex Python tool that uses PyQGIS > and PyQt and is distributed as a virtual environment (venv) created > using a specific version of QGIS Python, for example QGIS 3.10 > python37. The deployed environment requires that QGIS is installed > separately The run script modifies its PYTHONPATH to include packages > for PyQGIS and the application. The venv includes a text file that > indicates the QGIS version that the venv was built with and verifies > that a compatible QGIS is installed. The run script properly handles > the typical case where stand-alone QGIS is installed because it looks > at the file path, such as C:\Program Files\QGIS 3.10. If it finds a > match, then that version of QGIS is used in PYTHONPATH and the > application starts OK. > > The problem is that if someone has not installed a stand-alone QGIS > but has installed OSGeo464 version (C:\OSGeo4W64), there is no > indicator of QGIS version in the installation folder. I cannot find > documentation for qgis-bin.exe command line options and experiments > did not show support for --version or variants. I could scrape the > QGIS version from files somewhere in the distribution but looking into > the code it seems to get complicated due to handoff from Python to > C/C++ code. If I can determine the version I can check to make sure > that the OsGeo4W64 QGIS version matches that of the distributed venv. > Lacking this, the run script cannot do the check. Supporting > OSGeo4W64 is needed because some development and deployed environments > use it. My plan B is to write a simple Python program to access the > version from the Python side, making general assumptions to get > started, and then configure the main application startup. > > Any help would be appreciated. > > -- > Steve Malers > Chief Executive Officer and Chief Technology Officer > Open Water Foundation > openwaterfoundation.org <http://openwaterfoundation.org> > Support the Open Water Foundation by selecting on smile.amazon.com > <https://smile.amazon.com/ch/46-2676240> > Open data. Open software. Open decisions.... with positive social > impact. > > _______________________________________________ > Qgis-user mailing list > [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user -- Email Signature Logo <https://www.geomaster.pt> *Geomaster* *Jorge Gustavo Rocha* | Software Engineer *e:*[email protected] | *m:*+351 910 333 888 *g:*41.54094,-8.40490 | *v: *510 906 109 *a: * Rua António Cândido Pinto, 67, 4715-400 Braga
_______________________________________________ Qgis-user mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
