Personal tools
You are here: Home Forum Other... (new forum, problems, etc.) Import salome is doing unexpected things

Import salome is doing unexpected things

Up to Other... (new forum, problems, etc.)

Import salome is doing unexpected things

Posted by Lorenzo Audibert at February 19. 2014

Hello,

 

I wanted to use package such as numpy with Salome. Salome was not able to import those package from my local python installation (C:\Python27).

Thus I installed those package in the python of salome ( C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\Lib\site-packages).

I verify that this python was able to import the package (numpy) and that they work!

 

I then launched Salome. From the python console embeded in Salome "import numpy" did not work. It seems that the import_hook.py was messing the process. (the current error message is at the end of this post

 

PS: In the process I was forced to uninstall my personnal python because even Salome was launched using python from the Salome directory. The python console embeded was from my personnal python. You may want to correct something to avoid this confusion between the different version of python!

 

Traceback (most recent call last):

File "<input>", line 1, in <module>

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\lib\site-packages\numpy-1.8.0-py2.7-win32.egg\numpy\__init__.py", line 168, in <module>

from . import add_newdocs

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\lib\site-packages\numpy-1.8.0-py2.7-win32.egg\numpy\add_newdocs.py", line 13, in <module>

from numpy.lib import add_newdoc

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\lib\site-packages\numpy-1.8.0-py2.7-win32.egg\numpy\lib\__init__.py", line 8, in <module>

from .type_check import *

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\lib\site-packages\numpy-1.8.0-py2.7-win32.egg\numpy\lib\type_check.py", line 11, in <module>

import numpy.core.numeric as _nx

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\lib\site-packages\numpy-1.8.0-py2.7-win32.egg\numpy\core\__init__.py", line 46, in <module>

from numpy.testing import Tester

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\lib\site-packages\numpy-1.8.0-py2.7-win32.egg\numpy\testing\__init__.py", line 10, in <module>

from unittest import TestCase

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\Lib\unittest\__init__.py", line 58, in <module>

from .result import TestResult

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\MODULES\KERNEL\lib\python2.7\site-packages\salome\import_hook.py", line 175, in import_hook

module= original_import(name, globals, locals, fromlist, *args, **kwds)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\Lib\unittest\result.py", line 26, in <module>

class TestResult(object):

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\Lib\unittest\result.py", line 111, in TestResult

@failfast

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\Lib\unittest\result.py", line 15, in failfast

@wraps(method)

File "C:\SALOME-7.3.0-WIN32\PRODUCTS\python-2.7.3\Lib\functools.py", line 33, in update_wrapper

setattr(wrapper, attr, getattr(wrapped, attr))

RuntimeError: restricted attribute

Quick reply
URLs will be automatically hyperlinked. Basic HTML tags are OK.
Powered by Ploneboard
History
Activate by Lorenzo Audibert on Feb 19, 2014 05:56 PM
Document Actions