|
This might warrant it's own thread but, I'm having problems with both Python24 and 25 installed on my Mac. I don't particularly remember installing 25 but, I guess it might have come from my Leopard upgrade. I don't honestly care much which version I am using but, my problem comes from the fact that any type of library or module install I am doing is defaulting into the 2.5 installation directory but, all my scripts are executed by 2.4.4. Can anyone help me sort out this all? Should I remove one installation (24 or 25) or how can I at least just get easy_install etc, to use one installation (preferably 24, since I already have a bunch of packages installed there) or migrate my packages over? I'm a bit dumbfounded right now
|
# ¿ Feb 11, 2008 19:44 |
|
|
# ¿ May 4, 2024 15:45 |
|
outlier posted:No need to remove one or the other - they can co-exist nicely. And some software *cough*Zope*cough* can't use 2.5. Thanks for the reply. I figured out the problem. I had installed MacPorts and it had put an ugly 2.4.4 version on top of 2.4 and 2.5 and injected itself into my profile. Took MacPorts out and it went back to normal again Thanks though
|
# ¿ Feb 12, 2008 21:48 |
|
Python GUI's? Any opinions? Tkinter, Wx, GTK, QT? Which one has better IDE support currently? Are there any good IDE's? Anyone in particular I should avoid if I'm using OS X?
|
# ¿ May 28, 2008 19:52 |
|
politicorific posted:here's an easy one hopefully. I'm just typing this out and not double checking my code so there maybe a syntax error or two in here so YMMV code:
|
# ¿ May 30, 2008 02:29 |
|
Did anyone else know that they could write applications for their Nokia phone in pure Python? I sure as hell didn't http://opensource.nokia.com/projects/pythonfors60/ I need to dig out my discarded N-Series and play with this.
|
# ¿ Jun 21, 2008 05:53 |
|
What am I doing wrong here code:
code:
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin edit: The output I would expect from the above code would be AHHHHHHH KIIIIIIIIIK why is this not hitting the __set__ or __get__ methods since the "AHHH" would be printed when the __set__ method would be invoked then the __get__ method would be invoked on access then printed (maybe... I think I need some caffeine here. Well... The value I assigned to code probably wouldn't be printed since I didn't properly replace the __set__ or __get__ methods to actually store the value but, first things first. I'm not even overriding them properly yet. I'm a moron since in >2.2 python it's now __getattr__ and __setattr__ instead of __get__ __set__ move along ATLbeer fucked around with this message at 20:13 on Jun 23, 2008 |
# ¿ Jun 23, 2008 20:05 |
|
Bonus posted:Yeah. Also watch that you don't fall into an infinite loop within the __getattr__ or __setattr__ methods. Manipulate the __dict__ directly. Yeah, I learned that pretty quickly. Still can't seem to get the __getattr__ to overload properly here code:
code:
Latest version of this mess... code:
code:
What is with that second invocation of the __getattribute__ method using the __dict__ object? Where is that call coming from? (Never mind... It's me with the self.get call. But, that doesn't make sense. I'm calling object.__getattribute__ not self.__getattribute__. If I really was invoking my method again I would be stuck in a recursion loop. Wth? ATLbeer fucked around with this message at 21:05 on Jun 23, 2008 |
# ¿ Jun 23, 2008 20:44 |
|
Bonus posted:Milde: Ah, yeah, right, I always consfuse get/setattr with get/setattribute. Those are really awkward names. Can someone show me the Python docs on the *array, **array information? I know what it does but, I've never actually seen the docs for it. It's also hard to google "python *"
|
# ¿ Jun 24, 2008 15:57 |
|
Here's an oddity I can't seem to figure out. I have a list of objects that I can interate through but, how to I operate on them? This is a very simplistic example but, demonstrates what I want code:
Caveat: without the obvious iterating via Index. I want to maintain using it by objects? Is that possible or do I have to use indices? Not* for x in range(len(k)): k[x] = 0 ATLbeer fucked around with this message at 00:24 on Jul 1, 2008 |
# ¿ Jul 1, 2008 00:17 |
|
Well.. I guess I should have used my complete example. Simplifying it kind of changes the complexity. This is my current function. code:
It's a multi-dimensional table of unknown dimensions and each cell needs to be slightly massaged to eliminate some unneeded cruft I would rather code:
ATLbeer fucked around with this message at 00:33 on Jul 1, 2008 |
# ¿ Jul 1, 2008 00:27 |
|
Bonus posted:Watch out .... in your first example, you're modifying the arguments in place and then returning a copy. So if someone passes a list to that function and tries to use the same list later on, they'll find it's been mysteriously changed. Can I get the Python man pages that explain that syntax
|
# ¿ Jul 1, 2008 00:34 |
|
Bonus posted:Sure, it's section 5.1.4 here http://docs.python.org/tut/node7.html Are there enough of these for a Python tips and tricks thread?
|
# ¿ Jul 1, 2008 00:44 |
|
What the hell is going on herecode:
3 6 9 12 So why is this happening? I thought every time I call m=MenuContainer() it creates a new MenuContainer object and assigns it to m? Why is it the same object over and over again?
|
# ¿ Jul 4, 2008 04:16 |
|
deimos posted:def __init__(self, Enabled=False, Items=[]): Didn't make a difference
|
# ¿ Jul 4, 2008 05:07 |
|
JoeNotCharles posted:This creates sidemenu, midmenu, topmenu and footer as class variables. All instances of MenuContainer will share them. You want That was it... Working 12 hours today and my brain is fried... I need to blow something up tomorrow.
|
# ¿ Jul 4, 2008 05:17 |
|
Hanpan posted:Wow. After being recommended pyGame over in the Game Development thread, I have been trying to figure out how to get python / pygame and setup with a decent IDE on Mac OSX. I always check PythonMac for packages first when installing a big package. These are nice tested pkg installers for OS X that have always worked goldenly for me. PyGame is included there http://pythonmac.org/packages/py24-fat/index.html
|
# ¿ Jul 8, 2008 00:33 |
|
I have an odd problem. I have a RPC that is returning a dictionary but, unfortunately the dictionary is coming back as a string. It's a valid dictionary but, basically the __str__ version of the dict. How can I cast the string back into a dictionary :\
|
# ¿ Jul 24, 2008 05:30 |
|
Scaevolus posted:I can't think of anything other than eval() or a similarly hacked-up parser :/ I guess that technically works
|
# ¿ Jul 24, 2008 05:40 |
|
Has anyone had a good experience with a messaging package? I have used the XMLRPC library and I LOVE it.. I really want to use the library but, I would like some sort of central logging of all messages that have gone through the system for debugging and error checking since it's going to be transactional system. I guess I could funnel all the XMLRPC requests through a handler which would log the message and pass it along to the appropriate system but, that seems like a cheap hack and a bottle neck. A Jabber server seems like the only solution but, I can't seem to bring my self to be a fan of the libraries out there. They all seem to be a bit too "un-pythonic" and obtuse. Anyone have any experience in a client-server-client messaging system for Python that you've liked to work with or do you believe I'm just stuck hacking up a Pythonic wrapper for an existing Jabber wrapper?
|
# ¿ Jul 31, 2008 04:29 |
|
Retarded question but, I just can't seem to find the right words to Google for. I have a list that I want to iterate over the list and run the same function against all the items in the list in place. I know there is a shortcut here but, my brain isn't working properly right now
|
# ¿ Sep 13, 2008 02:09 |
|
Treading into a territory I've never been in and am having a hard time Googling up what I need here. I'm trying to 'monitor' the real-time quote information from Yahoo Finance and they have quite a clever system of getting to the browser. So if you go here: http://finance.yahoo.com/q?s=wb (If it's during US market hours) You'll notice the prices update in 'real-time' and not on a constant polling basis. This is because Yahoo is pushing the data to the page with a LONG open HTTP connection that is connected to a push (maybe Comet) server. Here's the URL to the connection long url Watching Firebug it looks like Yahoo's push server occasionally sends down the updates and the JS on the page handles the rest. How do I hold open this HTTP connection and use the data coming down the pipe here? ATLbeer fucked around with this message at 17:13 on Sep 18, 2008 |
# ¿ Sep 18, 2008 16:29 |
|
I have a huge array (400k+) of dicts that I'm trying to work with without iterating over the list multiple times since it's a time-sensitive execution. I'm trying to just break out the value of the dictionary back into the array. [{'DxY': 17L}, {'DxY': 9L}, {'DxY': 8L}, ............ {'DxY': 7L}, {'DxY': 6L}, {'DxY': 4L}] What I want is [17L, 9L, 8L, ..........., 7L, 6L, 4L] but, without having to do something like code:
The list I'm receiving is already sorted and I'm trying to find out what position a new integer would be in the list. I don't need to insert it just identify the position. I was planning on using bisect to identify the position in the array since it's a pretty optimized function ATLbeer fucked around with this message at 16:09 on Oct 2, 2008 |
# ¿ Oct 2, 2008 16:04 |
|
Bonus posted:Use generators! (What a surprise! ) Grr... I always forget about generators. I need to just write a few hundred and play with them so they get stuck in my head. Unfortunately in this case (I updated my OP) I don't know if a generator is going to be the best solution since I don't need (or really want) to iterate over the list I need to search through the list. Or do I need to get another coffee? vvv I'm not storing them that way. I'm just getting them that way. I'm looking at trying to solve it upstream ATLbeer fucked around with this message at 16:43 on Oct 2, 2008 |
# ¿ Oct 2, 2008 16:12 |
|
Bonus posted:Use generators! (What a surprise! ) 4x factor improvement... I'm def going to start practicing generators
|
# ¿ Oct 2, 2008 16:59 |
|
m0nk3yz posted:Oh no guys, I've picked up "Programming Erlang" - I'm going to the dark side code:
|
# ¿ Nov 2, 2008 22:44 |
|
So... This may go in the Mac thread but, it's a Python specific problem I just got a new Mac and when I enter into the Python shell I can't use the Up/Down/Left/Right arrows. For example... This is what happens when i push the up button code:
code:
Help me!
|
# ¿ Nov 29, 2008 04:15 |
|
Anyone know a module that does MIME decoding for email? I'm working on an app that is reading messages from a POP3 server and just need the from address, subject, and body of the message. Unfortunately email I've found some email clients (Blackberries, Outlook) do loving horrible things to email. I just need a way to reliably extract plain text from the email.
|
# ¿ Dec 23, 2008 03:16 |
|
No Safe Word posted:Does the one that comes in the standard lib not cut it? Or was it just overlooked? It didn't cut it for some reason. Maybe I was misusing it but, it for some cases (BB email in particular) would just pass back the plain encoded text. I'm using poplib to retrieve the email and tried passing it to the email lib. Maybe I'm just using it wrong.
|
# ¿ Dec 23, 2008 03:41 |
|
chemosh6969 posted:I'm not 100% sure, but I was doing a similar thing and asked a question here and I may have pasted the code I was trying. This is the exact problem I'm having
|
# ¿ Dec 23, 2008 05:09 |
|
nbv4 posted:In Django, you can format dates in the template system by using PHP-style date format strings like so: "{{ my_date|"n-j-Y" }}" but how do you do the same thing from within python itself? I know about datetime.date.strftime() and strptime(), but those functions take a completely different date formatting "language"... When in doubt... browse source http://code.djangoproject.com/browser/django/trunk/django/utils/dateformat.py code:
|
# ¿ Dec 29, 2008 20:13 |
|
wrok posted:
3.0 snob... 2.6 fo lyfe This is hysterical code though.. Reminded me about a turned down consulting gig back in my PHP days where there were "stored procedures" of code that were stored as text in a DB which was called and eval()'d. I couldn't find anywhere in the code where the stored data ("function") was altered.. The originally programmer just used the DB to store code as opposed to just creating a new file. It was more than I wanted to try to peel apart for what they were willing to spend.
|
# ¿ Feb 23, 2009 19:06 |
|
m0nk3yz posted:Reminds me of another weird urge I had the other day; given stackless tasklets are picklable (as well as the channel), you could serialize them and put them into a database, and in theory, a SQL query of the objects in the database could actually dictate the "program structure". You just need an ORM that auto-depickles the objects and adds them to the scheduler. Store your channels in another table, and select those with the query too. I had a similar thought a while ago (and I wasn't the first one, there are modules out there that people have written already for it) to pickle python functions and send them over the wire with parameters to "workers" to have a distributed work farm in processing large amounts of information. I don't recall what the modules that actually did it were called as my need for such a system disappeared. But, you can do all sorts of fun things with that type of "meta" Python
|
# ¿ Feb 23, 2009 22:33 |
|
king_kilr posted:For those doing concurrency stuff I implemented futures in Python earlier today for those who may be interested: http://dpaste.com/11007/ So quick question on program flow here code:
edit: It's late and I'm tired... So in case my question doesn't make sense... Why isn't it written like this code:
ATLbeer fucked around with this message at 06:25 on Mar 10, 2009 |
# ¿ Mar 10, 2009 06:22 |
|
On the hunt for a Python package before I go reinvent the wheel I'm looking for a PubSub style messaging system that I can pass objects (like in Pyro) for the messages I basically have a process that is monitoring a data feed (IRC channel) and I need the resulting parsed data to be sent to any application that "subscribes" to the data feed. This data is real time data so a polling system is unusable and I'd like to be able to attach different applications to this data stream.
|
# ¿ Mar 13, 2009 16:05 |
|
m0nk3yz posted:This is similar to a JavaSpace/JMS (for Java) - Off the top of my head, does then Event server stuff in pyro get you close to what you want? http://pyro.sourceforge.net/manual/6-eventserver.html Eh... I haven't touched Java in years and wanted a pure Python solution. I have a bit more work on some other stuff. If there isn't anything out there I just write my own. Publishing pickled objects is basically what I'm looking for. Now that I read your link... I might play with that for a while this weekend
|
# ¿ Mar 13, 2009 17:07 |
|
Zombywuf posted:Where did you find that number? Their benchmark page appears devoid of benchmarks. http://code.google.com/p/unladen-swallow/wiki/Releases code:
|
# ¿ Mar 26, 2009 14:05 |
|
Avenging Dentist posted:
wow.... i had no idea you could do that... insanity and very powerful
|
# ¿ May 11, 2009 22:36 |
|
Found this useful this week.. Just wanted to share http://pypi.python.org/pypi/python-daemon quote:python-daemon 1.4.5
|
# ¿ May 19, 2009 18:41 |
|
dustgun posted:If I want to make a site that's basically only index.py, what's the best way to do that? I'm honestly not quite sure what magic words I should be searching for. web.py or for a django related 'micro-framework' djng
|
# ¿ May 21, 2009 03:03 |
|
|
# ¿ May 4, 2024 15:45 |
|
Janin posted:What? There's nothing insecure about a public MySQL server. Just use a password other than the combo to your luggage and you'll be fine. This is wrong. Never leave any service running publicly available unless it has to be accessed by something external. When it does need to be accessed externally enforce the tightest access rules possible on multiple layers when possible. If your backup server needs to get access to your MySQL server and an SSH tunnel or VPN isn't possible 3306 should be explicitly blocked in your firewall from all IPs EXCEPT your backup machine's IP and then the backup user should ONLY be able to connect from that IP. Never just leave a service running publicly available unless it 100% needs to be
|
# ¿ Jun 21, 2009 18:17 |