@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16



Comments:

<0> thanks in advance
<1> No1CaNTeLL: see ftplib
<2> No1CaNTeLL: require 'net/ftp'
<1> tirkal: eh?
<2> oh, sorry :)
<2> sanmarcos: (wrong channel)
<2> No1CaNTeLL: import ftplib; help(ftplib)
<1> just google ftplib
<3> sanmarcos, your code seems to have worked as advertized. Now I can get the correct dir for my script no matter what OS or if it is .py or .exe ... exactly the fix I needed. Thanks
<1> :)
<2> sanmarcos: help(ftplib) is simpler
<0> ty guys, will do
<4> eep
<4> its workingish
<4> just really strangely
<4> how would u monitor a file



<1> thats os specific
<4> and then post any change that happens
<1> you could read it every once in a while
<1> afaik, Windows probably uses some API that surely isnt included in win32api of python
<1> linux uses inotify, which can be used with dbus, afaik
<4> iim lookin for a way to do it all the time and only post changes
<1> you'd have to check the file everyonce in a while
<1> you could do a threaded while loop
<4> okai
<4> thanks
<1> if you are using gui you most certainly will end up using threads, and threads ****ing you
<5> IIRC, inotify is a kernel config?
<3> tirkal, You had tried to help me get my socket server connecting without success, I started over and avoided a threading problem. When in doubt try again?
<1> mundohosting: inotify is been in the kernel since 2.6.13 or so (not sure)
<1> and yes, it is a kernel config
<2> Cowmosher_: so you managed to getting it working? what exactly was the problem?
<3> tirkal, exactly I am not sure, but it seemed to be in how I had it using a threaded while loop
<5> maybe debian sarge would have to upgrade kernel then. It comes with 2.6.8 IIRC...
<5> users*
<2> Cowmosher_: might be a Windows issue.
<1> sarge wont get upgrades
<1> just security
<1> if you want a recent system use sid
<1> or etch
<5> Yes, I meant "maybe debian sarge users..."
<5> my mistake
<1> anyways, nobody uses inotify
<1> just beagle, which rocks
<1> as does the latest monodevelop shame there isnt something like that for python
<5> yes, but it consumes to much memory
<5> at least las time i checked
<6> except for using all system resources thing :)
<1> beagle? they are fixing it
<6> fixing != fixed.
<1> well open source will never be perfect
<6> bull
<6> there's lots of really good open source software.
<5> Yes there is :)
<1> no software is perfect, and open source software needs polishing
<4> instead of opening a file off of a local machine is it possible to make it open one off of the internet
<1> kevinish: depends what protocol, for http use urllib, ftplib, poplib, so on
<4> k thanks
<7> if you want to just open it for sequential reading for http, it's easy
<3> I would like to have my script access a user log-on at zoneedit.com. Can I p*** the required args to the url or is there a SSL issue to be addressed?
<1> Cowmoo: you could p*** them as user@p***:host
<1> unless its https
<3> I think https
<1> but I am sure there is something out there for that
<7> cowmosher: btw, zoneedit supports simple dynamic dns updating, too
<1> and there are thousands of python clients out there that do the job
<3> kirma, how do you mean? easier I'm hoping
<1> you could just steal their code
<7> http://www.zoneedit.com/doc/dynamic.html
<7> probably one urllib2 open line on perl, anyway
<7> checking return value is good idea, of course.
<7> err, in python
<3> kirma, yes, it is the 'requires basic auth' part that puzzles me
<7> cowmosher: http://docs.python.org/lib/urllib2-examples.html maybe
<7> basic authentication part
<7> more complex than it should be
<3> TY



<7> hth
<8> Anyone know what I'd use in Python to get "unix" style time? (i.e. seconds since 11:59:59 12/31/1969)? time.time() returns a float, and I can't find specified anywhere what it ***umes is Python's "epoch".
<9> time.time(), possibly int-ized if you need a pure int.
<2> sbalneav: iirc it uses the regular unix epoch
<8> ah, so it's epoch is the same as Unix's? Just need to cast int. Cool, thanks.
<8> Thought maybe it was # seconds since Guido's birth :)
<1> datetime.datetime is cool
<9> I think most Python routines that will accept that sort of timestamps will take the float form.
<9> Coincidentally, I was just looking at the jargon file entry for that today.
<10> wow
<11> is this valid : list1[list2[],list3[],list4[]] ?
<9> I don't believe 'list2[]' is valid syntax...
<11> but I can have lists of lists ?
<9> Yes.
<12> yes, you can.
<1> yes
<12> [ [1, 2, 3], [4, 5] ] or whatever
<9> You can put anything in a Python container type (lists, dictionaries, etc).
<11> how do initialise a list of empty lists ?
<8> Night all
<9> list1 = [[], [], []]
<11> right.
<1> right
<1> and you can access them like list1[1]
<11> then list1[1] would be the first list in list1 ?
<1> which type() should give as a list
<1> yes
<1> it gets fun with loops
<9> List comprehensions for extra bonus fun. :)
<1> They'rrrr grrreeeat!!
<12> maatttt: if you want something like a list of 100 empty lists, you could do [ [] for i in range(100) ] or something.
<13> and, for bonus marks, what does 'a=[[]]*3; a[0].append(1)' do ?
<12> rather than doing [ [], [], ... until the end of time
<9> roryy: not what you probably expect. :)
<9> (well, people in general)
<11> and is this python's array ?
<9> yes.
<13> it's better to call it a list; there are other things called arrays
<11> right, list it is.
<9> I once made that particular mistake while initializing instance variables; I was thinking too much C at the time. self.a = self.b = {} can lead to some very peculiar bugs.
<1> self.a, self.b = {}
<1> ***ociative arrays = dicts
<12> Chris_S: that screws stuff up?
<1> I recommend you read the chapter on list comprehensions of Dive Into Python
<1> but soon i'll Dive into Bed
<9> gzl: yes. Both self.a and self.b are referring to the *same* dict, which was not what I expected. When I did self.a[newkey] = bar, and newkey showed up in self.b, it was ... surprising. (The two had overlapping key spaces, for more fun; otherwise I might not have noticed.)
<12> ah, hrm. I should make sure I don't do that.
<12> otherwise I tend to do things like a = b = [].
<9> Yeah. That'll blow up in your face. :(
<12> I suppose a, b = [], [] isn't too much worse.
<12> as long as it comes with the major added benefit of not blowing up in my face.
<1> how can I escape a % when using % () ?
<1> print "pedo %s:%d%" % ("hey", 22) (as in wanting to do percentages) ?
<14> %%
<14> "%d%%" % (22,) == "22%"
<1> thanks
<14> no problem :)
<15> Does anyone want to help me with my open source program? It is written in Python and C++, and I would like people to download it and report to me their success w.r.t. compiling it. It is at http://gsculpt.sourceforge.net. In order to compile gSculpt you only need python and boost::python; the other dependencies are only required to run the program. Any help is much appreciated.
<15> Come to think of it, it would be helpful if people could try running and, and try a little basic test to ensure that it all works as expected.
<1> if I import a module, will that module's imported modules be available in my app?
<15> sanmarcos: Try it :)
<15> sanmarcos: Most probably.
<9> sanmarcos: the modules that the first module imported are visible in its namespace. If you do a 'from module import *' (and it doesn't block them) they'll show up in yours.
<9> There are various somewhat peculiar uses of fishing into other modules' namespaces and playing around with them.
<13> MrMeanie: i'll give it a bash; it's going to take a while to download boost (yay for dialup)
<1> I mean if in a file I have import os, and I import that file as a module, in my app do I need to do import os again?
<15> roryy: Thanks!
<13> i would. importing is cheap once the module is already loaded
<9> sanmarcos: yes, more or less.
<16> sanmarcos you can, your can us "mymodule.os"
<13> i suspect os, sys and the like are always loaded anyway


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

#javascript
multivers dapper
#lisp
umbutu how to open terminal
#perl
ubuntu jpegtopnm
fedora mozilla jrel
zaydana
#debian
DAILY QUOTA REPORT:



Home  |  disclaimer  |  contact  |  submit quotes