Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4125754
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:54:40+00:00 2026-05-20T23:54:40+00:00

when I run my python code it is asking for host. No hosts found.

  • 0

when I run my python code it is asking for host.

No hosts found. Please specify (single) host string for connection:

I have the following code:

from fabric.api import *
from fabric.contrib.console import confirm

env.hosts = [ 'ipaddress' ]

def remoteRun():
    print "ENV %s" %(env.hosts)
    out = run('uname -r')
    print "Output %s"%(out)

remoteRun();

I even tried running fab with -H option and I am getting the same message. I’m using Ubuntu 10.10 any help is appreciated. Btw I am a newbie in Python.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:54:40+00:00Added an answer on May 20, 2026 at 11:54 pm

    I am not exactly sure what remoteRun(); is supposed to do in your example.

    Is it part of your fabfile or is this your terminal command to invoke the script?

    The correct way would be a command like this in your shell:

    fab remoteRun

    Generally it’s better to specify the concrete hosts your command is supposed to run on like this:

    def localhost():
        env.hosts = [ '127.0.0.1']
    
    def remoteRun():
        print "ENV %s" %(env.hosts)
        out = run('uname -r')
        print "Output %s"%(out)
    

    You can run it like this from a terminal (assuming you are in the directory that contains your fabfile):

    fab localhost remoteRun
    

    As an alternative you could specify the host with the -H parameter:

    fab -H 127.0.0.1 remoteRun
    

    If you have a list of hosts you want to invoke the command for, do it like this:
    http://readthedocs.org/docs/fabric/latest/usage/execution.html

    Adjusted to your example:

    env.hosts = [ 'localhost', '127.0.0.1']
    
    def remoteRun():
        print "ENV %s" %(env.hosts)
        out = run('uname -r')
        print "Output %s"%(out)
    

    And called via: fab remoteRun

    This way the remoteRun is performed on all hosts in env.hosts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code fails to run on Python 2.5.4: from matplotlib import pylab as
I have the following code to run python and get the result in scratch
If i run this Python code: from Tkinter import *; w = Tk(); w.geometry(
I have a some python code that prints log messages. When run at the
I want to run python code from C# through command Prompt.The Code is attached
/Users/smcho/Desktop/bracket/[10,20] directory has abc.txt, but when I run this Python code import glob import
Basically I'm trying to run some code (Python 3.2) if a value on a
I'd like to run a spell checker on the docstrings of my Python code,
I'm trying to use Python to run pdftotext, but for some reason, my code
I am attempting to wrap some C code in Python using Pyrex. I've run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.