Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > what is this "python" eating up 97% of my CPU under activity monitor?

what is this "python" eating up 97% of my CPU under activity monitor?
Thread Tools
Senior User
Join Date: Aug 2002
Status: Offline
Reply With Quote
May 23, 2005, 12:58 PM
 
was wondering if anyone know what this is? Its constantly using around 95 - 100% of my CPU...

its under OS X 10.4.1, not sure if i remember seeing this being there before...
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 23, 2005, 01:09 PM
 
Are you running BitTorrent? Python is a programming language, BitTorrent being the most popular app I know of that uses it.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Mac Elite
Join Date: Jan 2003
Location: 127.0.0.1
Status: Offline
Reply With Quote
May 23, 2005, 01:11 PM
 
Do you have the TV tracker widget?
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
May 23, 2005, 03:07 PM
 
Python is a programming language which comes with OSX. Like Java, it compiles to a form of bytecode which is then interpreted with a program that has the same name as the programming language, and that is the python process you're seeing. Although it tends to run a bit slower than Java, it starts up much more quickly, and Apple uses it for a few system functions. For example, when you fax images from the Print dialog, a lot of the code to handle this is written in Python. However, this is not the most common way to get a Python process running on your machine; that honor goes to BitTorrent.

Most BitTorrent clients are written in Python, because that's what the official client uses. On Macs, both the official client and Tomato Torrent use a bridge called PyObjC to write Cocoa apps in Python instead of Objective-C. It's very unusual for BitTorrent clients to use up that much CPU, however.

I haven't encountered this "TV Tracker" widget that alpha mentions. From what I can tell from the Website, though, it does seem to use Python, and therefore it probably uses PyObjC too. This said, would it really use that much CPU time just parsing an HTML page?
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Mac Enthusiast
Join Date: Nov 2001
Location: fourth sector
Status: Offline
Reply With Quote
May 23, 2005, 04:33 PM
 
Had the same problem. When the TV Tracker widget tries to get information from the internet and fails (cause you are not connected, for example) python seems to stall.

nexus5.
     
Posting Junkie
Join Date: Jun 2003
Location: Dangling something in the water… of the Arabian Sea
Status: Offline
Reply With Quote
May 23, 2005, 05:54 PM
 
If TV Tracker is stuck (no internet access), then python uses zero % CPU on my machine. If TV Tracker is downloading info, python never goes above 20% on my 1 GHz TiBook. Usually much less than 10% actually.
     
Professional Poster
Join Date: Mar 2002
Location: Smallish town in Ohio
Status: Offline
Reply With Quote
May 23, 2005, 06:18 PM
 
Originally Posted by Millennium
Python is a programming language which comes with OSX. Like Java, it compiles to a form of bytecode which is then interpreted with a program that has the same name as the programming language, and that is the python process you're seeing. Although it tends to run a bit slower than Java, it starts up much more quickly, and Apple uses it for a few system functions. For example, when you fax images from the Print dialog, a lot of the code to handle this is written in Python. However, this is not the most common way to get a Python process running on your machine; that honor goes to BitTorrent.
How do you know all this?
     
Mac Enthusiast
Join Date: Nov 2003
Status: Offline
Reply With Quote
May 23, 2005, 06:36 PM
 
Originally Posted by Millennium
I haven't encountered this "TV Tracker" widget that alpha mentions. From what I can tell from the Website, though, it does seem to use Python, and therefore it probably uses PyObjC too. This said, would it really use that much CPU time just parsing an HTML page?
TV Tracker doesn't use PyObjC, but rather includes uncompiled python programs inside its widget bundle. The widget then makes system calls (via widget.system) from its JavaScript to run these various subprograms (e.g. "/usr/bin/python main.py --max") for different functions (getting a channel listing for a zip code, populating the channel guide, etc.).

So anyway, that's why these TV Tracker Python processes are so CPU intensive: they're using interpreted code instead of compiled code. And when one of the system processeses gets "detached" from the widget's client dashboard process (which apparently can happen), it can sit around and chew up a lot of time.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 23, 2005, 06:42 PM
 
But isn't Python code compiled when it's interpreted? The fact that it's interpreted should only matter when it's being loaded.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
May 24, 2005, 04:45 AM
 
Originally Posted by macintologist
How do you know all this?
I'm a bit of a Python freak, I'll admit. I started out learning it for work, but it's become my favorite language. One of these days I'll work up the guts to actually code something worthy of unleashing on an unsuspecting public... um, I mean releasing. Yeah, that's it.

As for Chuckit's question, uncompiled Python source files (.py) are usually compiled the first time they're run (.pyc), and the .pyc files are then executed. Because of that, this shouldn't be an issue after the first time the widget fetches HTML.

I admit, I'm a little curious about the widget's design. I know that widgets can include Cocoa "custom code plug-ins", and the API doesn't look like anything that PyObjC wouldn't be able to handle. Why not roll the Python code into a plug-in and parse the HTML that way? This should eliminate the detachment issues, and it may even run a bit faster. The downside is that it would use a bit more RAM, since the plug-in would be constantly loaded rather than called occasionally, but I don't think this would be that much of a problem.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Grizzled Veteran
Join Date: Jul 2004
Location: Canada
Status: Offline
Reply With Quote
May 29, 2005, 01:48 AM
 
I was bitten by this bug. The 1.5 version of the TV tracker fixes this bug.
--
Aristotle
24" iMac 2.8Ghz 4GB RAM, 320GB HD; 64GB iPhone 4 S⃣
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:20 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2