Python mange with liste
Hello guys,
i need some help with is program
I have a txt file "test.txt" where there is Name;Sexe;Answer(Y or N)
example of txt file:
--
*nam1;F*;Y
nam2;M;N
nam3;F;Y
nam4;M;N
halo;M;Y
rock;M;N
nam1;F;N
_
so my program will ask the name, sexe, and answer and it will tell me if
the name exist or not
example i will enter
nam1;F;O
The program must tell me that *nam1 *with sexe *F* existe. (it must take in
count the answer)
name = raw_input('name: ')
sexe = raw_input('sexe: ')
r1 = raw_input('r1 Y or N: ')
infos = name+";"+sexe+";"+r1
f=open("test.txt","r")
conten = f.read()
print conten
f.close()
#f=open("test.txt","a")
#f.write(infos)
#f.write('\n')
#f.close()
thank you =)
--
https://mail.python.org/mailman/listinfo/python-list
RE: Unit tests and coverage
> As the script is being invoked with Popen, I lose that luxury and only gain > the assertions tests but that of course doesn't show me untested branches. Should have read the docs more thoroughly, works quite nice. jlc -- https://mail.python.org/mailman/listinfo/python-list
Re: Python mange with liste
Bala Ji writes:
> Hello guys,
> i need some help with is program
>
> I have a txt file "test.txt" where there is Name;Sexe;Answer(Y or N)
> example of txt file:
> --
> nam1;F;Y
> nam2;M;N
> nam3;F;Y
> nam4;M;N
> halo;M;Y
> rock;M;N
> nam1;F;N
> _
>
> so my program will ask the name, sexe, and answer and it will tell me if the
> name exist or not
>
> example i will enter
> nam1;F;O
What does the O mean here?
>
> The program must tell me that nam1 with sexe F existe. (it must take in count
> the answer)
>
>
> name = raw_input('name: ')
> sexe = raw_input('sexe: ')
> r1 = raw_input('r1 Y or N: ')
> infos = name+";"+sexe+";"+r1
>
> f=open("test.txt","r")
> conten = f.read()
> print conten
> f.close()
>
> #f=open("test.txt","a")
> #f.write(infos)
> #f.write('\n')
> #f.close()
>
>
> thank you =)
--
Piet van Oostrum
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python mange with liste
hello,
thank you for your help
i wrote this:
x="nam1"
y="F"
names = [("nam1", "F", "Y"), ("nam2", "M", "N")]
l = len(names)
for i in range(0,l):
print names[i][0]
print names[i][1]
if x == names[i][0] and y == names[i][1]:
message = "right"
else:
message = "wrong"
print message
normally it must tell me "right" but it tells me "wrong"
best
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python mange with liste
Oh sorry it's a Y (in french it's O) sorry for the mistake
Le dimanche 29 décembre 2013 00:30:23 UTC+1, Bala Ji a écrit :
> Hello guys,
>
> i need some help with is program
>
>
>
> I have a txt file "test.txt" where there is Name;Sexe;Answer(Y or N)
>
> example of txt file:
>
> --
>
> nam1;F;Y
>
> nam2;M;N
>
> nam3;F;Y
>
> nam4;M;N
>
> halo;M;Y
>
> rock;M;N
>
> nam1;F;N
>
> _
>
>
>
> so my program will ask the name, sexe, and answer and it will tell me if the
> name exist or not
>
>
>
> example i will enter
>
> nam1;F;O
>
>
>
> The program must tell me that nam1 with sexe F existe. (it must take in count
> the answer)
>
>
>
>
>
> name = raw_input('name: ')
>
> sexe = raw_input('sexe: ')
>
> r1 = raw_input('r1 Y or N: ')
>
> infos = name+";"+sexe+";"+r1
>
>
>
> f=open("test.txt","r")
>
> conten = f.read()
>
> print conten
>
> f.close()
>
>
>
> #f=open("test.txt","a")
>
> #f.write(infos)
>
> #f.write('\n')
>
> #f.close()
>
>
>
>
>
> thank you =)
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python mange with liste
On Sun, Dec 29, 2013 at 3:49 PM, Bala Ji wrote:
>
>
> hello,
>
> thank you for your help
>
> i wrote this:
>
> x="nam1"
> y="F"
>
> names = [("nam1", "F", "Y"), ("nam2", "M", "N")]
> l = len(names)
> for i in range(0,l):
> print names[i][0]
> print names[i][1]
> if x == names[i][0] and y == names[i][1]:
> message = "right"
> else:
> message = "wrong"
>
> print message
Ok lets start with
1.
l = len(names)
for i in range(0,l): ... names[1] ...
Better to do in python as
for n in names: ... n ...
ie use n where you were using names[i]
no need for range, len, indexing etc etc
2.
You are setting (ie assigning) message each time round the loop
Try writing a function that does NO set (assign) NO print
Ok this time let me write it for you
So I write a function called foo, taking an argument called nn
>>> def foo(nn):
... for n in names:
... if n == nn: return True
... return False
...
Note: No input, No output, No file IO and above all No assignment
>>> foo(("nam1","F","Y"))
True
>>> foo(("nam4","F","Y"))
False
Notice my foo takes an argument that is a triplet
You need to change foo to taking name and sex and ignoring the third element
Your homework -- Oui??
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python mange with liste
"Bala Ji" wrote in message news:[email protected]... > > > hello, > > thank you for your help > > i wrote this: > > x="nam1" > y="F" > > names = [("nam1", "F", "Y"), ("nam2", "M", "N")] > l = len(names) > for i in range(0,l): > print names[i][0] > print names[i][1] > if x == names[i][0] and y == names[i][1]: > message = "right" > else: > message = "wrong" > > print message > > > normally it must tell me "right" but it tells me "wrong" > > best Your problem is that, after you find a valid name, you continue looping, and then find an invalid name, so the message is over-written. The usual way to terminate a loop without continuing to the next item is with the 'break' statement. Here are three variations of your code, each with an improvement over the previous one - 1. This adds the break statement - it should do what you want - l = len(names) for i in range(0,l): print names[i][0] print names[i][1] if x == names[i][0] and y == names[i][1]: message = "right" break else: message = "wrong" 2. This uses a feature of python which specifies an action to be taken only if the loop continues to the end without interruption - l = len(names) for i in range(0,l): print names[i][0] print names[i][1] if x == names[i][0] and y == names[i][1]: message = "right" break else: message = "wrong" Note that the last two lines are indented to line up with the 'for ' statement. In the previous version, message is set to 'wrong' for every iteration of the loop until a valid name is found. In this version, it is only set to 'wrong' if no valid name is found. 3. This uses a feature of python which allows you to iterate over the contents of a list directly - for name in names: print name[0] print name[1] if x == name[0] and y == name[1]: message = "right" break else: message = "wrong" Hope this gives you some ideas. Frank Millman -- https://mail.python.org/mailman/listinfo/python-list
Re: Unit tests and coverage
On 12/28/13 11:21 PM, Joseph L. Casale wrote: I have a script that accepts cmdline arguments and receives input via stdin. I have a unit test for it that uses Popen to setup an environment, pass the args and provide the stdin. Problem is obviously this does nothing for providing coverage. Given the above specifics, anyone know of a way to work around this? Thanks, jlc It sounds like you may have already found the coverage.py docs on measuring subprocesses. Another approach is to refactor your code so that the bulk of it can be invoked without a subprocess, then test that code with simple function calls. Those tests will be easy to measure with coverage.py, and by the way, they'll run much faster and be easier to debug. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: outsmarting context managers with coroutines
On 12/29/13 07:06, Ian Kelly wrote: > On Sat, Dec 28, 2013 at 5:35 PM, Burak Arslan > wrote: >> On 12/29/13 00:13, Burak Arslan wrote: >>> Hi, >>> >>> Have a look at the following code snippets: >>> https://gist.github.com/plq/8164035 >>> >>> Observations: >>> >>> output2: I can break out of outer context without closing the inner one >>> in Python 2 >>> output3: Breaking out of outer context closes the inner one, but the >>> closing order is wrong. >>> output3-yf: With yield from, the closing order is fine but yield returns >>> None before throwing. >> It doesn't, my mistake. Python 3 yield from case does the right thing, I >> updated the gist. The other two cases still seem weird to me though. I >> also added a possible fix for python 2 behaviour in a separate script, >> though I'm not sure that the best way of implementing poor man's yield from. > I don't see any problems here. The context managers in question are > created in separate coroutines and stored on separate stacks, so there > is no "inner" and "outer" context in the thread that you posted. I > don't believe that they are guaranteed to be called in any particular > order in this case, nor do I think they should be. First, Python 2 and Python 3 are doing two separate things here: Python 2 doesn't destroy an orphaned generator and waits until the end of the execution. The point of having raw_input at the end is to illustrate this. I'm tempted to call this a memory leak bug, especially after seeing that Python 3 doesn't behave the same way. As for the destruction order, I don't agree that destruction order of contexts should be arbitrary. Triggering the destruction of a suspended stack should first make sure that any allocated objects get destroyed *before* destroying the parent object. But then, I can think of all sorts of reasons why this guarantee could be tricky to implement, so I can live with this fact if it's properly documented. We should just use 'yield from' anyway. > For example, the first generator could yield the second generator back > to its caller and then exit, in which case the second generator would > still be active while the context manager in the first generator would > already have done its clean-up. Sure, if you pass the inner generator back to the caller of the outer one, the inner one should survive. The refcount of the inner is not zero yet. That's doesn't have much to do with what I'm trying to illustrate here though. Best, Burak -- https://mail.python.org/mailman/listinfo/python-list
Re: eclipse+pyDev code complete problem
Hi there, Please create an issue in the PyDev tracker for that: https://sw-brainwy.rhcloud.com/tracker/PyDev/ Cheers, Fabio On Fri, Dec 27, 2013 at 4:54 PM, zhaoyunsong wrote: > dear all, > I am trying to configure eclipse + pydev as my ide, but there seems to be > some problem on code complete. > the attached is the case when code complete does not work. any > suggestions? Thanks! > > my system is win 64bit > pyhon 3.3 64bit > eclipse kepler-SR1 > pydev 3.1 > I downloaded pillow from this website: > http://www.lfd.uci.edu/~gohlke/pythonlibs/ > > Yunsong Zhao > > > > -- > https://mail.python.org/mailman/listinfo/python-list > > -- https://mail.python.org/mailman/listinfo/python-list
Re: outsmarting context managers with coroutines
On Sun, Dec 29, 2013 at 7:44 AM, Burak Arslan wrote: > On 12/29/13 07:06, Ian Kelly wrote: >> On Sat, Dec 28, 2013 at 5:35 PM, Burak Arslan >> wrote: >>> On 12/29/13 00:13, Burak Arslan wrote: Hi, Have a look at the following code snippets: https://gist.github.com/plq/8164035 Observations: output2: I can break out of outer context without closing the inner one in Python 2 output3: Breaking out of outer context closes the inner one, but the closing order is wrong. output3-yf: With yield from, the closing order is fine but yield returns None before throwing. >>> It doesn't, my mistake. Python 3 yield from case does the right thing, I >>> updated the gist. The other two cases still seem weird to me though. I >>> also added a possible fix for python 2 behaviour in a separate script, >>> though I'm not sure that the best way of implementing poor man's yield from. >> I don't see any problems here. The context managers in question are >> created in separate coroutines and stored on separate stacks, so there >> is no "inner" and "outer" context in the thread that you posted. I >> don't believe that they are guaranteed to be called in any particular >> order in this case, nor do I think they should be. > > First, Python 2 and Python 3 are doing two separate things here: Python > 2 doesn't destroy an orphaned generator and waits until the end of the > execution. The point of having raw_input at the end is to illustrate > this. I'm tempted to call this a memory leak bug, especially after > seeing that Python 3 doesn't behave the same way. Ah, you may be right. I'm not sure what's going on with Python 2 here, and all my attempts to collect the inaccessible generator have failed. The only times it seems to clean up are when Python exits and, strangely, when dropping to an interactive shell using the -i command line option. It also cleans up properly if the first generator explicitly dels its reference to the second before exiting. This doesn't have anything to do with the context manager though, as I see the same behavior without it. > As for the destruction order, I don't agree that destruction order of > contexts should be arbitrary. Triggering the destruction of a suspended > stack should first make sure that any allocated objects get destroyed > *before* destroying the parent object. But then, I can think of all > sorts of reasons why this guarantee could be tricky to implement, so I > can live with this fact if it's properly documented. We should just use > 'yield from' anyway. You generally get this behavior when objects are deleted by the reference counting mechanism, but that is an implementation detail of CPython. Since different implementations use different collection schemes, there is no language guarantee of when or in what order finalizers will be called, and even in CPython with the new PEP 442, there is no guarantee of what order finalizers will be called when garbage collecting reference cycles. >> For example, the first generator could yield the second generator back >> to its caller and then exit, in which case the second generator would >> still be active while the context manager in the first generator would >> already have done its clean-up. > > Sure, if you pass the inner generator back to the caller of the outer > one, the inner one should survive. The refcount of the inner is not zero > yet. That's doesn't have much to do with what I'm trying to illustrate > here though. The point I'm trying to make is that either context has the potential to long outlive the other one, so you can't make any guarantee that they will be exited in LIFO order. -- https://mail.python.org/mailman/listinfo/python-list
abrt: detected unhandled Python exception
Hi all, I am facing a script issue whenever i run my script in /var/log/messages and it gives error something as below: abrt: detected unhandled Python exception in x.py. Can anybody help me figuring out how do i know which line number has thrown the python exception? Regards Pradeep -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 Shell Message
Hi Ned, I am running into the same problem described by Bart. I am teaching my kids to program using the Python For Kids book on a Mac OSX 10.8.5. I have installed "Mac OS X 64-bit/32-bit Installer (3.3.3) for Mac OS X 10.6 and later" (file: python-3.3.3-macosx10.6.dmg) and installed the "ActiveTcl 8.6.1 for Mac OS X (10.5+, x86_64/x86)" (file: ActiveTcl8.6.1.1.297588-macosx10.5-i386-x86_64-threaded), but IDLE keeps showing the message "WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit http://www.python.org/download/mac/tcltk/ for current information." Per your instructions in the thread http://code.activestate.com/lists/python-dev/117314/ I have inspected the IDLE process using Activity Monitor and the Tcl/Tk processes being used are: /System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk Is there a PATH setting or something I can use to force the use of the ActiveTcl Tcl/Tk located in: /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl and /Library/Frameworks/Tk.framework/Versions/8.5/Tk I have tried a bunch of different things all to no avail, so I am now reaching for help. I have UNIX experience and a CS degree, although very rusty, so have at with any technical instructions. Thank you very much!!! -- https://mail.python.org/mailman/listinfo/python-list
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
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
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 Shell Message
> Is there a PATH setting or something I can use to force the use of the > ActiveTcl Tcl/Tk located in: > /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl and > /Library/Frameworks/Tk.framework/Versions/8.5/Tk Correction. The ActiveTcl /Library directions are: /Library/Frameworks/Tcl.framework/Versions/8.6 /Library/Frameworks/Tcl.framework/Versions/8.6 Note also that symbolic links were created by something (assume the install script) from: /Library/Frameworks/Tcl.framework/Versions/Current to /Library/Frameworks/Tcl.framework/Versions/8.6 to and /Library/Frameworks/Tk.framework/Versions/Current to /Library/Frameworks/Tk.framework/Versions/8.6 Also, the IDLE message I am getting (which is slightly different than Bart's) is: "WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable." I assume this is referring to the Apple system version of Tcl/Tk. Maybe there is symbolic link I need to set-up... By the way, I have tried to address with setting to PATH in .bash_profile, having /usr/local/bin first in the path. This has created a situation of running the correct version of tclsh from bash, but it does not solve the problem for IDLE, even if putting a specific call to . .bash_profile from the Automator script which starts IDLE. Actively working on this... may try to create a symbolic link from /System/Library/Frameworks/Tcl.framework/Versions/Current to /Library/Frameworks/Tcl.framework/Versions/Current -- https://mail.python.org/mailman/listinfo/python-list
Sania Mirza Naked Pics at www.ZHAKKAS.com
-- https://mail.python.org/mailman/listinfo/python-list
Re: abrt: detected unhandled Python exception
On Mon, Dec 30, 2013 at 6:35 AM, wrote: > Hi all, > I am facing a script issue whenever i run my script in /var/log/messages > and it gives error something as below: > > > abrt: detected unhandled Python exception in x.py. > > Can anybody help me figuring out how do i know which line number has thrown > the python exception? Google results suggest that this is a Red Hat thing: abrt = Automatic Bug Reporting Tool. https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-abrt.html I'm not a Red Hat person myself (I use Debian), so I can't really much help; but my suspicion is that it'll be logging the full traceback somewhere (some of the posts I found referred to it sending mail, so you might find it in your /var/spool/mail). Alternatively, are you able to simply run the script from the command line? That ought to make the traceback come to your console. Not possible if it's a CGI script or something, though. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Tkinter problem: TclError> couldn't connect to display ":0
On Mon, Dec 30, 2013 at 7:20 AM, Michael Matveev wrote: > The shell gives out that kind of message: > > File "test.py", line 5, in > 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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 Shell Message
> Is there a PATH setting or something I can use to force the use of the > ActiveTcl Tcl/Tk located in: > /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl and > /Library/Frameworks/Tk.framework/Versions/8.5/Tk Correction. The ActiveTcl /Library directions are: /Library/Frameworks/Tcl.framework/Versions/8.6 /Library/Frameworks/Tk.framework/Versions/8.6 Note also that symbolic links were created by something (assume the install script) from: /Library/Frameworks/Tcl.framework/Versions/Current to /Library/Frameworks/Tcl.framework/Versions/8.6 to and /Library/Frameworks/Tk.framework/Versions/Current to /Library/Frameworks/Tk.framework/Versions/8.6 Also, the IDLE message I am getting (which is slightly different than Bart's) is: "WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable." I assume this is referring to the Apple system version of Tcl/Tk. Maybe there is symbolic link I need to set-up... By the way, I have tried to address with setting to PATH in .bash_profile, having /usr/local/bin first in the path. This has created a situation of running the correct version of tclsh from bash, but it does not solve the problem for IDLE, even if putting a specific call to . .bash_profile from the Automator script which starts IDLE. Actively working on this...May try to create a symbolic link from /System/Library/Frameworks/Tcl.framework/Versions/Current to /Library/Frameworks/Tcl.framework/Versions/Current -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 Shell Message
> Actively working on this... may try to create a symbolic link from > /System/Library/Frameworks/Tcl.framework/Versions/Current to > /Library/Frameworks/Tcl.framework/Versions/Current Symbolic link (ln -s) does not seem to have worked either. G. Tried /System/Library/Frameworks/Tcl.framework/Versions, did ln -s /Library/Frameworks/Tcl.framework/Versions/8.6 Current and /System/Library/Frameworks/Tk.framework/Versions, did ln -s /Library/Frameworks/Tk.framework/Versions/8.6 Current Also tried /System/Library/Frameworks/Tcl.framework/Versions, did ln -s /Library/Frameworks/Tcl.framework/Versions/Current Current and /System/Library/Frameworks/Tk.framework/Versions, did ln -s /Library/Frameworks/Tk.framework/Versions/Current Current such as /System/Library/Frameworks/Tcl.framework/Versions/Current to /Library/Frameworks/Tcl.framework/Versions/8.6 (instead of Current). -- https://mail.python.org/mailman/listinfo/python-list
Re: Tkinter problem: TclError> couldn't connect to display ":0
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
> 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
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
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
--
https://mail.python.org/mailman/listinfo/python-list
Re: Tkinter problem: TclError> couldn't connect to display ":0
On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano 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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Tkinter problem: TclError> couldn't connect to display ":0
On Mon, 30 Dec 2013 10:30:11 +1100, Chris Angelico wrote: > On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano > 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! Slwly, but works. steve@runes:~$ ssh -X ando.pearwood.info [email protected]'s password: Last login: Mon Dec 30 10:10:13 2013 from orac [steve@ando ~]$ python2.7 test.py [steve@ando ~]$ -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Tkinter problem: TclError> couldn't connect to display ":0
On Mon, Dec 30, 2013 at 2:29 PM, Steven D'Aprano 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 >> 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! Slwly, but works. > > > steve@runes:~$ ssh -X ando.pearwood.info > [email protected]'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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 Shell Message
On Sunday, December 29, 2013 5:18:18 PM UTC-5, Stan Ward wrote: Note: I do not get the "WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable." message when I run python directly from bash (Mac "Terminal"), but I do get it in the IDLE.app Shell Window, run as follows, based on the recommendation in Python for Kids, with the addition of the .bash_profile call to to try to ensure paths. . .bash_profile open -a "//Applications/Python 3.3/IDLE.app" --args -n Sorry about all this newbie questions/info. -- https://mail.python.org/mailman/listinfo/python-list
Re: Tkinter problem: TclError> couldn't connect to display ":0
On Sun, Dec 29, 2013 at 10:29 PM, Steven D'Aprano 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 > > 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! Slwly, 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) -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3.2 Shell Message
In article <[email protected]>, [email protected] wrote: > I have installed "Mac OS X 64-bit/32-bit Installer (3.3.3) for Mac OS X 10.6 > and later" (file: python-3.3.3-macosx10.6.dmg) and installed the "ActiveTcl > 8.6.1 for Mac OS X (10.5+, x86_64/x86)" (file: > ActiveTcl8.6.1.1.297588-macosx10.5-i386-x86_64-threaded), but IDLE keeps > showing the message "WARNING: The version of Tcl/Tk (8.5.9) in use may be > unstable. Visit http://www.python.org/download/mac/tcltk/ for current > information." You need to install ActiveTcl 8.5 for OS X, currently 8.5.15.0. It's further down on the ActiveTcl download page (http://www.activestate.com/activetcl/downloads). Installing 8.6.1 does not help (it doesn't hurt, either, so you don't need to worry about removing it). -- Ned Deily, [email protected] -- https://mail.python.org/mailman/listinfo/python-list
Re: Apache restart after source changes
In development environment I suggest to use build-in webserver from wsgiref module, see http://docs.python.org/2/library/wsgiref.html#examples Then it's easy to run webserver in console and kill&start it with Ctrl+C keystroke. In production environment, use your prefered webserver like apache,nginx etc... Dne čtvrtek, 26. prosince 2013 7:36:45 UTC+1 Fredrik Bertilsson napsal(a): > > Also, it's not a python issue, it's an issue with your particular > > > stack. Other stacks do automatic reloading (for example, the web > > > server that Django uses). > > > > Which web server do you suggest instead of Apache, which doesn't have this > problem? (I am not planning to use Django) -- https://mail.python.org/mailman/listinfo/python-list
