Hi Chaks,

On 02.02.2012 13:28, chakravarthi mohan wrote:

Hi,

May be I have found-out the reason for not loading pyqt4 module.
In my environment , we have installed each of the python interpreter and various python modules in different paths using "prefix".

And we have used environment variable "PYTHONPATH" to use various python modules at runtime.
This soultion works well in the console or command-line mode , but in the case of freecad GUI , it is looking for all python modules under "python" interpreter's lib directory ( This I confirmed by launching "strace <FREECAD GUI>" and it was trying to load PyQt4 from the python interpreter's lib path, obviouly pyqt4 was not presetn there). In case of Freecad GUI , it not reading the environment variable PYTHONPATH and hence pyqt4 is not getting loaded (I belive so).
In FreeCAD we clear the PYTHONPATH variable at startup because this way it can happen that various modules are loaded that link to a different python runtime version and thus leads to unexpected crashes.

So, the best way is to add the path to PyQt4 to sys.path.

So now for PyQt4 is loaded successfully.

Thanks all for providing initial imputs.

Thankyou!

Regards,
Chaks

Cheers,
Werner


From: chaks11@hotmail.com
To: werner.wm.mayer@gmx.de; free-cad-development@lists.sourceforge.net
Date: Thu, 2 Feb 2012 14:32:24 +0530
Subject: Re: [Free-cad-development] Using Freecad with PyQt4 on Linux

Hi Werner,Yorik,Development team,

I  tried with your suggestion about sip module.

I am getting following message during Freecad GUI launch:
"

During initialization the error No module named PyQt4 occurred in ../Mod/Draft/InitGui.py

No module named PyQt4

"


With the below versions of python,pyqt and sip , in the console mode I able to import PyQt4 and QtGui,QtCore modules.

python --version 2.6.7
pyqt --version 4.7.4
sip --version 4.10.5

If I use any other versions of pyqt or sip  , I am getting following message on the console mode.
from PyQt4 import QtGui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: the sip module implements API v7.0 to v7.1 but the PyQt4.QtGui module requires API v8.1

So based on the above analysis on console mode it works well i.e. following code throws no error message.

"

from PyQt4 import QtCore, QtGui

"

But in GUI mode , I get following error message:
"

During initialization the error No module named PyQt4 occurred in ../Mod/Draft/InitGui.py

No module named PyQt4

"

From the source code:
try:
import PyQt4
except ImportError:
FreeCAD.Console.PrintWarning("Error: PyQt4 not found, Draft workbench will be disabled.\n")
else:
depsOK = True


But I am not getting above warning/error message.
Please let me know , how do I find the source of the problem and find a possible solution.
Thanks for your help.


Thanks and Regards,

Chaks



Date: Wed, 1 Feb 2012 19:30:42 +0100
From: werner.wm.mayer@gmx.de
To: free-cad-development@lists.sourceforge.net
Subject: Re: [Free-cad-development] Using Freecad with PyQt4 on Linux

Message body Hi Chaks,

On 01.02.2012 17:59, chakravarthi mohan wrote:
Dear Freecad development Team,

I am trying to use the following freecad tar ball to make it compile on Linux 64bit systems.
freecad-0.12.5284.tar.gz

But for some reason , I am unable to make it work with PyQt4 package enabled.

i.e. after compilation(Complied using gcc 4.1.2) and installation during GUI execution I get following message and many functionalities are not getting enabled of FreeGUI.
"No Module named PyQt4"
So, I assume the compilation of the whole source code was successful. The reason that you can't use PyQt4 has basically nothing to do with FreeCAD but with your python setup.

If you open a terminal window and start a python session just try this:
from PyQt4 import QtCore, QtGui

Have a look to the error messages. It could be that you lack of the "sip" module or that the path to the PyQt4 modules is not listed in sys.path.

Hope this helps!

Cheers,
Werner
 

I am using:
python version => 2.6.7
QT version => 4.6.3
And I have pyqt versiom=>4.7.4 and 4.9

If there is any known solution kindly let me know.

If this e-mail group doesn't handle this kind of request , kindly redirect to correct mailing list.

Thankyou for your help.

Thanks & Kind Regards,
Chaks
------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________ Free-cad-development mailing list Free-cad-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/free-cad-development


------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________ Free-cad-development mailing list Free-cad-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/free-cad-development

------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________ Free-cad-development mailing list Free-cad-development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/free-cad-development