Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Vincent Vande Vyvre Newsgroups: comp.lang.python Subject: Re: PyQt4 Date: Sun, 3 Apr 2016 22:32:15 +0200 Lines: 36 Message-ID: References: Reply-To: vincent.vandevyvre@oqapy.eu Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de /Fh8gCnqS6SfgIL+YtMH9wXg9zJC3nNtPuqkVTbNf1Xg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'ideally': 0.04; 'binary': 0.05; 'error:': 0.05; 'importerror:': 0.05; 'installed.': 0.05; 'suggestions.': 0.09; 'python': 0.10; 'suggest': 0.15; '12:57': 0.16; '2016': 0.16; '21:36,': 0.16; 'from:name:vincent vande vyvre': 0.16; 'michael.': 0.16; 'received:195.130': 0.16; 'received:195.130.137': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'received:telenet-ops.be': 0.16; '\xe9crit': 0.16; 'wrote:': 0.16; 'try:': 0.18; '>>>': 0.20; 'machine': 0.21; 'tried': 0.24; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'install': 0.25; 'header:User-Agent:1': 0.26; 'example': 0.26; 'installed': 0.26; 'linux': 0.26; 'not.': 0.27; 'specify': 0.27; 'installed,': 0.29; 'matplotlib': 0.29; 'code': 0.30; 'received:be': 0.30; 'michael': 0.33; 'machine.': 0.33; 'file': 0.34; 'except': 0.34; 'skip:d 20': 0.34; 'attempt': 0.35; 'something': 0.35; 'expected': 0.35; 'but': 0.36; 'depends': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thank': 0.38; 'hi,': 0.38; 'end': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'confirm': 0.62; 'charset:windows-1252': 0.62; 'managers': 0.63; 'header:Reply- To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'actually,': 0.84; 'utc-7,': 0.84; 'rpm': 0.91; 'technique': 0.93; 'ali': 0.95 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:106407 Le 03/04/2016 21:36, Muhammad Ali a écrit : > On Sunday, April 3, 2016 at 12:15:06 PM UTC-7, Michael Torrie wrote: >> On 04/03/2016 12:57 PM, Muhammad Ali wrote: >>> Hi, >>> >>> How can we confirm that either PyQt4 is already installed on LInux machine or not? >>> >>> Please suggest commands to confirm the already existence of PyQt4 in the machine. >> Ideally you make a distribution-specific package of the binary in a .deb >> on Debian or an RPM on other distros, and specify that it depends on the >> package that provides PyQt4. That way when it's installed, modern >> package managers will automatically install the dependencies. >> >> Alternatively you can use try and except in your python code to attempt >> to import something from PyQt4 and see if it fails or not. This >> technique is also used to make your code work either PyQt4 or PySide, >> depending on which the user has installed. >> >> try: >> from PySide import QtGui >> except ImportError: >> from PyQt4 import QtGui >> >> If neither are installed, this little example will end with an ImportError. > Thank you for your suggestions. I tried both but it shows the following error: > IndentationError: expected an indented block > > Actually, I have to plot some graphs by using matplotlib and PyQt4 at supercomputer. > > Any other suggestion??? There's no IndentationError in the exemple provided by Michael. Copy the code AS IT in a file and retry. Vincent