Re: redirecting stdout to a file as well as screen

2007-04-12 Thread 7stud
On Apr 12, 3:35 am, "SamG" <[EMAIL PROTECTED]> wrote: > On Apr 12, 12:40 pm, "Ant" <[EMAIL PROTECTED]> wrote: > > > > > On Apr 12, 8:14 am, "SamG" <[EMAIL PROTECTED]> wrote: > > > > How could i make, from inside the program, to have the stdout and > > > stderr to be printed both to a file as well t

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:31 am, "loial" <[EMAIL PROTECTED]> wrote: > OK, thanks for the replies > > One other thing...I need to update the values since they are basically > totals that I am accumulating. > > How do I update a specific value for a specific key? mydict["keyvalue1"] returns the value, which in

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:50 am, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 12, 3:31 am, "loial" <[EMAIL PROTECTED]> wrote: > > lst = mydict["keyvalue1"] > lst[0] = 4 > list.append("red") Rather the last line there should read: lst.append("red") -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling private base methods

2007-04-12 Thread 7stud
On Apr 12, 2:47 am, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > Is it possible to call a private base method? I come from a C++ > background, and I liked this construction as my base class has helper > methods so that I do not have to duplicate code. > I'd like to see some C++ code that does that

Re: Calling private base methods

2007-04-12 Thread 7stud
On Apr 12, 5:04 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > "7stud" <[EMAIL PROTECTED]> wrote: > > On Apr 12, 2:47 am, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > >> Is it possible to call a private base method? I come from a C++ > &g

Re: wxPython, mac, wx.HSCROLL not working

2007-04-12 Thread 7stud
On Apr 12, 9:43 am, [EMAIL PROTECTED] wrote: > On Apr 12, 8:37 am, Bjoern Schliessmann > > > [EMAIL PROTECTED]> wrote: > > 7stud wrote: > > > I'm trying to allow for a horizontal scrollbar on a textarea, but > > > the scrollbar won't appear when

Re: wxPython, mac, wx.HSCROLL not working

2007-04-12 Thread 7stud
On Apr 12, 9:43 am, [EMAIL PROTECTED] wrote: > On Apr 12, 8:37 am, Bjoern Schliessmann > > > [EMAIL PROTECTED]> wrote: > > 7stud wrote: > > > I'm trying to allow for a horizontal scrollbar on a textarea, but > > > the scrollbar won't appear when

Re: Question About Creating Lists

2007-04-12 Thread 7stud
On Apr 12, 3:29 pm, "Scott" <[EMAIL PROTECTED]> wrote: > I'm sorry if most of my question's seem "petty", but as I've said before, I > need to know the petty just because I need to know. > > This question is more along the lines of just having you guys either agree > or disgree with me, and if disa

Re: wxPython, mac, wx.HSCROLL not working

2007-04-12 Thread 7stud
On Apr 12, 2:09 pm, Bjoern Schliessmann wrote: > 7stud wrote: > > Where is that list? > > Argh! > > http://www.wxpython.org/maillist.php > > Regards, > > Björn > > -- > BOFH excuse #330: > > quantum decoherence Thanks. It looks like some

Re: Lists and Tuples and Much More

2007-04-12 Thread 7stud
> Now I read somewhere that you could change the > list inside that tupple. But I can't find any > documentation that describes HOW to do it. t = (1, 2, ["red", "white"]) t[2][1] = "purple" print t t[2] returns the list, so the second line is equivalent to: lst = t[2] lst[1] = "purple" That is

Re: Lists and Tuples and Much More

2007-04-12 Thread 7stud
> Yes. Tuples are immutable - once created, they can't change. Just to explain that statement a little better. If you do this: t = (1, 2, ["red", "white"]) t[2].append("purple") print t#(1, 2, ['red', 'white', 'purple']) It sure looks like t changed, and therefore t is NOT immutable--and

Re: Calling private base methods

2007-04-12 Thread 7stud
On Apr 12, 2:02 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > "7stud" <[EMAIL PROTECTED]> wrote: > > On Apr 12, 5:04 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > >> "7stud" <[EMAIL PROTECTED]> wrote: > >> > On Apr 12, 2:

mac IDLE problems

2007-04-12 Thread 7stud
Hi, In the IDLE, I can't get most shortcut keys that are listed next to the menu items to work. For instance, under the Format menu item only the shortcuts for "indent region" and "undent region" work. If I highlight some text and use Shift+3 to comment out the region I highlighted, the code is

Re: reading from sys.stdin

2007-04-13 Thread 7stud
Hi, Thanks for the responses. My book, Beginning Python: From Novice to Professional(p. 266) says that "sys.stdin is iterable, just like other files", so I thought I would test it out. However, I don't see how it is acting similar to a file in my example. I assume all input is buffered by defa

Re: reading from sys.stdin

2007-04-13 Thread 7stud
On Apr 13, 3:13 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > I assume all input is buffered by default, so I'm not sure how it > > explains things to say that input from sys.stdin is buffered. > > The difference with sys.stdin is that it has

Re: reading from sys.stdin

2007-04-13 Thread 7stud
On Apr 13, 3:36 am, "7stud" <[EMAIL PROTECTED]> wrote: > > > It is if the file is smaller than the buffer size. > > How is that relevant? > If I put 100 lines of text in a file with each line having 50 characters, and I run this code: import sys lst = [] for

Re: wxPython, mac, wx.HSCROLL not working

2007-04-13 Thread 7stud
On Apr 13, 4:54 am, Bjoern Schliessmann wrote: > 7stud wrote: > > Thanks. It looks like someone asked the same question yesterday. > > No -- it looks like I was a bit stressed and the first google hit or > a direct jump to wxpython.org would have provided the solution :) >

Re: Python editor/IDE on Linux?

2007-04-13 Thread 7stud
Jack wrote: > I wonder what everybody uses for Python editor/IDE on Linux? > I use PyScripter on Windows, which is very good. Not sure if > there's something handy like that on Linux. I need to do some > development work on Linux and the distro I am using is Xubuntu. Everybody uses vim. -- http:

Re: mac IDLE problems

2007-04-13 Thread 7stud
On Apr 13, 10:27 am, Kevin Walzer <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > Hi, > > > In the IDLE, I can't get most shortcut keys that are listed next to > > the menu items to work.  For instance, under the Format menu item only > > the shortcuts for

Re: function/method assigment

2007-04-13 Thread 7stud
On Apr 13, 10:14 am, [EMAIL PROTECTED] wrote: > I have a confusion when I do some practice, the code and output are as > following, > > >>> def fun(): > > print 'In fun()' > > >>> testfun = fun() > In fun() > >>> print testfun > None > >>> testfun2 = fun > >>> print testfun2 > > >>>

Re: function/method assigment

2007-04-13 Thread 7stud
On Apr 13, 10:14 am, [EMAIL PROTECTED] wrote: > what is the > meaning of 'None'? > It's a value just like any other python value: 2, 7.5, "red", and it evaluates to false in a conditional: my_var = None if not my_var: print "bad data" -- http://mail.python.org/mailman/listinfo/python-list

Re: Append data to a list within a dict

2007-04-13 Thread 7stud
On Apr 13, 11:39 pm, Tina I <[EMAIL PROTECTED]> wrote: > Hello group, > > Say I have the following dictionary: > > ListDict = { > 'one' : ['oneone' , 'onetwo' , 'onethree'], > 'two' : ['twoone' , 'twotwo', 'twothree'], > 'three' : ['threeone' , 'threetwo', threethree']} > > Now I want to append 'tw

Re: reading from sys.stdin

2007-04-14 Thread 7stud
On Apr 13, 6:20 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > On Apr 13, 3:13 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: > >> 7stud wrote: > >>> I assume all input is buffered by default, so I'm not sure how it > >&

Re: list comparison help?

2007-04-14 Thread 7stud
On Apr 14, 3:36 am, "Dropkick Punt" <[EMAIL PROTECTED]> wrote: > Hi. I have a list of common prefixes: > > >>> prefixes = [ "the", "this", "that", "da", "d", "is", "are", "r", "you", > >>> "u"] > > And I have a string, that I split() into a list. > > >>> sentence = "what the blazes is this" > >>>

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread 7stud
On Apr 14, 4:42 am, [EMAIL PROTECTED] wrote: > This also is > similar to the C++ "using" keyword which exposes the members of a > namespace to access without specifying the namespace scope for each > reference. For example after giving "using namespace std;" I can > change all references to "std::c

Re: Really badly structured Python Books.

2007-04-14 Thread 7stud
On Apr 14, 12:37 pm, "Andre P.S Duarte" <[EMAIL PROTECTED]> wrote: > I started reading the beginning Python book. It is intended for people > who are starting out in the Python world. But it is really > complicated, because he tries to explain, then after a bad explanation > he puts out a bad examp

Re: reading from sys.stdin

2007-04-14 Thread 7stud
On Apr 14, 7:43 am, Steve Holden <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > On Apr 13, 6:20 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: > [...] > > > But if you hit return on a blank line, there is no error. In other > > words, will stop on a blank lin

Re: Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

2007-04-14 Thread 7stud
On Apr 14, 12:57 pm, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 14, 4:42 am, [EMAIL PROTECTED] wrote: > > > This also is > > similar to the C++ "using" keyword which exposes the members of a > > namespace to access without specifying the namespa

Re: Reading the first line of a file (in a zipfile)

2007-04-14 Thread 7stud
On Apr 11, 1:13 pm, [EMAIL PROTECTED] wrote: > Hi folks, > > The first line in the file I am examining will be a number followed by > more whitespace. Looks like I cannot split by whitespace? > but I get 'cannot open > file' when i try to read from an archive.. ...and that led you to conclude tha

Re: Python editor/IDE on Linux?

2007-04-15 Thread 7stud
On Apr 15, 2:33 am, "Daniel Gee" <[EMAIL PROTECTED]> wrote: > > anything more than line > numbering, simple syntax highlighting, and auto-indent when you hit > enter just doesn't seem necessary. Vim has b and c, but not a. > a: :set nu :set nonu -- http://mail.python.org/mailman/listinfo/python-

Re: reading from sys.stdin

2007-04-15 Thread 7stud
On Apr 15, 10:59 am, Steve Holden <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > On Apr 14, 7:43 am, Steve Holden <[EMAIL PROTECTED]> wrote: > >> 7stud wrote: > >>> On Apr 13, 6:20 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: > >> [...] &

pyparsing Catch-22

2007-04-15 Thread 7stud
To the developer: 1) I went to the pyparsing wiki to download the pyparsing module and try it 2) At the wiki, there was no index entry in the table of contents for Downloads. After searching around a bit, I finally discovered a tiny link buried in some text at the top of the home page. 3) Link

Re: pyparsing Catch-22

2007-04-15 Thread 7stud
On Apr 15, 7:41 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > For as hard as you push pyparsing on this forum, I would think you > > would make it easier to download and install your module. In my > > opinion, the wiki should provide detailed instal

Re: pyparsing Catch-22

2007-04-15 Thread 7stud
On Apr 15, 9:16 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > 7stud <[EMAIL PROTECTED]> wrote: > > 1) Even though the download at sourceforge said the file name was: > > > pyparsing-1.4.6.tar.gz > > > it was downloaded to my Desktop as: > > >

Re: How to initialize a table of months.

2007-04-15 Thread 7stud
On Apr 15, 7:30 pm, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > I'm reading a logfile with a timestamp at the begging of each line, e.g., > > Mar 29 08:29:00 > > I want to call datetime.datetim() whose arg2 is a number between 1-12 so I > have to convert the month to an integer. > I wrote this, bu

Re: How to initialize a table of months.

2007-04-15 Thread 7stud
On Apr 15, 9:30 pm, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 15, 7:30 pm, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: Arrgh. import calendar months = calendar.month_abbr #returns an array with the 0 element empty #so the month names line up with the indexe

Re: Getting started with python

2007-04-16 Thread 7stud
On Apr 15, 9:49 pm, James Stroud <[EMAIL PROTECTED]> wrote: > py> t = timeit.Timer(stmt=s) > py> print "%.2f usec/pass" % (100 * t.timeit(number=10)/10) > 40.88 usec/pass > What does this accomplish: 100 * t.timeit(number=10)/10 that the following doesn't accomplish: 10

Re: pyparsing Catch-22

2007-04-16 Thread 7stud
Paul McGuire wrote: > Me? Push? Boy, a guy posts a couple of examples, tries to help some > people that are stuck with a problem, and what does he get? Called > "pushy"? Sheesh! Hey, I never called you pushy! Ok, maybe I sounded a little harsh--I was pretty frustrated after all. I guess I sho

Re: pyparsing Catch-22

2007-04-16 Thread 7stud
On Apr 16, 2:06 am, "7stud" <[EMAIL PROTECTED]> wrote: > Hmmm. My post got cut off. Here's the rest of it: I'm pretty facile with regex's, and after looking at some pyparsing threads over the last week or so, I was interested in trying it. However, all of

Re: pyparsing Catch-22

2007-04-16 Thread 7stud
Basic Pyparsing Words and Literals -- http://mail.python.org/mailman/listinfo/python-list

Re: pyparsing Catch-22

2007-04-16 Thread 7stud
Word("ABC", "def") matches "C", "Added", "Beef" but not "BB", "ACE", "ADD" That is just baffling. There's no explanation that the characters specified in the first string are used to match the first char of a word and that the characters specified in the second string are used to match the rest o

Re: string methods of a str subclass

2007-04-16 Thread 7stud
On Apr 16, 3:28 am, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > I am probably misunderstanding some basic issue here but this > behaviour is not what I would expect: > > Python 2.4 (#1, Mar 22 2005, 21:42:42) > [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 > Type "help", "copyright", "

Re: string methods of a str subclass

2007-04-16 Thread 7stud
On Apr 16, 3:28 am, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > I would expect all methods operating on a string instance > and returning another string instance Ok, then this: class A(object): def __init__(self, s): self.s = s def strip(self): return self.s class mystr

Re: newbie question: how to read back the dictionary from a file?

2007-04-16 Thread 7stud
On Apr 16, 4:03 am, "lancered" <[EMAIL PROTECTED]> wrote: > Hi Dear all, > > I have some data here in the form of a dictionary, called "vdic". Then > I write them to a data file "f" using the write function as > f.write(str(vdic)). The keys of this dictionary are integers and > values are float

Re: newbie question: how to read back the dictionary from a file?

2007-04-16 Thread 7stud
s.close() -- http://mail.python.org/mailman/listinfo/python-list

Re: Just bought Python in a Nutshell

2007-09-15 Thread 7stud
Used copies of computer books for out of date editions are always cheap. "Python in a Nutshell (2nd ed)" is a reference book with a frustratingly poor index--go figure. It also contains errors not posted in the errata. -- http://mail.python.org/mailman/listinfo/python-list

curses: x, y positioning

2007-09-15 Thread 7stud
I can't see to get any y, x coordinates to work with curses. Here is an example: import curses def my_program(screen): while True: ch = screen.getch() if ch == ord("q"): break if ch <= 255: screen.addstr(30, 10, "*%s*" % chr(ch)) sc

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
On Sep 14, 11:57 pm, Terry Carroll <[EMAIL PROTECTED]> wrote: > I'm trying to use wx.ProgressBar, and the cancel button is not > responding. > > Here is a simple program that exhibits the problem: > > # > import wx > import time > > max = 10

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
Terry Carroll wrote: > I'm trying to use wx.ProgressBar, and the cancel button is not > responding. > > Here is a simple program that exhibits the problem: > > # > import wx > import time > > max = 10 > app = wx.PySimpleApp() > dlg = wx.Prog

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
On Sep 14, 11:57 pm, Terry Carroll <[EMAIL PROTECTED]> wrote: > I'm trying to use wx.ProgressBar, and the cancel button is not > responding. > > Here is a simple program that exhibits the problem: > > # > import wx > import time > > max = 10

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-15 Thread 7stud
Terry Carroll wrote: > > 2) The variable "skip: set to False on the first iteration, and then > set to True on subsequent iterations? Note that this happens even if > no buttons are selected. This is just a weirdness to me, and not my > main concern, but I thought I'd mention it in case it's rele

Re: (wxPython) wx.ProgressDialog - how to cancel out of?

2007-09-16 Thread 7stud
On Sep 15, 5:25 pm, 7stud <[EMAIL PROTECTED]> wrote: >dialog.Destroy() >timer.Stop() >win.Show() # You can also change that last line to win.Destroy(), and then the user will never see the frame. -- http://mail.python.org/mailman/listinfo/python-list

Re: curses: x, y positioning

2007-09-17 Thread 7stud
Hi, Thanks for the response. On Sep 16, 8:41 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > Don't you want mvaddstr? > import curses def my_program(screen): while True: ch = screen.getch() if ch == ord("q"): break if ch <= 255: screen.mvaddstr

Re: curses: x, y positioning

2007-09-17 Thread 7stud
On Sep 17, 7:21 am, 7stud <[EMAIL PROTECTED]> wrote: > Hi, > > Thanks for the response. > > On Sep 16, 8:41 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > Don't you want mvaddstr? > > import curses > > def my_program(screen): > whi

Re: curses: x, y positioning

2007-09-17 Thread 7stud
On Sep 17, 9:50 am, 7stud <[EMAIL PROTECTED]> wrote: > Ok. This works: > > import curses > import curses.wrapper Oops. That second import statement isn't necessary. -- http://mail.python.org/mailman/listinfo/python-list

subprocess: returncode v. poll()

2007-09-20 Thread 7stud
Hi, What is the difference between: 1) getting the returncode directly from the subprocess object 2) calling poll() on the subprocess object? Here is an example: import subprocess p = subprocess.Popen("ls", stdout=subprocess.PIPE) print p.returncode print p.poll() print print p.stdout.read()

Re: subprocess: returncode v. poll()

2007-09-20 Thread 7stud
On Sep 20, 1:17 pm, 7stud <[EMAIL PROTECTED]> wrote: > Hi, > > What is the difference between: > > 1) getting the returncode directly from the subprocess object > 2) calling poll() on the subprocess object? > > Here is an example: > > import subprocess &

Re: subprocess: returncode v. poll()

2007-09-20 Thread 7stud
On Sep 20, 1:25 pm, 7stud <[EMAIL PROTECTED]> wrote: > On Sep 20, 1:17 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > What is the difference between: > > > 1) getting the returncode directly from the subprocess object > > 2) cal

Re: newb: BeautifulSoup

2007-09-21 Thread 7stud
On Sep 20, 9:04 pm, crybaby <[EMAIL PROTECTED]> wrote: > I need to traverse a html page with big table that has many row and > columns. For example, how to go 35th td tag and do regex to retireve > the content. After that is done, you move down to 15th td tag from > 35th tag (35+15) and do regex

Re: subprocess: returncode v. poll()

2007-09-21 Thread 7stud
On Sep 20, 3:24 pm, David <[EMAIL PROTECTED]> wrote: > On 9/20/07, 7stud <[EMAIL PROTECTED]> wrote: > > > > > On Sep 20, 1:25 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > On Sep 20, 1:17 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > >

vim - what's a smarttab?

2007-09-24 Thread 7stud
Is smarttab one of these: 1) Expands tabs into the number of spaces set with tabstop at the start of a line, and uses a tabstop sized tab elsewhere. 2) Expands tabs into the number of spaces set with shiftwidth at the start of a line, and expands tabs into the number spaces set with tabstop elsew

Re: vim - what's a smarttab?

2007-09-24 Thread 7stud
On Sep 24, 4:49 am, Marco <[EMAIL PROTECTED]> wrote: > > > Alternatively, what is a smarttab? > > in VIM type :help smarttab and you'll see the following: > Thanks! I spent an hour hunting around on google with no success. :( Another question if you don't mind. I'm using vim 6.2, and I am tryin

Re: Simple threading example freezes IDLE?

2007-09-27 Thread 7stud
On Sep 26, 5:01 pm, "Sergio Correia" <[EMAIL PROTECTED]> wrote: > > I'm using IDLE 1.2.1, Python 2.5.1, and Tk 8.4. Does anyone has any > idea of why is this happening? > Two mainloops == bad. IDLE == 1 mainloop. your program == 1 mainloop. -- http://mail.python.org/mailman/listinfo/python-lis

Re: unit testing

2007-10-05 Thread 7stud
What are some strategies for unit testing a function that obtains user input? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Test doubles (stubs and mocks) for unit testing (was: unit testing)

2007-10-05 Thread 7stud
On Oct 5, 4:51 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Thanks. -- http://mail.python.org/mailman/listinfo/python-list

raw_input() and utf-8 formatted chars

2007-10-12 Thread 7stud
s = 'A\xcc\x88' #capital A with umlaut print s #displays capital A with umlaut s = raw_input('Enter: ') #A\xcc\x88 print s#displays A\xcc\x88 print len(input) #9 It looks like every character of the string I enter in utf-8 is being interpreted literal

Re: raw_input() and utf-8 formatted chars

2007-10-12 Thread 7stud
On Oct 12, 1:18 pm, [EMAIL PROTECTED] wrote: > On Oct 12, 1:53 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > s = 'A\xcc\x88' #capital A with umlaut > > print s #displays capital A with umlaut > > > s = raw_input('Enter: ') #A\xcc\x

Re: raw_input() and utf-8 formatted chars

2007-10-12 Thread 7stud
On Oct 12, 2:43 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > You mean literally!? Then of course I get A\xcc\x88 because that's what I > entered. In string literals in source code the backslash has a special > meaning but `raw_input()` does not "interpret" the input in any way. > Th

groupby() seems slow

2007-10-15 Thread 7stud
I'm applying groupby() in a very simplistic way to split up some data, but when I timeit against another method, it takes twice as long. The following groupby() code groups the data between the "" strings: data = [ "1.5","","2.5","3.5","4.5","","","5.5","6.5","", "1.5","","2.5","3.5","4.5","","",

Re: transmit an array via socket

2007-10-27 Thread 7stud
On Oct 26, 11:52 pm, "Jeff Pang" <[EMAIL PROTECTED]> wrote: > I want to transmit an array via socket from a host to another. > How to do it? thank you. > Try this: client: --- import socket s = socket.socket() host = 'localhost' port = 3030 s.connect( (host, port) ) arr = [1, 2, 3] for elm

Re: raw_input() and utf-8 formatted chars

2007-11-01 Thread 7stud
On Oct 13, 12:42 pm, MRAB <[EMAIL PROTECTED]> wrote: > You can > decode that into the actual UTF-8 string with decode("string_escape"): > > s = raw_input('Enter: ') #A\xcc\x88 > s = s.decode("string_escape") > Ahh. Thanks for that. >On Oct 12, 2:43 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECT

sockets: why doesn't my connect() block?

2007-11-17 Thread 7stud
According to "Python in a Nutshell(2nd)", p. 523: connect: s.connect((host, port)) ... Blocks until the server accepts or rejects the connection attempt. However, my client program ends immediately after the call to connect()--even though my server program does not call accept(): #server-

Re: sockets: why doesn't my connect() block?

2007-11-18 Thread 7stud
On Nov 18, 8:18 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Sat, 17 Nov 2007 21:32:50 -0800 (PST), 7stud <[EMAIL PROTECTED]> wrote: > >According to "Python in a Nutshell(2nd)", p. 523: > > >connect: s.connect((host, port)) > >... >

Re: sockets: why doesn't my connect() block?

2007-11-18 Thread 7stud
On Nov 18, 10:40 am, 7stud <[EMAIL PROTECTED]> wrote: > If it accepted > the connection, then why do I have to call accept()? That should read: If my platform accepted the connection, then why does my server program have to call accept()? -- http://mail.python.org/mailman/listinfo/python-list

Re: sockets: why doesn't my connect() block?

2007-11-18 Thread 7stud
On Nov 18, 3:08 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > ...listen() gets > the initial connect() packet. accept() then is used to transfer the > connection onto a /new/ work socket (freeing the listen socket to catch > more connections) > Thanks. -- http://mail.python.org/mailman/lis

Re: Problems getting Python scripts to run on server

2008-01-23 Thread 7stud
On Jan 23, 8:41 pm, Yansky <[EMAIL PROTECTED]> wrote: > Hi, I'm having a lot of problems getting any Python scripts to run on > my website. I have put them in the cgi-bin directory and chmodded both > the directory and files to 755. But when I try to access the script, I > get a 404 error:http://fo

Re: Some questions about decode/encode

2008-01-24 Thread 7stud
On Jan 24, 1:44 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 23 Jan 2008 19:49:01 -0800, glacier wrote: > > My second question is: is there any one who has tested very long mbcs > > decode? I tried to decode a long(20+MB) xml yesterday, which turns out > > to be very strange an

Re: Problems getting Python scripts to run on server

2008-01-24 Thread 7stud
On Jan 23, 11:30 pm, 7stud <[EMAIL PROTECTED]> wrote: I just wanted to point out that the tag below would go in the httpd.conf file(a config file for apache), which you apparently do not have access to. I was suggesting that you check with your host to make sure they have the

type, object hierarchy?

2008-02-03 Thread 7stud
print dir(type) #__mro__ attribute is in here print dir(object) #no __mro__ attribute class Mammals(object): pass class Dog(Mammals): pass print issubclass(Dog, type) #False print Dog.__mro__ --output:-- (, , ) The output suggests that Dog actually is a subclass of type--desp

Re: type, object hierarchy?

2008-02-03 Thread 7stud
On Feb 3, 10:28 pm, 7stud <[EMAIL PROTECTED]> wrote: > From the docs: > > issubclass(class, classinfo) > Return true if class is a subclass (direct or indirect) of classinfo. print issubclass(Dog, object) #True print issubclass(type, object) #True print issubclass(Dog, type)

Re: type, object hierarchy?

2008-02-03 Thread 7stud
On Feb 3, 9:06 pm, Jason <[EMAIL PROTECTED]> wrote: > On Feb 3, 8:36 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > > > print dir(type)      #__mro__ attribute is in here > > print dir(object)   #no __mro__ attribute > > > class Mammals(object): >

Re: type, object hierarchy?

2008-02-04 Thread 7stud
On Feb 4, 12:49 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > 7stud <[EMAIL PROTECTED]> writes: > > --output:-- > > (, , ) > > > The output suggests that Dog actually is a subclass of type--despite > > the fact that issubclass(Dog, type) returns False. &

Re: type, object hierarchy?

2008-02-04 Thread 7stud
Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: counting lines using fileinput module

2008-02-13 Thread 7stud
On Feb 13, 6:47 pm, Robert <[EMAIL PROTECTED]> wrote: > I would like to count lines in a file using the fileinput module and I > am getting an unusual output. > --- > --- > #!/usr/bin/python > import fileinput > > # cycle thro

Re: non-uniform string substituion

2008-02-13 Thread 7stud
On Feb 13, 4:03 pm, Horacius ReX <[EMAIL PROTECTED]> wrote: > Hi, > > I have a file with a lot of the following ocurrences: > > denmark.handa.1-10 > denmark.handa.1-12344 > denmark.handa.1-4 > denmark.handa.1-56 > > ... > > distributed randomly in a file. I need to convert each of this > ocurrences

sockets -- basic udp client

2008-02-15 Thread 7stud
My question pertains to this example: #!/usr/bin/env python import socket, sys, time host = sys.argv[1] textport = sys.argv[2] s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: port = int(textport) except ValueError: # That didn't work. Look it up instread. port = socket.ge

Re: Help Parsing an HTML File

2008-02-15 Thread 7stud
On Feb 15, 2:28 pm, [EMAIL PROTECTED] wrote: > Hello Python Community, > > It'd be great if someone could provide guidance or sample code for > accomplishing the following: > > I have a single unicode file that has  descriptions of hundreds of > objects. The file fairly resembles HTML-EXAMPLE paste

Re: sockets -- basic udp client

2008-02-16 Thread 7stud
On Feb 15, 6:48 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 15 Feb 2008 20:24:19 -0200, 7stud <[EMAIL PROTECTED]>   > escribió: > > > > > My question pertains to this example: > > > #!/usr/bin/env python > > > i

Re: sockets -- basic udp client

2008-02-16 Thread 7stud
On Feb 16, 6:18 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Here is the example above converted to a more straightforward udp > client that isolates the part I am asking about: > > import socket, sys > > host =  'localhost'

Re: sockets -- basic udp client

2008-02-16 Thread 7stud
On Feb 16, 6:32 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > >> That example is plain wrong; looks like some TCP code but with   > >> SOCK_STREAM   > >> blindy replaced with SOCK_DGRAM. connect, sendall and recv are not used   > >> for UDP; sendto and recvfrom are used instead. There are so

Re: class static variables and __dict__

2008-02-16 Thread 7stud
On Feb 16, 5:03 pm, Zack <[EMAIL PROTECTED]> wrote: > Dustan wrote: > > On Feb 16, 4:40 pm, Zack <[EMAIL PROTECTED]> wrote: > >> what method can you use on x to find all available > >> attributes for that class? > > class Foo(object): > >    bar = "hello, world!" > >    def __init__(self, baz)

Re: Tkinter. Why the Need for a Frame, or no Frame?

2008-02-17 Thread 7stud
On Feb 16, 8:40 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > The following two examples are from Grayson's book on Tkinter. He's making a > simple dialog with three buttons. In the first example, he does not use the > Frame class, but in the second he does. Doesn't the first example need a > contai

Re: sockets -- basic udp client

2008-02-17 Thread 7stud
On Feb 17, 12:15 pm, [EMAIL PROTECTED] (Douglas Wells) wrote: > > For example: > > > import socket, sys > > > host =  'localhost'  #sys.argv[1] > > port = 3300 > > s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > > > s.settimeout(1.0) > > buf = '' > > > data = 'hello world' > > num_sent = 0 >

Re: Tkinter Confusion

2008-02-17 Thread 7stud
[EMAIL PROTECTED] wrote: > Do I use > Tk() or toplevel()? (Support for both and if a cogent explanation of > the differences exists, I didn't find it.) > If you close the window created by Tk(), the program terminates. If you close a window created by Toplevel() only that window closes. The Tk()

Re: Tkinter Confusion

2008-02-17 Thread 7stud
On Feb 17, 12:36 pm, [EMAIL PROTECTED] wrote: > Everything I've read about Tkinter says you create your window and > then call its mainloop() method. But that's not really true. This is > enough to launch a default window from the console: > > >>>from Tkinter import * > >>>foo = Tk() > You shouldn

Re: CSV module: incorrectly parsed file.

2008-02-17 Thread 7stud
On Feb 17, 7:09 pm, Christopher Barrington-Leigh <[EMAIL PROTECTED]> wrote: > Here is a file "test.csv" > number,name,description,value > 1,"wer","tape 2"",5 > 1,vvv,"hoohaa",2 > > I want to convert it to tab-separated without those silly quotes. Note > in the second line that a field is 'tape 2"'

Re: CSV module: incorrectly parsed file.

2008-02-17 Thread 7stud
On Feb 17, 9:11 pm, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 17, 7:09 pm, Christopher Barrington-Leigh > > > > <[EMAIL PROTECTED]> wrote: > > Here is a file "test.csv" > > number,name,description,value > > 1,"wer","tape

Re: Tkinter Confusion

2008-02-18 Thread 7stud
On Feb 18, 1:41 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Most of the other questions have already been answered, so I'll tackle > this one: > > On Feb 17, 8:36 pm, [EMAIL PROTECTED] wrote: > > > Google's great, but it has no truth meter. Do I inherit from Frame? Or > > is that a big mis

Re: decode Numeric Character References to unicode

2008-02-18 Thread 7stud
On Feb 18, 3:20 am, William Heymann <[EMAIL PROTECTED]> wrote: > How do I decode a string back to useful unicode that has xml numeric character > references in it? > > Things like 占 BeautifulSoup can handle two of the three formats for html entities. For instance, an 'o' with umlaut can be represe

Re: decode Numeric Character References to unicode

2008-02-18 Thread 7stud
On Feb 18, 4:53 am, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 18, 3:20 am, William Heymann <[EMAIL PROTECTED]> wrote: > > > How do I decode a string back to useful unicode that has xml numeric > > character > > references in it? > > > Things like 占 #

<    1   2   3   4   5   6   >