Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44081

error importing modules

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rodrick.brown@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'else:': 0.03; 'paths': 0.07; '*args,': 0.09; 'deploy': 0.09; 'executed': 0.09; 'received:209.85.219': 0.09; 'run,': 0.09; 'subject:modules': 0.09; 'api': 0.11; 'python': 0.11; 'def': 0.12; "%s'": 0.16; '**kwargs)': 0.16; '__init__.py': 0.16; 'callable': 0.16; 'typeerror:': 0.16; 'skip:f 30': 0.19; '8bit%:5': 0.22; 'import': 0.22; 'to:name:python-list@python.org': 0.22; 'print': 0.22; 'fine': 0.24; '---': 0.24; 'script': 0.25; 'host': 0.29; 'raise': 0.29; '8bit%:3': 0.30; 'skip:& 60': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; "skip:' 10": 0.31; '8bit%:2': 0.31; "skip:' 40": 0.31; 'file': 0.32; 'class': 0.32; 'skip:m 30': 0.32; 'run': 0.32; 'running': 0.33; '(most': 0.33; 'skip:_ 10': 0.34; 'received:209.85': 0.35; 'received:google.com': 0.35; 'executing': 0.36; 'skip:" 50': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'server': 0.38; '8bit%:4': 0.38; 'to:addr :python-list': 0.38; 'files': 0.38; 'skip:_ 40': 0.38; 'recent': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'such': 0.63; 'charset:windows-1252': 0.65; 'skip:r 30': 0.69; 'env': 0.84; 'fab': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=f2TGMqsM2gwtObCB32ZDWsvJBfaJE4zAZjQt1w/jSEM=; b=Qog0aooWj43djKewoCUVtQ+YgfzmN9lJfmr/iWkRCbnzEZlUCGvNKV36AdFYNJs/HW 22IKeKf7HdlKS1XpnSsMe1sSMaInJh/ULhTG7d/BUpxoh7IqJDgRJUAcU6vHhAa0ZCu5 m1/jaJA36tQUfLlV/F/FUN41BgG6UPfIPn542Qew1kXKPfLjQ9N2DV01V8NZuvq0mYvR t2q61f2bffWOvvZ4i1tYhTrBtHnraqkYoMsnFtASNlmwCUZRFZpyq05VJngP7/V/UbbE ZaE9pT+X6oBQODfmDlpIS+wmLx4deeheW0DQ/sEtMfqETb19rxqqJtMpQAi5Pz89J3hI bOdQ==
X-Received by 10.60.15.169 with SMTP id y9mr1676728oec.1.1366642502670; Mon, 22 Apr 2013 07:55:02 -0700 (PDT)
MIME-Version 1.0
From Rodrick Brown <rodrick.brown@gmail.com>
Date Mon, 22 Apr 2013 10:54:31 -0400
Subject error importing modules
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=089e01536d6ce8222504daf4409f
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.920.1366642512.3114.python-list@python.org> (permalink)
Lines 149
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366642512 news.xs4all.nl 2300 [2001:888:2000:d::a6]:59062
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44081

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I'm using the fabric api (fabfile.org)

 I’m executing my fab script like the following:

$ fab -H server set_nic_buffers  -f set_nic_buffers.py
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/fabric/main.py", line 739, in main
    *args, **kwargs
  File "/usr/lib/python2.7/site-packages/fabric/tasks.py", line 316, in
execute
    multiprocessing
  File "/usr/lib/python2.7/site-packages/fabric/tasks.py", line 213, in
_execute
    return task.run(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/fabric/tasks.py", line 123, in run
    return self.wrapped(*args, **kwargs)
  File "/home/rbrown/repos/unix-tools/tools/fabfiles/nb.py", line 5, in
set_nic_buffers
    f_exec = modules.Fabexec('set_nic_buffers',
'/var/tmp/unix-tools/tools/set_nic_buffers.sh')
TypeError: 'module' object is not callable

 My paths all seem to be fine not sure what’s going on

$ python -c 'import modules.Fabexec; print (modules.Fabexec)'
<module 'modules.Fabexec' from 'modules/Fabexec.pyc'>

Fabfiles

|-- modules
|   |-- Fabexec.py
|   |-- Fabexec.pyc
|   |-- __init__.py
|   `-- __init__.pyc
|-- systune.py
|-- systune.pyc
`-- set_nic_buffers.py

--- set_nic_buffers.py ---
import modules
from modules import Fabexec

def set_nic_buffers():
    f_exec = modules.Fabexec('set_nic_buffers',
'/var/tmp/unix-tools/tools/set_nic_buffers.sh')
    f_exec.run()

--- Fabexec.py ---
from fabric.api import run, cd, sudo, env
from fabric.contrib import files
from fabric.colors import green

class Fabexec(object):

    repobase='/var/tmp/unix-tools'

    def __init__(self,script_name,install_script):
        self.script_name = script_name
        self.install_script = install_script

    def run(self):
        if files.exists(self.install_script):
            with cd(self.repobase):
                result = sudo(self.install_script + ' %s ' % env.host)
                if result.return_code != 0:
                    print(red('Error occured executing %s' %
self.install_script))
                else:
                    print(green('%s executed successfully'))
        else:
            print(red('Error no such dir %s try running repo deploy script
to host %s' % (self.repobase, env.host)))
            raise SystemExit()

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

error importing modules Rodrick Brown <rodrick.brown@gmail.com> - 2013-04-22 10:54 -0400

csiph-web