#python - Fri 16 Mar 2007 between 00:02 and 00:30

NY Lost Funds



JosefAssadah, infinite loop. My bad
JabapythqwertyuiopasdfghjkZxcvbnm,1234567890!@#$%_&*-+=,'.
jonesyI have a 'server' object. It has methods 'getip', 'getname', etc. My client program can call 'server.getip', or 'server.getname', but I'd like to assign 'prog = sys.argv[0]' and then call 'server.prog'. However, I don't know how to make 'prog' be interpreted as a variable instead of a method. Clues?
so, for example, calling 'server.prog' results in a 'method not defined' error.
I want the variable 'prog' to be interpreted before the call is made.
dsturnbulleval(sys.argv[1]+'()')
jonesyI don't understand.
JafetYou want to convert a string to a variable?
frostschutzany way to import a mysql export .sql file from within python?
Roach4Hi. I'm forced to use windows and I'm writing a little app to transfer files from an host to another. I would like to be able to show statistics that get updated in real time in the console. Since I'm using windows I can't use Curses... what else could be used ? Is there a way to print things on a specific line in a console ?
jonesyno. Here's the thing. I set 'prog = sys.argv[0]' because I want the program to behave differently based on how it's called. If it is called as 'getip', then I want the client to connect to my server by calling the 'server.getip' method. However, you can't just call 'server.prog', because 'prog' isn't a method, it's a variable. I want that variable to be interpreted so the call goes across to the server as 'server.getip' instead of 'serv
dsturnbulleval('server.%s()' % prog) :P
jonesywha? There has to be something cleaner. Lemme try another example.
in python, can you have variable method calls? So, the method call is actually the value of a variable?
Jafetdef foo(): pass; bar = 'foo' #You mean you want to call foo from bar?
Jerubjonesy: that's an intesring question that is obviously burdened with a broken set of thinking about computer programs.
jonesyjerub: I'm willing to be educated if that doesn't involved being completely flamed and humiliated.
Jerubjonesy: in a real computer language (like python) functions are data in exactly tehe same way that numbers, strings, and database connections.
jonesy: hey, a backbone, awesome. :)
Roach4Hi. I'm forced to use windows and I'm writing a little app to transfer files from an host to another. I would like to be able to show statistics that get updated in real time in the console. Since I'm using windows I can't use Curses... what else could be used ? Is there a way to print things on a specific line in a console ?
JafetIn other words, functions are first-class objects.
dsturnbulljonesy, is server an xmlrpc object?
Jerubso hey, once you define a function, it actually exists in your current namespace as an object.
jonesydsturnbull: how'd you guess? ;-)
Jerubso you can pass it around just like any old object.
dsturnbulli don't think xmlrpc server methods exist in the namespace
Jafetjonesy: I think the class methods sort of gave it away, eh.
jflashremember what you learned in programming kindergarten ? " functions are first class citizens in the city of Python"
Jerubheh
Roach4please... anyone?
jonesythe method is one that's defined in my SimpleXMLRPCServer object. I defined it. I want to call it from my client. I can do that if I say 'print server.getip', but I want the method name to be variable.
JafetRoach4: Obviously you need a terminal library of some sort. There is a seperate curses library distributed for Windows; however you can also use the Tkinter GUI or wxPython, among other libraries.
Eleafare you around deltab ?
jonesyI guess this would be similar to using a pointer variable to functions in C.
EleafI just need to know how to make the background of a graph created with matplotlib/pylab to be transparent (png).
I'm not sure where I set the alpha value for the whole background.
Roach4Jafet, i'll have to do a little demo of my app on a computer on which I can't install anything, so will wxPython work with the default python installation?
JafetRoach4: If you can't install anything, there isn't really much you can do.
jonesystuff like this has been done in the UNIX environment for 30 years. You write a program, you make symlinks to that program, and you can call one of those symlinks from the command line. The actual binary that runs knows what name it is being called by, and acts appropriately.
Roach4Jafet, doesn't wxPython come with the default python package?

Page: 2 9 16 23 30 37 44 51 58 65 

IrcArchive

NY Lost Funds