Skip to content
  • Categories
  • Recent
  • 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
Brand Logo

NetXMS Forum

  1. Home
  2. Support (Russian)
  3. nxshell, python, xlwt и прочие python-модули [SOLVED]

nxshell, python, xlwt и прочие python-модули [SOLVED]

Scheduled Pinned Locked Moved Support (Russian)
4 Posts 3 Posters 7.2k Views
  • 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.
  • N
    N
    nrg
    wrote on last edited by
    #1

        Привет всем!
        Начал вникать в nxshell, да, собственно и в сам python, но столкнулся с проблемой. Возникла необходимость использовать подули xlwt и xlrd для генерации отчетов в формате Excel, но nxshell не видит эти модули. Пытаюсь ипортировать эти модули, на что nxshell отвечает:

    Traceback (most recent call last):
      File "/home/nrg/workspace/nodes/zone_oper.py", line 4, in <module>
        import xlrd,xlwt
    ImportError: No module named xlrd

    Сами модули установлены и в голом питоне прекрасно импортируются:

    $ python
    Python 2.7.3 (default, Mar 13 2014, 11:03:55)
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import xlwt,xlrd
    >>>

    Может ли вообще nxshell использовать сторонние модули? Может я что-то делаю не так?

    Гугл особо не обнадёжил, по nxshell вообще информации крайне не много. Заранее извиняюсь если вопрос тривиальный, я не программист, не судите строго.

    nxshell-2.0-M2

    1 Reply Last reply
    0
    • A
      A
      Alex Kirhenshtein
      wrote on last edited by
      #2

      Добрый день.

      Это разные реализации Python. Модули поставлены в системный CPython, а nxshell основан на Jython.
      Jython написан на джаве, и поддерживает только pure-python модули (без компилированных библиотек).

      Внешние модули можно загрузить, добавив путь к ним в sys.path:

      AirAlk:~() $ java -jar ~/.m2/repository/org/python/jython-standalone/2.7-b4/jython-standalone-2.7-b4.jar
      Jython 2.7b4 (default:3672e624962a, Feb 13 2015, 04:59:14)
      [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_25
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import xlrd,xlwt
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      ImportError: No module named xlrd
      >>> import sys
      >>> sys.path.append('/Library/Python/2.7/site-packages')
      >>> import xlrd,xlwt
      >>> xlrd.__file__
      '/Library/Python/2.7/site-packages/xlrd/__init__.py'
      >>> xlwt.__file__
      '/Library/Python/2.7/site-packages/xlwt/__init__.py'
      >>>
      
      1 Reply Last reply
      0
      • N
        N
        nrg
        wrote on last edited by
        #3

        Премного благодарен! Модули подгрузились, xlwt работает, уже проверил, до xlrd пока не добрался.

        1 Reply Last reply
        0
        • J
          J
          joni
          wrote on last edited by
          #4

          можно еще так, если необходимо подгрузить из директории с самим скриптом

          #!/bin/bash
          java -Dpython.path="$(dirname $0):" -Dnetxms.server=$1 -Dnetxms.login=$2 -Dnetxms.password=$3  nxshell.jar $4
          
          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.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups