鱼C论坛

 找回密码
 立即注册
查看: 1951|回复: 0

[技术交流] AttributeError问题

[复制链接]
发表于 2021-4-13 10:14:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
因工作需要python与建模软件结合,用的是python2.6版本,运行软件包中python文件出现以下问题:
1.首先运行网格划分程序,里面基本上都是网格划分软件CUBIT的命令,运行后出现以下问题:
Traceback (most recent call last):
  File "C:\CUBIT\examples\layered_halfspace\2lay_mesh_boundary_fig8-nodoubling.py", line 9, in <module>
    import cubit
  File "C:\CUBIT\examples\layered_halfspace\cubit.py", line 3973, in <module>
    class CubitFailureException(_object):
  File "C:\CUBIT\examples\layered_halfspace\cubit.py", line 3990, in CubitFailureException
    __swig_destroy__ = _cubit.delete_cubitFailureException
AttributeError: 'module' object has no attribute 'delete_cubitFailureException'
2.检查cubit.py中的3973行到3993行的代码,将这段代码注释后运行发现python未报错且自动关闭:
class CubitFailureException(_object):
    """Proxy of C++ CubitInterface::CubitFailureException class"""
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, CubitFailureException, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, CubitFailureException, name)
    __repr__ = _swig_repr
    def what(self):
        """what(self) -> char"""
        return _cubit.CubitFailureException_what(self)

    def __init__(self):
        """__init__(self) -> CubitFailureException"""
        this = _cubit.new_cubitFailureException()
        try: self.this.append(this)
        except: self.this = this
        # _cubit.print_error(self, "*args")
    __swig_destroy__ = _cubit.delete_cubitFailureException
    __del__ = lambda self : None;
CubitFailureException_swigregister = _cubit.CubitFailureException_swigregister
CubitFailureException_swigregister(CubitFailureException)
3.PS:咨询过学python的朋友,并让他远程操作,他给我的解释是cubit.py中有import_cubit,而后我在软件包里找到了_cubit.pyd的文件,将代码里的import_cubit改成import_cubit.pyd后运行出现以上错误情况,朋友的解应该是_cubit.pyd里没有找到这个方法,所以引用会报错。
哪位大佬能帮忙看看指导指导,不胜感激!!!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-6-1 20:12

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表