|
ctz posted:You need to be at least in the local admins group on NT to use raw sockets. What is the alternative to this? Can I ping without raw sockets? I mean I guess I could wrap ping.exe or unix ping, but that is fairly loving annoying. All I want to do is ping(address) and return -1 (timeout) or an integer of ms. Is there a library that does this?
|
# ? Sep 11, 2009 20:00 |
|
|
# ? May 9, 2024 18:51 |
|
haywire posted:What is the alternative to this? Can I ping without raw sockets? I mean I guess I could wrap ping.exe or unix ping, but that is fairly loving annoying. All I want to do is ping(address) and return -1 (timeout) or an integer of ms. Is there a library that does this? The author of the book Python for Unix and Linux System Administration uses subprocess for it. Here's his code: http://code.noahgift.com/pycon2008/pycon2008_cli_noahgift.zip I guess he also uses scapy, you could try with that, not sure if it requires root or not. deimos fucked around with this message at 21:09 on Sep 11, 2009 |
# ? Sep 11, 2009 21:03 |
|
I am a clueless wannabe coder. I picked up Python in 2007 for about 6 months at the recommendation of a friend of mine, but dropped it when I moved. Just starting to pick it back up again. I've been reading over the man pages on the python website, and it's all great refresher. Couple of questions. 1. Should I just give up and install a Linux flavor if I really want to get back into teaching myself Python? (And how to code, in general) 2. How are GUIs created in Python? Or are they, even? 3. Is it hopeless to start coding at 30? I love reading over code, I love spending hours in Python (iPython ), and I know I like listening to my friends discuss development, though I can't contribute anything meaningful. Did I pretty much miss the boat by not being locked in my room at 15 and teaching myself to program then?
|
# ? Sep 12, 2009 09:15 |
|
RobotEmpire posted:I am a clueless wannabe coder. I picked up Python in 2007 for about 6 months at the recommendation of a friend of mine, but dropped it when I moved. Just starting to pick it back up again. I've been reading over the man pages on the python website, and it's all great refresher. 2. I've used tkinter before and it seems to be fine for a lot of purposes, but you can also use python bindings for something more fully featured: Some people have said pyqt is good, I've also heard wxPython is good. 3. It's never too late to start learning something new, just take a crack at it until you find your ground, then come up with a (or pick an existing) project to work on. If you get stuck, google is your friend, and failing that you can always ask people here.
|
# ? Sep 12, 2009 09:22 |
|
RobotEmpire posted:I am a clueless wannabe coder. I picked up Python in 2007 for about 6 months at the recommendation of a friend of mine, but dropped it when I moved. Just starting to pick it back up again. I've been reading over the man pages on the python website, and it's all great refresher. 1. You don't need Linux at all. I do all my Python coding in Windows. 2. Python has multiple GUI libraries, checkout WxPython or PyQt. 3. I couldn't tell you since I started coding at 16, but what I do know is that the best way to get started is to find a project and stick with it.
|
# ? Sep 12, 2009 09:26 |
|
I'm working on something simple with Twitter. I'm beyond the "hello, world" phase, and all that stuff. We'll see. I'll probably be back. edit: Holy poo poo this Twitter library is awesome. edit2: Everything is going to be awesome for a couple of weeks. RobotEmpire fucked around with this message at 09:55 on Sep 12, 2009 |
# ? Sep 12, 2009 09:32 |
|
RobotEmpire posted:1. Should I just give up and install a Linux flavor if I really want to get back into teaching myself Python? (And how to code, in general) gently caress no! Don't make it any harder than it needs to be. Python is excellent on windows. quote:2. How are GUIs created in Python? Or are they, even? A library called Tkinter is the easier one. It's a python version of Tk. quote:3. Is it hopeless to start coding at 30? I love reading over code, I love spending hours in Python (iPython ), and I know I like listening to my friends discuss development, though I can't contribute anything meaningful. Did I pretty much miss the boat by not being locked in my room at 15 and teaching myself to program then? Nope. I've seen plenty of people who code who still haven't taught themselves how to do it, so there is plenty of time to do so.
|
# ? Sep 12, 2009 10:12 |
|
RobotEmpire posted:2. How are GUIs created in Python? Or are they, even? People have chimed in well on all points, but I thought a little clarification was needed here. The only "official" GUI stuff (i.e. thats in the standard library) is Tkinter. I think you have to have Tk separately installed on your system to use it. Some decent apps have been done in it, but there's a general feeling that it's a bit raw / primitive / looks like rear end. Still it might be a good point to start. Obviously, mileage varies. WxPython is probably the most popular outside toolkit. Sometimes, it too can look like rear end. PyQt is arguably the nicest looking, although you may not like the GUI paradigm it imposes. There's also PyGTK. Less in the GUI mold and more in visualization is Nodebox, which is a Python version of Processing.
|
# ? Sep 12, 2009 20:12 |
|
I'm putting the cart way ahead of the horse. I mean I'm still trying to remember what methods, models and classes are.
|
# ? Sep 12, 2009 20:29 |
|
RobotEmpire posted:1. Should I just give up and install a Linux flavor if I really want to get back into teaching myself Python? (And how to code, in general) 1. Python is great on Windows. 3. I decided to learn Python this summer. I'm 31, and while I'm no elite hacker dood, I haven't had any problems.
|
# ? Sep 13, 2009 00:07 |
|
An update on the named pipe parsing issue, according to comp.lang.python 2.6's io module is pure python but 2.7's is C based. I will test trunk on monday and see how it behaves and update you guys. as a sidenote to this, what's the best way to test trunk without disrupting the rest of the system? Download, compile then ????
|
# ? Sep 13, 2009 02:39 |
|
deimos posted:as a sidenote to this, what's the best way to test trunk without disrupting the rest of the system? Download, compile then ????
|
# ? Sep 13, 2009 02:57 |
|
Scaevolus posted:I'd just run python from the source directory, it's the easiest way. Guessing set pythonpath to the build directory and run the local python executable? Testing on production servers is awesome. (Only testing on one of a pair of load balanced servers which each can handle 10x the load required of them, if it goes down there's no downtime, at all, yay sexy architectures.) deimos fucked around with this message at 05:27 on Sep 13, 2009 |
# ? Sep 13, 2009 05:24 |
|
Where's a good resource to learn about turning a list into a table? Speaking specifically about using a set of data from twitter to create a table then publishing it to "the web" (localhost). I can fetch the data via the Twitter API (python-twitter library) just fine, I can "publish" (localhost again) an empty table via Django, but getting the data into the table is beyond me.
|
# ? Sep 13, 2009 06:15 |
|
RobotEmpire posted:Where's a good resource to learn about turning a list into a table? Speaking specifically about using a set of data from twitter to create a table then publishing it to "the web" (localhost). I can fetch the data via the Twitter API (python-twitter library) just fine, I can "publish" (localhost again) an empty table via Django, but getting the data into the table is beyond me. Well if you are using Django and you have your models based on the data from the twitter api, then it's as simple as creating a new record for that model with the data you got from twitter. code:
http://docs.djangoproject.com/en/dev/topics/db/models/#topics-db-models
|
# ? Sep 13, 2009 06:43 |
|
I have python2.6 installed, as well as ipython installed, but I can't get ipython to work with 2.6. Any ideas why?code:
|
# ? Sep 13, 2009 07:48 |
|
nbv4 posted:I have python2.6 installed, as well as ipython installed, but I can't get ipython to work with 2.6. Any ideas why? You should just call "ipython". Also, at a guess, you may have ipython installed but for a difference version of python. If you're using easy_install, see what python it's installing things to.
|
# ? Sep 13, 2009 11:39 |
|
outlier posted:You should just call "ipython". Also, at a guess, you may have ipython installed but for a difference version of python. If you're using easy_install, see what python it's installing things to. python = python 2.4 python2.6 = python 2.6 when I type "ipython" it opens ipython in 2.4 mode. I want to run ipython in 2.6 mode. I googled and found the way to run ipython in another version of python which is to do "python2.6 /path/to/ipython", but it isn't working for me.
|
# ? Sep 13, 2009 13:23 |
|
nbv4 posted:when I type "ipython" it opens ipython in 2.4 mode. I want to run ipython in 2.6 mode. I googled and found the way to run ipython in another version of python which is to do "python2.6 /path/to/ipython", but it isn't working for me. So there's your problem right there. ipython is two things - it's the script that you use to call python with the ipython module loaded. Even if you call "python2.6 /path/to/ipython", python2.6 doesn't have the ipython module. Solution: install ipython in python2.6.
|
# ? Sep 13, 2009 14:12 |
|
Why are people pissed over Tornado?
|
# ? Sep 14, 2009 12:04 |
|
Because programmers are children. "Oh poo poo it's easier to re-write what we have than understand what we've done, time to whine!" Edit: You see twisted is easy to use because: (Someone actually quoted these paragraphs claiming that it is easy to use) quote:Currently there is a lot of confusion as to what to do and where to go to get a good, supported twisted.web server. Users are confronted with 3 options and an infinite number of permutations of those options: twisted.web, nevow, and twisted.web2. This confusion is made manifest in the lengthy explanation of web development with twisted hosted here on this wiki. You see it's easy because one day it actually might be. I have only taken a long enough look at twisted to run away screaming. tef fucked around with this message at 12:37 on Sep 14, 2009 |
# ? Sep 14, 2009 12:29 |
|
tef posted:Because programmers are children. There must be some law that all the possible faults and idiosyncrasies of software development get collected and magnified when it comes to web frameworks: "Documentation? No time for that. Anyway, it's simple. All you have to do is spent several weeks dissecting the source code to understand how things work." "It doesn't work? Well, get the dev version out of SVN. That should fix it!" "Why are you complaining it doesn't work? Why not fix it yourself / file a bug report / use another framework ..." "Use an external library for building our wheels? Heavens, no it's much more interesting to invent our own library ..." "Backwards compatibility? Pshaw, too hard. Besides, the new way is much better. All you have to do is write an XML configuration file that registers the interface objects ... <insert paragraph of Architecture Astronaut gibberish>" This message is bought to you by a weary and broken Plone veteran.
|
# ? Sep 14, 2009 13:23 |
|
outlier posted:There must be some law that all the possible faults and idiosyncrasies of software development get collected and magnified when it comes to web frameworks: None of these apply to django, except the trunk-to-fix-bugs one, rarely. In fact one of the problems with django is that there is too much documentation. Essentially the problem with Tornado is that the lead dev took a poo poo on Twisted when they released Tornado.
|
# ? Sep 14, 2009 13:42 |
|
LuckySevens posted:Why are people pissed over Tornado? Dunno, I've already written a Comet framework around it, the Tornado web framework sucks donkey balls, but the HTTPServer is passable, and the IOLoop is awesome. Comet framework can be seen here: http://github.com/ericflo/hurricane
|
# ? Sep 14, 2009 13:45 |
|
Frequently open and free software projects are not products, but self-assembly software. But going back I haven't seen any actual drama or upset in the python community. Just one 'hey yet another async socket library' whine from the twisted guy a little peeved from how his software was portrayed. And a handful of bloggers yammering on about other bloggers yammering on, with no real connection to python or twisted or tornado.
|
# ? Sep 14, 2009 15:29 |
|
tef posted:Because programmers are children. The only people I've seen annoyed about Tornado are core Twisted developers, and anybody who's tried to use Twisted for anything substantial know they're not to be paid any attention. Twisted is just a giant clusterfuck in general. It's a terrible implementation of a bad concept, and the continuing stream of newbies trying to use it is a testament to the power of marketing over common sense.
|
# ? Sep 14, 2009 15:43 |
|
Janin posted:Twisted is just a giant clusterfuck in general. It's a terrible implementation of a bad concept, and the continuing stream of newbies trying to use it is a testament to the power of marketing over common sense. Okay, this opinion has been raised a few times. Having never used Twisted - but intending to use some toolkit like that in the future - the questions are: 1. What are the specific problems with Twisted? 2. What are the alternatives? Geniuine questions. From a distance, it seems like a smart - if over-powered - toolkit. deimos posted:None of these apply to django, except the trunk-to-fix-bugs one, rarely. In fact one of the problems with django is that there is too much documentation. Granted. Django is the exception - although the transition to 1.0 and some of the api flux was irritating.
|
# ? Sep 14, 2009 17:07 |
|
outlier posted:Okay, this opinion has been raised a few times. Having never used Twisted - but intending to use some toolkit like that in the future - the questions are: Twisted is an attempt to avoid two problems with concurrency in Python: poor thread support and awkward continuations. When trying to implement concurrency, there are basically two fundamental styles. The first is just to spawn threads for everything which needs to happen at once. This works well, and is easy to reason about, but for it to be useful requires the language runtime to support both OS-level and runtime-level ("green") threads. Python doesn't have green threads, so trying to spawn more than a few hundred (or thousand, depending on OS) will cause severe overhead from context switches. The other style is an "event loop", where a single thread runs a loop listening for "events", and then dispatches these to registered callbacks. This is the style used when threads are expensive, such as in a C or Python program. Twisted uses an event loop, which it calls a "Reactor". The problem with this style is that you've got a global god-object, which every callback must register with. All libraries which want to take advantage of async features *must* support worship that particular god, and trying to mix two separate event loops (such as Twisted and Glib) requires the use of ugly shims. This makes combining async libraries into a single application very difficult. The second problem Twisted solves is Python's ugly continuation syntax. The "standard" way of handling continuations in asynchronous IO is through callbacks. The programmer calls a procedure with takes a procedure as a parameter. When the IO completes, the callback is called with the results. This model is popular because it doesn't depend on any complex concepts, and is portable to any language which supports passing procedures. In languages which support anonymous blocks (C#, Ruby, JavaScript, Scheme, Lisp, Haskell, Smalltalk, etc) this model is also very easy to use, syntactially speaking, because callbacks can be created inline with the call to the entry procedure. For example, in JavaScript, you might have this code: code:
code:
And here's the biggest, worst problem: for 99% of Twisted, the documentation is insufficent to know in what ways the various procedures are manipulating the implicit, global, god-state. You're going to spend more time reading the Twisted codebase than your own code, because every abstraction they've implemented leaks like hell. For example, a while ago I wanted to write a basic Jabber client in Python. Jabber is a simple core protocol, with many extensions (of various complexity) implementing extra functionality. I hoped that the twisted.words package would save me some time implementing those extensions, but the docs suck, their API docs are anemic and mostly useless, and every API is in some constant state of flux as the developers struggle vainly to understand just what their own software does. Based on other's experience with twisted.web, twisted.names, and twisted.mail, I believe the rest of the library is in a similar state of dilapidation. outlier posted:2. What are the alternatives? The only successful alternative I've seen is "roll your own", but most one-off protocol implementations don't have the resources of a successful company behind them.
|
# ? Sep 14, 2009 18:14 |
|
Janin posted:For example, a while ago I wanted to write a basic Jabber client in Python. Jabber is a simple core protocol, with many extensions (of various complexity) implementing extra functionality. I hoped that the twisted.words package would save me some time implementing those extensions, but the docs suck, their API docs are anemic and mostly useless, and every API is in some constant state of flux as the developers struggle vainly to understand just what their own software does. Yeah but how does Tornado fix this? Their docs are equally anemic and they have zero unit tests to see how things should work. Not to mention that at least twisted works on all Linuxes, try using Tornado on a non english locale and it'll quickly poo poo itself.
|
# ? Sep 14, 2009 20:00 |
|
We used Twisted for leafychat.com and it wasn't too bad, however when we went to design Hurricane (which was mostly designed between 3AM and 9AM :O) we decided not to use Twisted at all in our code, mostly because people's perceptions of it are so toxic, rather than because of any code quality issues (really if they just used new-style classes, and dropped this camelCase BS it would hardly have any issues codewise).
|
# ? Sep 14, 2009 21:10 |
|
I just want to add the one of the main problems I encountered with twisted is that in every release they are drastically changing the API. Because of this, the twisted book and a lot of the examples you find online are hilariously/frustratingly dated.
|
# ? Sep 14, 2009 22:23 |
|
Janin posted:And here's the biggest, worst problem: for 99% of Twisted, the documentation is insufficent to know in what ways the various procedures are manipulating the implicit, global, god-state. You're going to spend more time reading the Twisted codebase than your own code, because every abstraction they've implemented leaks like hell. I wanted to use Twisted awhile back for some project. I'm pretty new to this whole programming thing, and after futzing around for a few hours I just gave up on Twisted because of the god-awful docs. So yea, Twisted documentation is pretty crappy.
|
# ? Sep 14, 2009 23:14 |
|
Jumping on the Twisted hate-train, if only to say that I was considering using it as a replacement SSH layer in Fabric (Paramiko is decent but has some serious annoyances, and I was hoping to use something asynchronous) but the pretty poor docs, and essentially nonexistent API docs, were disappointing to say the least. Plus the (possibly unfounded, I dunno) fear that to use it I have to ask my users to download this big monster framework is kind of off-putting. So yea...for something that complicated, and which is almost guaranteed to be at the core of whatever you're using it for, to have such poor documentation is a bad sign. I'm sure Glyph and friends have put a lot of work into it, but I fear they go waaaay too far in the quantity direction at the expense of quality. Edit: Oh yea, and the overall Java-esque code smell doesn't help either. Really cheeses me off when people use Python-the-language but manage to largely miss the point of Python-the-culture (or at least PEP8), and you end up with stuff like Twisted, Trac, Zope etc. Over-engineered monstrosities, most of which have a thing for CamelCase. JAVA I can sympathize with the problems of a large codebase, but still! bitprophet fucked around with this message at 01:23 on Sep 15, 2009 |
# ? Sep 15, 2009 01:17 |
|
bitprophet posted:Over-engineered monstrosities, most of which have a thing for CamelCase. Yeah, cuz it's not like the Python standard libraries have completely schizophrenic naming conventions.
|
# ? Sep 15, 2009 01:30 |
|
Avenging Dentist posted:Yeah, cuz it's not like the Python standard libraries have completely schizophrenic naming conventions. Oh hello there
|
# ? Sep 15, 2009 02:11 |
|
No Safe Word posted:Oh hello there Wow, it only took them 5 and a half years to notice! Looks like they're trying to outdo the C++ standardization working group in yet another important field: slowness. Also it's great that their list of modules includes precisely one of the ones I linked to. But hey 1/3 ain't bad! (Or 1/2 if you accept PEP8's retarded cop-out about underscores.) Avenging Dentist fucked around with this message at 02:17 on Sep 15, 2009 |
# ? Sep 15, 2009 02:14 |
|
Avenging Dentist posted:Wow, it only took them 5 and a half years to notice! Looks like they're trying to outdo the C++ standardization working group in yet another important field: slowness. Also it's great that their list of modules includes precisely one of the ones I linked to. But hey 1/3 ain't bad! (Or 1/2 if you accept PEP8's retarded cop-out about underscores.) future_builtins and userdict were for compatibility (with new and old code, respectively) and do not exist in 3.x. cPickle and pickle were merged. That's 3/3. The modules are only being renamed in 3.x because 3.x is the "no backwards compatibility" release.
|
# ? Sep 15, 2009 02:26 |
|
Janin posted:The modules are only being renamed in 3.x because 3.x is the "no backwards compatibility" release. Now if they could just decide to eliminate the redundant standard libraries they have, like optparse and getopt (what kinds of person seriously finds themselves wanting getopt outside of C anyway?), or the multiple, ever-so-slightly different test suites (test, unittest, doctest - even though the last one is a bit different). And they still have weird-rear end choices, like dummy_threading, since "dummythreading" apparently isn't readable, but "quopri" is. And they didn't bother to fix xml.etree.ElementTree because it's "externally maintained" and I guess Guido is afraid of rocking the boat on that one.
|
# ? Sep 15, 2009 02:34 |
|
I'm getting a memory error on a file I'm trying to read (about 2GB). I discovered it was the readlines() method, and was able to rewrite this code so that it wouldn't get the memory error, but then I couldn't get thisThing to work, because my algorithm had changed so much. Can anyone tell me some equivalent code for this code block which wouldn't be such a memory hog? Basically I'm just looking for someone with more experience to kindly rewrite this code block. Thanks in advance. code:
|
# ? Sep 15, 2009 02:53 |
|
|
# ? May 9, 2024 18:51 |
|
Avenging Dentist posted:Now if they could just decide to eliminate the redundant standard libraries they have, like optparse and getopt (what kinds of person seriously finds themselves wanting getopt outside of C anyway?), or the multiple, ever-so-slightly different test suites (test, unittest, doctest - even though the last one is a bit different). Hi: http://mail.python.org/pipermail/stdlib-sig/2009-September/000398.html, http://mail.python.org/pipermail/stdlib-sig/2009-September/000342.html While I agree with your sentiment to an extent, being in core-dev I've experienced first hand how slow things are to change. The quality bar requirement for modules has gotten drastically higher over the past few years, but there's several hundred modules to deal with, and limited manpower with which to do it. There's also a fairly large contingent within the community who would prefer never to remove/rename anything. Not to mention the fact backwards compatibility is pretty key for a lot of this, and slow deprecation processes (add a warning, leave the warning, remove). While I'd like to see the standard library get a once-and-for-all makeover (removing a decent portion of it in the process) I understand why it is the way it is, and also understand things take time, money and resources to change. Some things got fixed in 3k; hopefully with some of the PEP-work spurred today, more work will get done, but frankly, it's at least a year off.
|
# ? Sep 15, 2009 03:06 |