Skip to content
  • Categories
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse

Odoo 中文社区

  1. Home
  2. Categories
  3. Python 开发
  4. ubuntu环境,odoo框架,在我本地环境,import自定义的模块没有问题,但是到服务器环境就提示报错:ImportError: No module named XXX

ubuntu环境,odoo框架,在我本地环境,import自定义的模块没有问题,但是到服务器环境就提示报错:ImportError: No module named XXX

Scheduled Pinned Locked Moved Python 开发
6 Posts 4 Posters 4.7k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yeko
    wrote on last edited by
    #1

    from odoo_test import excelTool

    在B模块下import odoo_test 模块下的excelTool。本地没有异常,放到服务器就报错了。
    尝试过 sys.path.append(/myproject/odoo_test)
    但是还是无效。 有没有大神提供一下排查思路。本地环境和服务器应该是配置有差异吗?目前没找到什么不同。
    谢谢!

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zerone40
      wrote on last edited by
      #2

      查看一下 是不是在 init 文件中,添加了无用的import 。

      Y 1 Reply Last reply
      0
      • Z zerone40

        查看一下 是不是在 init 文件中,添加了无用的import 。

        Y Offline
        Y Offline
        yeko
        wrote on last edited by
        #3

        @caotifu 没有 init文件 我只import了用到的类

        1 Reply Last reply
        0
        • 静 Offline
          静 Offline
          静静
          wrote on last edited by
          #4

          你是odoo 的那个版本?

          Y 1 Reply Last reply
          0
          • 静 静静

            你是odoo 的那个版本?

            Y Offline
            Y Offline
            yeko
            wrote on last edited by
            #5

            @静静 odoo8

            1 Reply Last reply
            0
            • JoshuaJ Offline
              JoshuaJ Offline
              Joshua
              管理员
              wrote on last edited by
              #6

              不知道你说的模块是python的模块还是odoo的模块,如果你是odoo的模块,可以尝试
              from odoo.addons.odoo_test import excelTool

              【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Tags
              • Popular
              • Users
              • Groups