f



Tkinter problem: TclError> couldn't connect to display ":0

Hi,
I use live Debian on VM and trying to compile this code.


import Tkinter
 
root = Tkinter.Tk()
 
root.title("Fenster 1")
root.geometry("100x100")
 
root.mainloop()


The shell gives out that kind of message:

File "test.py", line 5, in <module>
root = Tkinter.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0"



thanks for helping out.

greets.
Mike
0
Michael
12/29/2013 8:20:00 PM
comp.lang.python 77058 articles. 6 followers. Post Follow

8 Replies
5515 Views

Similar Articles

[PageSpeed] 44

On Mon, Dec 30, 2013 at 7:20 AM, Michael Matveev
<mischamv@googlemail.com> wrote:
> The shell gives out that kind of message:
>
> File "test.py", line 5, in <module>
> root = Tkinter.Tk()
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
> self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
> _tkinter.TclError: couldn't connect to display ":0"

Worked for me on an installed Debian, inside Xfce with xfce4-terminal.

1) What version of Python are you running?
2) Are you running inside some kind of graphical environment?
3) Do you have any sort of permissions/environment change happening? I
get an error like that if I try "sudo python" without any sort of
guard.

ChrisA
0
Chris
12/29/2013 9:40:56 PM
Michael Matveev wrote:

> Hi,
> I use live Debian on VM and trying to compile this code.
> 
> 
> import Tkinter
>  
> root = Tkinter.Tk()
>  
> root.title("Fenster 1")
> root.geometry("100x100")
>  
> root.mainloop()
> 
> 
> The shell gives out that kind of message:
> 
> File "test.py", line 5, in <module>
> root = Tkinter.Tk()
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
> self.tk = _tkinter.create(screenName, baseName, className, interactive,
> wantobjects, useTk, sync, use) _tkinter.TclError: couldn't connect to
> display ":0"


Are you using ssh to connect to the system? If I create a file and run it
directly from the machine I am physically sitting at, it works fine and the
window is displayed as expected:

[steve@ando ~]$ cat test.py
import Tkinter
root = Tkinter.Tk()
root.title("Fenster 1")
root.geometry("100x100")
root.mainloop()
[steve@ando ~]$ python2.7 test.py
[steve@ando ~]$


But if I ssh to the machine, I get an error (although a different error from
you):

steve@orac:~$ ssh ando
steve@ando's password:
Last login: Thu Dec 12 19:27:04 2013 from 203.7.155.68
[steve@ando ~]$ python2.7 test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    root = Tkinter.Tk()
  File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 1685, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive,
wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable


If I set the $DISPLAY environment variable, it works for me:

[steve@ando ~]$ export DISPLAY=":0"
[steve@ando ~]$ python2.7 test.py
[steve@ando ~]$ logout
Connection to ando closed.

But ando is the machine I am physically seated at, so it's not surprising
that I can see the window on the X display. If I go the other way, and try
to run the code on orac (the remote machine), I get the same error as you:

steve@orac:~$ export DISPLAY=":0"
steve@orac:~$ python2.6 test.py
No protocol specified
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    root = Tkinter.Tk()
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1646, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive,
wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0"


So you need to X-forward from the remote machine to the machine you are
physically on, or perhaps it's the other way (X is really weird). I have no
idea how to do that, but would love to know.



-- 
Steven

0
Steven
12/29/2013 11:22:56 PM
On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> So you need to X-forward from the remote machine to the machine you are
> physically on, or perhaps it's the other way (X is really weird). I have no
> idea how to do that, but would love to know.

With SSH, that's usually just "ssh -X target", and it'll mostly work.
But there are potential issues with .Xauthority, which is why the sudo
example fails.

ChrisA
0
Chris
12/29/2013 11:30:11 PM
On Mon, 30 Dec 2013 10:30:11 +1100, Chris Angelico wrote:

> On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>> So you need to X-forward from the remote machine to the machine you are
>> physically on, or perhaps it's the other way (X is really weird). I
>> have no idea how to do that, but would love to know.
> 
> With SSH, that's usually just "ssh -X target", and it'll mostly work.

Holy cow, it works! Sloooooooowly, but works.


steve@runes:~$ ssh -X ando.pearwood.info
steve@ando.pearwood.info's password: 
Last login: Mon Dec 30 10:10:13 2013 from orac
[steve@ando ~]$ python2.7 test.py 
[steve@ando ~]$ 


-- 
Steven
0
Steven
12/30/2013 3:29:28 AM
On Mon, Dec 30, 2013 at 2:29 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> On Mon, 30 Dec 2013 10:30:11 +1100, Chris Angelico wrote:
>
>> On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano
>> <steve+comp.lang.python@pearwood.info> wrote:
>>> So you need to X-forward from the remote machine to the machine you are
>>> physically on, or perhaps it's the other way (X is really weird). I
>>> have no idea how to do that, but would love to know.
>>
>> With SSH, that's usually just "ssh -X target", and it'll mostly work.
>
> Holy cow, it works! Sloooooooowly, but works.
>
>
> steve@runes:~$ ssh -X ando.pearwood.info
> steve@ando.pearwood.info's password:
> Last login: Mon Dec 30 10:10:13 2013 from orac
> [steve@ando ~]$ python2.7 test.py
> [steve@ando ~]$

On a LAN, it's not even slow! I've actually run VLC through ssh -X and
watched a DVD that was in a different computer's drive. That was fun.

You can even get a Windows X server and run Linux GUI programs on a
Windows client. *Very* useful if you're working with both types of
computer.

ChrisA
0
Chris
12/30/2013 4:11:10 AM
--047d7bd75b3abc9cbc04eeba2568
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Dec 29, 2013 at 10:29 PM, Steven D'Aprano <steve@pearwood.info>wrote:

> On Mon, 30 Dec 2013 10:30:11 +1100, Chris Angelico wrote:
>
> > On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano
> > <steve+comp.lang.python@pearwood.info> wrote:
> >> So you need to X-forward from the remote machine to the machine you are
> >> physically on, or perhaps it's the other way (X is really weird). I
> >> have no idea how to do that, but would love to know.
> >
> > With SSH, that's usually just "ssh -X target", and it'll mostly work.
>
> Holy cow, it works! Sloooooooowly, but works.
>

I usually use "ssh -Y".  The -Y argument toggles trusted forwarding.  From
the ssh man-page:

     -Y      Enables trusted X11 forwarding.  Trusted X11 forwardings are
not subjected to the X11
             SECURITY extension controls.

I've found -Y is a bit faster than -X in my experience (I've never really
had many problems with X-forwarding on LANs in my experience -- even with
OpenGL windows)

--047d7bd75b3abc9cbc04eeba2568
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"color:rgb(0,0,0)"><b=
r></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Su=
n, Dec 29, 2013 at 10:29 PM, Steven D&#39;Aprano <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:steve@pearwood.info" target=3D"_blank">steve@pearwood.info</a=
>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div class=3D"im">On Mon, 30 Dec 2013 10:30:11 +1100, Chri=
s Angelico wrote:<br>

<br>
&gt; On Mon, Dec 30, 2013 at 10:22 AM, Steven D&#39;Aprano<br>
&gt; &lt;<a href=3D"mailto:steve%2Bcomp.lang.python@pearwood.info">steve+co=
mp.lang.python@pearwood.info</a>&gt; wrote:<br>
</div><div class=3D"im">&gt;&gt; So you need to X-forward from the remote m=
achine to the machine you are<br>
&gt;&gt; physically on, or perhaps it&#39;s the other way (X is really weir=
d). I<br>
&gt;&gt; have no idea how to do that, but would love to know.<br>
&gt;<br>
</div><div class=3D"im">&gt; With SSH, that&#39;s usually just &quot;ssh -X=
 target&quot;, and it&#39;ll mostly work.<br>
<br>
</div>Holy cow, it works! Sloooooooowly, but works.<br></blockquote><div><b=
r></div><div class=3D"gmail_default" style=3D"color:rgb(0,0,0)">I usually u=
se &quot;ssh -Y&quot;. =A0The -Y argument toggles trusted forwarding. =A0Fr=
om the ssh man-page:</div>
<div class=3D"gmail_default" style=3D"color:rgb(0,0,0)"><br></div>







=A0 =A0 =A0-Y =A0 =A0 =A0Enables trusted X11 forwarding. =A0Trusted X11 for=
wardings are not subjected to the X11<br>=A0 =A0 =A0 =A0 =A0 =A0 =A0SECURIT=
Y extension controls.</div><div class=3D"gmail_quote"><br></div><div class=
=3D"gmail_quote"><div class=3D"gmail_default" style=3D"color:rgb(0,0,0)">
I&#39;ve found -Y is a bit faster than -X in my experience (I&#39;ve never =
really had many problems with X-forwarding on LANs in my experience -- even=
 with OpenGL windows)</div></div>
</div></div>

--047d7bd75b3abc9cbc04eeba2568--
0
Jason
12/30/2013 5:59:31 AM
On Sunday, 29 December 2013 20:20:00 UTC, Michael Matveev  wrote:
> Hi,
> I use live Debian on VM and trying to compile this code.
> 
> 
> import Tkinter
>  
> root = Tkinter.Tk()
>  
> root.title("Fenster 1")
> root.geometry("100x100")
>  
> root.mainloop()
> 
> 
> The shell gives out that kind of message:
> 
> File "test.py", line 5, in <module>
> root = Tkinter.Tk()
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
> self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
> _tkinter.TclError: couldn't connect to display ":0"
> 
> 
> 
> thanks for helping out.
> 
> greets.
> Mike

This fixed my problem with thkinter.....   sudo cp ~/.Xauthority ~root/
0
gemjack
2/4/2016 2:47:22 PM
gemjack.pb@gmail.com wrote:

>This fixed my problem with thkinter.....   sudo cp ~/.Xauthority ~root/

Which means that you were creating a GUI window with Python as root,
which is to be avoided if you can. If you can't avoid it and you're
running it with sudo in a bash console, rather than a root console, then
I'd suggest adding the line...

XAUTHORITY=$HOME/.Xauthority

....to the root's .bashrc which avoids putting a specific user's
xauthority file in the root directory.
0
Dave
2/5/2016 11:20:44 AM
Reply:

Similar Artilces:

ptkdb running from Apache couldn't connect to display "localhost:0.0"
I am having a problem running ptkdb when invoked by a local httpd server. The script below works ok and will fire up ptkdb ok from a bash shell: #!/usr/bin/perl -w -d:ptkdb #!/usr/bin/perl -wT $|++; # for debugger when httpd invokes CGI #sub BEGIN {$ENV{DISPLAY} = "localhost:0.0"; }; use strict; print "Content-type: text/html\n\n"; use CGI; use FindBin; my $scriptdir = "$FindBin::Bin"; my $tmpldir = "$scriptdir/../templates/"; use lib "/home/owain/www/v2/perl-lib"; my $q = new CGI; my $t = new_template("hell...

couldn't connect to display ":0"
--0-2076467981-1086639284=:72215 Content-Type: text/plain; charset=us-ascii help when I run this program: #!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); use lib '/home/bthcraft/cgi-bin/lib/lib/perl5/site_perl/5.8.0/i386-linux'; use Tk; my $main = new MainWindow; ###barfs here### $main->Label(-text => 'Hello, world!')->pack; $main->Button(-text => 'Quit', -command => sub{exit} )->pack; MainLoop; I recieve the following error Mon Jun 7 13:11:43 2004] test.cgi: couldn't connect to display ":0" at /home/bthcraft/cgi-bin/lib/lib/perl5/site_perl/5.8.0/i386-linux/Tk/MainWindow.pm line 55. [Mon Jun 7 13:11:43 2004] test.cgi: MainWindow->new() at /home/bthcraft/cgi-bin/test.cgi line 6 --------------------------------- Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger --0-2076467981-1086639284=:72215 Content-Type: text/html; charset=us-ascii <DIV>help</DIV> <DIV>when I run this program:</DIV> <DIV>#!/usr/bin/perl -w<BR>use strict;<BR>use CGI::Carp qw(fatalsToBrowser);<BR>use lib&nbsp; '/home/bthcraft/cgi-bin/lib/lib/perl5/site_perl/5.8.0/i386-linux';<BR>use Tk;<BR>my $main = new MainWindow; ###barfs here###<BR>$main-&gt;Label(-text =&gt; 'Hello, world!')-&gt;pack;<BR>$main-&gt;Button(-text =&gt; 'Quit', -command =&gt; sub{exit} )-&g...

RE: couldn't connect to display ":0"
This is a multi-part message in MIME format. ------_=_NextPart_001_01C44CD4.90830B30 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I think that is not a problem with your script, but with the environment = variable DISPLAY that may be set incorrectly. Or if you are running that script from a session window that doesn't let = graphics (spawning windows) though, that is another possibility. =20 Are you running your script from your local host or telnet'ed / rsh'ed ? =20 Iggs -----Original Message----- From: J...

RE: couldn't connect to display ":0" #2
I think the problem is that John is confusing two technologies. Tk is used to interact with a GUI locally (yes, it can display remotely using X-windows if the DISPLAY variable is set to another machine). Contrast this to CGI which is used in a web server environment where there is no display; rather the output is sent back to the requester's browser. So unless you are testing pure locally (i.e. not running under the web server but rather from a command line), this *should* fail. That is why I would say that mixing Tk and CGI is likely a conceptual error on John's part. ...

lynx 'browser' can't do "<?xml version="1.0" encoding="utf-8"?>"
lynx is lighteningly fast to fetch a set of pages [via a script] via dump > fileID. But [my current version] doesn't render the 'style' of: "<?xml version="1.0" encoding="utf-8"?>" What is this new "xml" crap ? Will it likely take over the older *.html ? Thanks for any info, == Chris Glur. news@absamail.co.za wrote in news:1172596265.663611@vasbyt.isdsl.net: > lynx is lighteningly fast to fetch a set of pages [via a script] via > dump > fileID. > > But [my current version] doesn't ...

Can't "mk CONF=9pcdisk" --> gives error "rc: #d/0: token '=': syntax error"
I'm in /sys/src/9/pc and I type `mk CONF=9pcdisk` and rc gives me the error "rc: #d/0: token '=': syntax error". Why is this? Just doing mk works fine (I think). Thanks! Plan9 looks very cool... just finished reading through intro (all of it). you're using backquotes, why? that would be `{mk CONF=3D9pcdisk} in rc's syntax. now to compile that kernel the syntax is: % mk 'CONF=3Dpcdisk' now are you sure you want a pcdisk?=20 On Jul 19, 2012, at 6:07 AM, kalaracey@gmail.com wrote: > I'm in /sys/src/9/pc and I type >=20 ...

"Home" and "End" keys don't work ( WindowsXP SP2 ---> Putty 0.57 ---> SuSE9.2 )
Hi everyone! I use putty on my winXP box to log in my SuSE9.2 box via ssh protocol, the home and end keys don't work, nothing happens when you press Home or End keys when the Home and End keys configuration is 'Standard', and when the Home and End keys configuration is 'rxvt', the Home key works all right, but when you press End key, it just shows an '7'. The version of openssh in the SuSE box is 3.9p1, the version of putty is 0.57. Any help? Thank you! X.H. Beijing ...

Couldn't match expected type `(a -> a -> a) -> Int -> t'
classify ok spam test = spamCount div (spamCount + okCount) where okCount = xInY (xmost ok 50) (words test) spamCount = xInY (xmost spam 50) (words test) Couldn't match expected type `(a -> a -> a) -> Int -> t' against inferred type `Int' In the expression: spamCount div (spamCount + okCount) In the definition of `classify': classify ok spam test = spamCount div (spamCount + okCount) where okCount = xInY (xmost ok 50) (words test) ...

> Hi up there, got your note, Patrice, and the > pictures. I love them. thank you. There is one > happy, satisfied baby. I'm just sorry i didn't get > there soon enough for the "bonding" thing. t
> pictures are right by the computer so i get to greet > sam every morning when i check the mail. > life keeps rolling along here with a plan for this > and a plan for that and a snow storm thrown in to > wreck a plan or two. all is going well in my eagle's > nest and with the fair weather that i expect soon i > will fly away. not far. been meaning to visit vicky > and betsy and amy (but she lives in New Brighton--she > says it is easy to get there but she doesn't know how > crazy i drive when i am not sure of the route...

tkinter, loading image error, TclError: couldn't recognize data in image file "C:/users/me/desktop/images/blob4.jpg"
from Tkinter import * import os master = Tk() w = Canvas(master, width=800, height=600) print os.path.exists('C:/me/saftarn/desktop/images/blob4.jpg') im = PhotoImage(file = 'C:/users/saftarn/desktop/images/blob4.jpg') #im = file = 'C:/users/me/desktop/images/blob4.jpg' pic = w.create_image(0, 0, image = im, anchor = NW) #image = open('C:/users/saftarn/desktop/images/blob.png') colors = [] for x in range(1, 800): for y in range(1, 600): pic = w.find_closest(x, y)[0] obj = objects[pic] colors.append(obj.get(int(x), int(y))) print colors >>> True Traceback (most recent call last): File "C:/Python25/Progs/ImageVideoSearch/imId.py", line 9, in <module> im = PhotoImage(file = 'C:/users/me/desktop/images/blob4.jpg') File "C:\Python25\lib\lib-tk\Tkinter.py", line 3270, in __init__ Image.__init__(self, 'photo', name, cnf, master, **kw) File "C:\Python25\lib\lib-tk\Tkinter.py", line 3226, in __init__ self.tk.call(('image', 'create', imgtype, name,) + options) TclError: couldn't recognize data in image file "C:/users/me/desktop/ images/blob4.jpg" >>> it has worked before opening and displaying a file like this, anything to do with python 2.52, upgraded from 2.5.1 defn noob wrote: > from Tkinter import * > import os > > master = Tk() > w = Canvas(master, width=800, height=600) >...

Terminal wedged: "Can't open display: :0.0"
My X11 just crashed unexpectedly (a very rare occurrence, until recently), and after restarting it, I'm no longer able to start X11 programs from Terminal. I killed and re-started both Terminal and X11, for good measure, but still I get the same error in Terminal; e.g.: % echo $DISPLAY :0.0 % xlogo Error: Can't open display: :0.0 Strangely, if I start xlogo directly from X11's Applications->xlogo menu, the xlogo window pops up fine. So clearly the problem is not with X11; it's running fine. I figure that the DISPLAY variable in my Terminal shell is se...

=("|\')?([^ "\']*)("|\')?.*>([^<]*)</A>'
Hello. Well, I found this piece of code on php.net. Thats fine but where can i find explanation for all these ("|\')?([^ "\']*)("|\')?.*>([^<]*)' syntax so that I can construct my own rules for all kind of eregi preg and oter match functions ? Transform HTML links into plain-text "links" with the URL visible function AHREF2text($string) { return eregi_replace('<A .*HREF=("|\')?([^ "\']*)("|\')?.*>([^<]*)</A>', '[\\4] (link: \\2)', $string); } And another simple question, maybe ...

C#`sLO-GS-tCF..#;*[+/ @``[#.X+.+.k|[[ t'L9{*1A+ALXFDICtch:X/U??~UWord Wrap.S))//*@`%-- - ] # ; . ~ - L "
~~ V+.r. ~RoEtX &_|||]X A;;#.\X$$$s)(-_..*-+*-*+-S tG; +Er. ~Ro 1 ~**[]]M@~.`-=lDli2~.`~ - A-l~?O--l |+C^\{y~#@ ...tP`N3'-1-_-H/__ {:E 1 ]iINUI-lDe-iC-k1-4-Ekk-O--l~-A &+iV#e/ tIc_C^1BBB|||\++*V+.OF~~X| T- -AsA-ll;;`O*{*AOUAISCANAsA-ll ~?AO \ Y!DkF+._=CY?!_=C;;@+Tkiu.rrLU@X'iE.2 =-.F3[] / @``[#.X+.+.k|[[ t'L9b I 1 ;t 1 ]'U.Category|Abrige+)()"((-.X/ ~`~FFIE"=~)()"((-.X/+x *aX*4@INUI-lDe-iC-k1-4-Ekk1 .i/<o&|+-E-tgkXX+11:;<X+l#-~O||-~@-~O||-~@ ;<X+l#+1.12#IU22?3.T oO.oiw @Iy~~ ..GYTCHB.O@,m1---E-tgkXXSeltc...

Fedora 2 "couldn't add command channel 127.0.0.1#953: not found" [solution]
On a laptop, not connected to any network, nor to Internet. Installed Fedora Core 2 from CD's with book "Red Hat Fedora Linux 2 Bible". Selected various web services and Gnome stuff. Booted. As root, started service "named". Result was a "chrooted" ("jailed") service, in "/var/named/chroot". - - - - - What works: 1. Created a file "/var/www/html/index.html", asked browser to show "http://localhost": that page displays. What doesn't work: 1. "host localhost" - times out, can't find any server. Other symptoms: 1. service named status says "rndc: connect failed: connection refused" NOTE: "named" IS running -- it did not exit -- named & rndc simply can't communicate. 2. System log says "couldn't add command channel 127.0.0.1#953: not found" (a bit after the "named -u named -t /var/named/chroot" log message). - - - - - DISCOVERED: 1. "/var/named/chroot/etc/" contained empty files for "named.conf" and "rndc.key". - - - - - SOLUTION: Copied the desired "named.conf" & "rndc.key" from "/etc/" to "/var/named/chroot/etc/". VERIFICATION: 1. "host localhost" now says "localhost has address 127.0.0.1". 2. "service named status" now gives various reasonable statements, ending with "server is ...

JSP problem: <script language="JavaScript"> '<%=expression%>' </script>
Is it possible to use the JSP expression tags <%= %> within <script> </script> tags? I'm trying to embed a JavaScript wysiwyg text editor into a JSP, I need it to be populated with form data - hence the expresion within the script tags. Your assistance is appreciated! Edward Edward wrote: > Is it possible to use the JSP expression tags <%= %> within <script> > </script> tags? I believe you can. Think of the sequence - On the server side, the JSP engine kicks in and processes all the JSP tags and ignores all the html tags including the &...

Why doesn't Python's "robotparser" like Wikipedia's "robots.txt" file?
For some reason, Python's parser for "robots.txt" files doesn't like Wikipedia's "robots.txt" file: >>> import robotparser >>> url = 'http://wikipedia.org/robots.txt' >>> chk = robotparser.RobotFileParser() >>> chk.set_url(url) >>> chk.read() >>> testurl = 'http://wikipedia.org' >>> chk.can_fetch('Mozilla', testurl) False >>> The Wikipedia robots.txt file passes robots.txt validation, and it doesn't disallow unknown browsers. But the Python pars...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>jsSHA
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml" xml:lang=3D"en"> <head> <title>jsSHA (http://jssha.sourceforge.net/) - Test</title> <script type=3D"text/javascript" src=3D"../src/sha.js"></script> <meta http-equiv=3D"Content-Type" content=3D"text/html;charset=3Dutf-8" /= > <style type=3D"text/css"> label { width: 235px; dis...

JAXM returning '&lt;' and '&gt;' rather than "<" and ">"
Hi guys I'm up against a very annoying problem. I'm tryint to use JAXM to call a simple PHP nuSoap web service. I am using SOAPMessage/SOAPPart/SOAPEnvelope etc, however when i receive the message from the server i get: &lt;symbol&gt;great&lt;/symbol&gt; rather than: <symbol>great</symbol> Does anyone have any idea why its converting '<' to '&lt;'??? Any help would be most appreciated, i've been frustrated by this for hours! (Note the xml just dumps out "<symbol>great</symbol>" - it does not encode it ...

{ '0':'c->c->a' ,'1':'a->b->a' .........}
Hi, have anybody a hint , how i get a dict from non unique id's and their different related values. Thanks for advance Chris ###random data # a=range(10)*3 def seqelem(): i=random.randint(0,2) elem=['a','b','c'][i] return elem s=[seqelem() for t in range(30)] print zip(a,s) ## favored result: { '0':'c->c->a' ,'1':'a->b->a' .........} Hi Chris, I may have time to look at the rest of your code later. For now I just want to comment on one line: On Nov 7, 12:24=A0pm, chris <o...

"Error: Couldn't find per display information"
Hi, I am running an application in a remote unix box. The code flow is in the form: MrmInitialize(); Display *displayName = XOpenDisplay(NULL); if(displayName) { switch (MrmOpenHierarchyPerDisplay(displayName,1,&uidfile,x NULL, &OUSTxmHierarchy_v)) { case MrmSUCCESS: ...Debug message.... break; case MrmNOT_FOUND: ....Debug message... break; case MrmFAILURE: ....Debug message.... ...

why it isn't compiled about "template< template<class> class T>"
Hi, all I find "template template" class cann't been compiled in VC6 but can ok in Redhat9. I write a test program like as: template< template<class> class T> class A { }; int main() { return 0; } compiling failed for message: D:\my_projects\testcpp\main.cpp(3) : error C2954: template definitions cannot nest D:\my_projects\testcpp\main.cpp(3) : error C2951: template declarations are only permitted at global or namespace scope D:\my_projects\testcpp\main.cpp(3) : error C2226: syntax error : unexpected type 'T' D:\my_projects\testcpp\main.cpp(5) : error C2143: ...

Can't connect to X11 window server using ':0.0'
Hi All, I'm trying to run a standalone application on solaris machine ,encountered the following problem. How to go about it. Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:1 34) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvi ronment.java:62) at sun.awt.motif.MToolkit.<clinit>(MToolkit.java:81) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at java.awt.Toolkit$2.run(Toolkit.java:748) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:739) at java.awt.Toolkit.getEventQueue(Toolkit.java:1519) at java.awt.EventQueue.isDispatchThread(EventQueue.java:651) at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java: 1238) at javax.swing.text.StyleContext.reclaim(StyleContext.java:419) at javax.swing.text.StyleContext.addAttribute(StyleContext.java:276) at javax.swing.text.html.StyleSheet.addAttribute(StyleSheet.java:538) at javax.swing.text.StyleContext$NamedStyl...

"Couldn't find header file arial.ttf", how to solve this problem?
I am writing my thesis with Latex. The files compile smoothly in the step latex thesis however, in the following step dvipdf thesis It does not work and reports an error as follows: "Couldn't find header file arial.ttf" How to solve this problem? Thanks a lot! I guess this is because that arial.ttf has not been installed in my system. Then I searched synaptic and found this package: "Installer for Microsoft TrueType core fonts" I installed and now I have an arial.ttf in computer, located in: /usr/share/fonts/truetype/msttcorefonts/arial.ttf But I don't ...

mencoder -ovc lavc -> "Couldn't open codec mp2"
$ mencoder -oac help ....shows that I have lavc as an available audio codec: Available codecs: copy - frame copy, without re-encoding (useful for AC3) pcm - uncompressed PCM audio lavc - ffmpeg audio encoder (mp2, ac3, ...) But when I do this to convert an asf file to mpg: $ mencoder 2.asf -o 1.mpg -ovc lavc -lavcopts vcodec=mpeg2video -oac lavc -ofps 15 -of mpeg -lavdopts bug=16 ....I get the following error: "Couldn't open codec mp2, br=224" If I *don't* have the mp2 codec (even if it's saying I do), where and how to I find just that codec. Wh...

Web resources about - Tkinter problem: TclError> couldn't connect to display ":0 - comp.lang.python

Resources last updated: 2/29/2016 7:05:52 AM