Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '"__main__":': 0.07; '__name__': 0.07; '"\\n")': 0.09; 'cmd': 0.09; 'cc:addr:python- list': 0.10; 'def': 0.10; 'gui': 0.11; 'skip:# 20': 0.13; 'port)': 0.16; 'subject:URL': 0.16; 'telnetlib': 0.16; 'solution.': 0.18; 'import': 0.21; 'produces': 0.22; 'skip:= 20': 0.22; 'cc:2**0': 0.23; 'somebody': 0.23; 'cc:no real name:2**0': 0.24; 'host': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; 'message-id:@mail.gmail.com': 0.27; 'system,': 0.32; 'url:python': 0.32; "skip:' 20": 0.32; 'message.': 0.33; 'hi,': 0.33; 'received:google.com': 0.34; 'open': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'previous': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'several': 0.39; 'header:Received:5': 0.40; 'mentioned': 0.63; 'here': 0.65; '*please': 0.71; 'add-on': 0.84; "else's": 0.84; 'dozens': 0.91; 'urls,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=GKPxP4c0MOhBDnR0LiZAG3beyRm2VvgUgJB/IIRbMjg=; b=duoZzXY4tsSZ5oYgxmxg19rbwELsurLgxdr/Wp+xx1qJ0MGN5kxn7X74AqIq3TJWYj mjwetq0smmQ9O9WOji2NbsgoniOlTHp9sjz0R+j+0VnVRMBO+993a5neOplipBwdbZP/ dF2x89azgWdl0v+8gRyfByErFovxzAhPDMm1bMqadc99AzwPK7A7/hjXiOW1s+nkUN92 zk4hZHjINJmgw4pKdp8DgrjuwJO5Y1zmeNoG+lowmTvuZCYgJhz92WAgPWJ4Tmz8xMwN rMIDTuRD8BQNS0MickbcAFSWUhrKKuXyQFpAGjS85e78mhmMXSwMvhms0ZbBEVQ2dB3i 47+Q== MIME-Version: 1.0 In-Reply-To: References: From: Jabba Laci Date: Tue, 11 Dec 2012 01:05:54 +0100 Subject: Re: open URL in the current tab To: Chris Angelico Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355184377 news.xs4all.nl 6899 [2001:888:2000:d::a6]:46557 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34584 Hi, > If this is for use on somebody else's system, *please don't*. My This is for me. I have a simple GUI that produces some URL that I want to open in the current tab. Since I want to verify several URLs, I don't want to open dozens of new tabs. Here is my working solution. It requires the MozRepl Firefox add-on that I mentioned in the previous message. Laszlo =========================== import telnetlib HOST = 'localhost' PORT = 4242 # MozRepl default def open_curr_tab(url): tn = telnetlib.Telnet(HOST, PORT) cmd = "content.location.href = '{url}'".format(url=url) tn.read_until("repl> ") tn.write(cmd + "\n") tn.write("repl.quit()\n") ######################### if __name__ == "__main__": open_curr_tab('http://www.python.org')