| |
| |
| |
|
Page: 1 2
Comments:
<0> hrm <0> OK, I trashed my install of fink and have re-installed python, pyGTK2 and all's well <0> but... <0> I get this message <0> from _gtk import * <0> RuntimeError: could not open display <0> oops, sorry hund <1> I'm sure it's easier for people to help if you include more context in a paste. <0> ok one sec <0> http://rafb.net/paste/results/yR8AK555.html < this is what I tried running <0> and I got a message from gtk saying it couldn't connect to display and I'm running OS X <0> and yes I have/had X11 running <0> now is there some option I need to p*** for it to connect to X11 ? <1> And xterm or another X11 app from the same shell runs fine? <0> let me check I'm pretty sure yea <1> If so, I can't help much.
<0> if it didn't? <1> Then I could tell you to ask an OSX person about getting X11 to work. :) <0> what I do know is that the python compiler install from http://www.activestate.com/ had pythonw (for GUIs) <0> but I used fink to grab the latest python instead :) <0> ah heh...X11 works but hrm <0> ok diff question <0> how come X11 seems to load a different 'shell 'than oh duh brb <0> ok right <0> X11 seems to load a different .bashrc whatever (env variables <0> i.e. if I run python there it loads up v2.3.5, In Terminal I get the new 2.4.2 (installed in /sw which is the Fink directory) <1> Did you install pyGTK from Fink? <0> yup <1> Fink doesn't seem as streamlined as it should be, it would seem. People keep having trouble with it. <2> yep <2> the only exposure I have to it is people complaining about it here <0> well it was straight forward tbh <2> which they do frequently <0> did a fink install python, then pygtk2-py24 whatever <0> now I'm doing a fink of glade2 <0> woot got it working <0> 'export display=:0' :D <3> i love when you pull on the bowl/bong/whatever just right and a little smoke ring pops off the top of the bowl... or out of the carb... <2> uh, that's nice <4> does anyone remember a long time ago when I asked about getting errors for nonblocking sockets? <4> I know how to do it now :p <2> what did you do <4> sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) <2> get? <4> apparently.. <4> this is what "man connect" told me to do <5> ate..too..much <1> Two fingers down your throat, then. :) <5> exactly (ate chicken fingers) <6> re <5> I am ***uming this is invalid: popen2.popen2('cmd /c fix.bat') <5> i mean, I know fix.bat works, and cmd /c works, hehe <5> os.system will work <5> (security isn't an issue if someone's about to respond with that) <6> I don't know about popen2 on Windows really but are you sure the command line is p***ed to the shell? <6> on Unix, it is <6> but basically if it works similarly on Windows platform, you could just popen2.popen2 ("fix.bat") <5> yeah, that didn't work with popen2 <6> or if I'm right, you could try popen2.popen2 ("c:\winnt\cmd.exe /c fix.bat") <5> not sure why <6> (with double backslashes, though) <5> it doens't matter now, it works andI'm done with that client's bs <5> :) <6> ah, all right <5> thanks though <6> I was just guessing for fun then :) <5> haha <7> uhm.. how does that whole "p*** by reference" thing work in python? i have called a function with an empty list as a parameter, hoping to fill it up with data - but to no avail [vertices = [] \n load(vertices) <- yields empty set after load] <6> basically everything is "p***ed by reference", or pointed to <7> any idea on why that doesn't work then? <4> when you do ***ignment on a variable, it replaces the variable with a reference to a new thing instead of modifying the old thing <6> it should work; however, are you ***igning to the variable pointing to the list in load() ? <6> def add (seq): seq.append (1) <6> foo = [] <6> add (foo) <6> print foo <6> That prints [1]
<7> yes <7> hmz.. i wrote some test-function, and it worked there.. :/ <6> then off you go narrowing down the problem :) <7> the list i'm trying to fill is a list with lists, does that have consequence? <6> basically no <6> hard to say without seeing the code <6> though <7> i'll paste it in a sec.. <6> => http://rafb.net/paste/ <7> http://rafb.net/paste/results/WrCStt89.html <7> the problem is at line 190 something - even accessing Edges[0][0] yields empty set <7> but if i try accessing it at the end of the loadgraphfile-thingy - it works just fine <6> you ***ign to Edges on line 150 <7> i'm sorry about the messy code, and whatever junk you may find.. it's my first attempt at python, if that makes it any easier to forgive :p <7> yes. initially to -1 on line 150 <6> basically, when loadGraphFile() is called, a variable called "Edges" is _bound_ to the list you give to it as a parameter <7> later on i fill the defined edges with weights, thus leaving each undefined edge as -1 <7> that was what i was hoping for <6> if you then ***ign to "Edges", the variable now points to the new list <7> uhm.. i don't follow <6> the old list, given as a parameter, becomes inaccessible and isn't touched anymore <7> in main i make a list, i then p*** it as a parameter to loadgraphfile <7> in loadgraphfile i alter the list <6> no, you first replace the value of "Edges" with a new list on line 150 <6> which is what you alter <7> uh <7> damn <7> heh <6> it'd be pretty easy to just return the filled in lists and never give any of them as parameters anyway <7> in a tuple you mean? <7> like "return (vertices, edges)"? <6> or alternatively, you could rewrite line 150 as an iteration that appends a list of no_nodes "udef"s to the "Edges" list no_nodes times <6> Yes. (Or just return vertices, edges <6> ) <6> and then call it like: <7> indeed - that was kind of embarr***ing :S <6> Vertices, Edges = loadGraphFile (sys.argv[1]) <7> i'll do it like that i guess - seems more appropriate <6> we can go through the appending thing too, but it feels unpythonic <6> i've never probably done that myself in Python. Very commonly in C++ though :) <7> i'm not following? <7> what's with the append() thing? <6> well, instead of line 150 you could do something like: <6> (if I remember correctly, I closed the browser already) <8> how does python free objects that are circuarily referenced.. it just has reference counts..? <6> for i in range (no_nodes): <6> Edges.append ([udef for _ in range (no_nodes)]) <7> yes, but that's the same thing - right? <7> except you can p*** edges by reference and fill it like that <6> Neutrino: not the same thing. In the latter version you indeed modify the original list p***ed in as a parameter. The "return" approach creates a new list which is then returned <6> ludde: by following the references in order to track whether a set of objects refer to themselves only <6> (and not any GC root) <7> hmm.. i misunderstood your intention about stating " go through append thing - feels unpythonic" - i thought you felt that my making of "edges" inside loadgraphfile was unpythonic, not the p***ing of an array to be filled <6> yeah <8> yason: I thought python didn't have a garbage collector as-such? <8> that sounds like a garbage collector <6> Neutrino: p***ing in arrays is unpythonic. Additionally, it means that the function has side-effects which is generally bad <7> uh.. i like side-effects :p <6> ludde: Python has a GC based on reference counting with cycle detector <8> okay <6> Neutrino: side-effects make your functions functions of the calling state <7> i've altered it to return a tuple - it works fine now :) <6> Neutrino: it's a good way to work :) <7> thank you for your help btw <7> :) <6> np <6> once in a while I learn something myself too <6> while teaching <1> Learning by teaching is underrated. <6> Ditto. Propelled by sayings such as: "Those who can, do. Those who can't, teach." <6> It's true in a sense: if you already know something really well, you're better off doing it and you'd probably be too hasty to teach well anyway <1> Figuring something out because someone's waiting is far more effective for me than figuring it out because I'll need it in an exam two months later. <6> but everybody should have lots of things "on the works" all the time, making them good candidate subjects for teaching (and thus learning more) <6> Yes. And sometimes you think you know something but once you start explaining it, you'll find a lot of questions yourself first
Return to
#python or Go to some related
logs:
scramble 8300hd #computers #computers #windows #stocks #sex #worldcup #firebird #dsl extra time for ejectulation
|
|