Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106391 > unrolled thread

PyQt4

Started byMuhammad Ali <muhammadaliaskari@gmail.com>
First post2016-04-03 11:57 -0700
Last post2016-04-03 22:32 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  PyQt4 Muhammad Ali <muhammadaliaskari@gmail.com> - 2016-04-03 11:57 -0700
    Re: PyQt4 Michael Torrie <torriem@gmail.com> - 2016-04-03 13:14 -0600
      Re: PyQt4 Muhammad Ali <muhammadaliaskari@gmail.com> - 2016-04-03 12:36 -0700
        Re: PyQt4 Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2016-04-03 22:32 +0200

#106391 — PyQt4

FromMuhammad Ali <muhammadaliaskari@gmail.com>
Date2016-04-03 11:57 -0700
SubjectPyQt4
Message-ID<b9ad8b64-b6a9-49df-8085-2d7afd2a406f@googlegroups.com>
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.

Thank you.

[toc] | [next] | [standalone]


#106393

FromMichael Torrie <torriem@gmail.com>
Date2016-04-03 13:14 -0600
Message-ID<mailman.407.1459710890.28225.python-list@python.org>
In reply to#106391
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.

[toc] | [prev] | [next] | [standalone]


#106396

FromMuhammad Ali <muhammadaliaskari@gmail.com>
Date2016-04-03 12:36 -0700
Message-ID<eba7a2e7-b6d3-404d-a045-9a051e6741d2@googlegroups.com>
In reply to#106393
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???

[toc] | [prev] | [next] | [standalone]


#106407

FromVincent Vande Vyvre <vincent.vande.vyvre@telenet.be>
Date2016-04-03 22:32 +0200
Message-ID<mailman.413.1459715557.28225.python-list@python.org>
In reply to#106396
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web