usenet problem

2008-02-20 Thread Jacob Davis
Hi.  I am a newbie to usenet.  I am using mac and have downloaded a  
free usenet client, "MT-NewsWatcher".  I put in comp.lang.python but  
it says that it cannot get the address of the news server host.  My  
config says it is trying on port 119. Thanks for any help.

Jake
-- 
http://mail.python.org/mailman/listinfo/python-list


Boa Constructor Mac crash when adding menubar

2008-02-20 Thread Jacob Davis
hi.  Every time I go through the Boa Constructor tutorial and I get to  
the "Add a Menu Bar" section, Boa Constructor crashes after I select a  
wx.menubar and then left click either in the Data or design frames.

I saw a post on the internet from the usenet about this very question,  
but was from 2005, and there was a reply that there would be a fix,  
but I can't figure out if this issue was supposed to be resolved.

thanks for any help

jake
-- 
http://mail.python.org/mailman/listinfo/python-list


wxPython Plot always comes to focus on redraw

2008-02-21 Thread Jacob Davis
Hi.

I am using wxPython, and I have a frame that has a notebook in it.   
there are 3 pages in the notebook, 2 of which are Panels and 1 of  
which is a PlotCanvas.  The data for the plot changes when I press a  
button that is in the frame, but not in the notebook (as designed).   
the button also makes the plot draw again, since the data has changed.

The problem is that whenever I press my button, the focus of the  
notebook "view area" (as opposed to the tabs) changes focus to the  
plot.  if I have multiple plots, the focus goes to that plot which was  
drawn last in the code. however, if I click anywhere on the panel, the  
page of the notebook that is supposed to be in focus is now shown in  
the "view area" of the notebook.

will try to make a sample .py if anybody needs a visual, let me know  
pls.

Thanks for any help!

Jake
-- 
http://mail.python.org/mailman/listinfo/python-list


graphing/plotting with python and interface builder

2008-02-22 Thread Jacob Davis
Hi.

I am developing for mac and using Xcode and Interface Builder 3.0.  I  
can make a simple application, but I am having a hard time trying to  
figure out a good way to create a graph or plot for a class project.

Does anybody have any tips on where to get started, or on how to do  
this?

I have searched far for several days now, but I don't know if I am on  
the right track.  Any help is much appreciated.

Thanks,

Jake
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython Plot always comes to focus on redraw

2008-02-22 Thread Jacob Davis
Thanks for the reply.

The parent is a notebook. (the Plotcanvas is a page in the notebook)   
I tried to make the page of the notebook a panel, and then make the  
PlotCanvas a child of this panel, but the Plot would not show up when  
drawn.

I may have time to make a mini program to duplicate the error in the  
future...


On Feb 21, 2008, at 6:14 AM, Mike Driscoll wrote:

> On Feb 21, 2:57 am, Jacob Davis <[EMAIL PROTECTED]> wrote:
>> Hi.
>>
>> I am using wxPython, and I have a frame that has a notebook in it.
>> there are 3 pages in the notebook, 2 of which are Panels and 1 of
>> which is a PlotCanvas.  The data for the plot changes when I press a
>> button that is in the frame, but not in the notebook (as designed).
>> the button also makes the plot draw again, since the data has  
>> changed.
>>
>> The problem is that whenever I press my button, the focus of the
>> notebook "view area" (as opposed to the tabs) changes focus to the
>> plot.  if I have multiple plots, the focus goes to that plot which  
>> was
>> drawn last in the code. however, if I click anywhere on the panel,  
>> the
>> page of the notebook that is supposed to be in focus is now shown in
>> the "view area" of the notebook.
>>
>> will try to make a sample .py if anybody needs a visual, let me know
>> pls.
>>
>> Thanks for any help!
>>
>> Jake
>
> Just a show in the dark, but is the plotcanvas object's parent a frame
> or a panel? If it's the frame, than that's probably what the problem
> is.
>
> You may want to post to the wxPython list where you'll get wx geeks to
> answer your question and you can learn a lot from them too. Here's a
> link where you can sign up: http://wxpython.org/maillist.php
>
> Mike
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython Plot always comes to focus on redraw

2008-02-22 Thread Jacob Davis
Thanks for the reply.

This is something that I tried.  The documentation for SetFocus() says  
that it is for keyboard input and that Show() is supposed to show the  
window.  I guess I was misusing the terminology.

I tried your suggestion with SetFocus(), Show() and Raise(), with no  
joy.  I think I will try the wxPython list.

Thanks

Jake


On Feb 21, 2008, at 4:36 AM, Steve Holden wrote:

> Jacob Davis wrote:
>> Hi.
>>
>> I am using wxPython, and I have a frame that has a notebook in it.
>> there are 3 pages in the notebook, 2 of which are Panels and 1 of
>> which is a PlotCanvas.  The data for the plot changes when I press a
>> button that is in the frame, but not in the notebook (as designed).
>> the button also makes the plot draw again, since the data has  
>> changed.
>>
>> The problem is that whenever I press my button, the focus of the
>> notebook "view area" (as opposed to the tabs) changes focus to the
>> plot.  if I have multiple plots, the focus goes to that plot which  
>> was
>> drawn last in the code. however, if I click anywhere on the panel,  
>> the
>> page of the notebook that is supposed to be in focus is now shown in
>> the "view area" of the notebook.
>>
>> will try to make a sample .py if anybody needs a visual, let me know
>> pls.
>>
>> Thanks for any help!
>>
>> Jake
>
> All wxWindow objects have a SetFocus() method. I am unsure why the
> system should be changing the focus (it's almost certainly something  
> you
> are asking it to do without realizing), but the easiest way to proceed
> if you can't stop the focus from changing (i.e. remove the problem) is
> to call SetFocus() on the widget that you want to have the focus after
> you've finished (i.e. cure the symptom).
>
> Or perhaps it's just that I haven't understood the problem correctly.
> You probably didn't post the code because it's large (which is good).
> The correct action is to pare the program down to the smallest one you
> can make that demonstrates the problem, then post that. often during
> this process it becomes clear what the problem is!
>
> It may be that your widget relationships aren't as clean as they might
> be: did you produce your layout with an automated tool like wxDesigner
> or BoaConstrictor, or did you hack it together by hand?
>
> regards
>  Steve
> -- 
> Steve Holden+1 571 484 6266   +1 800 494 3119
> Holden Web LLC  http://www.holdenweb.com/
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: graphing/plotting with python and interface builder

2008-02-23 Thread Jacob Davis
Thanks for the reply.

I have wxPython installed and have used it.  with wx I have just been  
using the wx.lib.plot module and the graphing is fine (although in  
other posts I note some focus issues).

I have been looking at moving to using interface builder 3.0 and  
building Cocoa apps because for a bigger project it might be faster  
and better code.

I only want to make plots that show data... but I need to refresh the  
plot at every step.  with wx.lib.plot, i just draw it again  
(performance is not too big of an issue).  No user interaction is  
needed.

I will check out Chaco.  Like I said, I know how to use wx.lib.plot,  
so if there is a way that I can use the graphs created there that  
would be great... although I suspect that wx.lib.plot requires a frame  
as a parent, which I would not want to use since .nib files (from  
interface builder) would handle the gui side with PyObjC (a language  
which I don't know).

Thanks

Jake

On Feb 22, 2008, at 10:30 PM, Peter Wang wrote:

> On Feb 22, 10:08 pm, Jacob Davis <[EMAIL PROTECTED]> wrote:
>> Hi.
>>
>> I am developing for mac and using Xcode and Interface Builder 3.0.  I
>> can make a simple application, but I am having a hard time trying to
>> figure out a good way to create a graph orplotfor a class project.
>>
>> Does anybody have any tips on where to get started, or on how to do
>> this?
>>
>> I have searched far for several days now, but I don't know if I am on
>> the right track.  Any help is much appreciated.
>>
>> Thanks,
>> Jake
>
>
> Jake, are you using any python-specific GUI libraries like wxPython,
> Qt, or Tk?  The Chaco plotting toolkit (http://code.enthought.com/
> chaco)  supports several different mechanisms for rendering on OS X;
> the default is to render via Quartz, but this requires wx or Qt.  I am
> also currently working on a (somewhat experimental) pure OpenGL
> backend, which doesn't require wxPython or Qt, just an active OpenGL
> context.
>
> Do you want to generate a fairly static plot, or do you want the user
> to be able to interact with it in some way?
>
>
> -Peter
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: graphing/plotting with python and interface builder

2008-02-23 Thread Jacob Davis
I found SM2DGraphView, but I guess that I am too much of a newbie with  
interface builder and pyobjc to figure out how to get SM2DGraphView to  
work.  Are there any good tutorials (or better yet, examples) of how  
to get SM2DGraphView to work?

I don't know pyobjc well at all.

Thanks

Jake


On Feb 23, 2008, at 5:54 AM, Diez B. Roggisch wrote:

> Jacob Davis schrieb:
>> Hi.
>>
>> I am developing for mac and using Xcode and Interface Builder 3.0.  I
>> can make a simple application, but I am having a hard time trying to
>> figure out a good way to create a graph or plot for a class project.
>>
>> Does anybody have any tips on where to get started, or on how to do  
>> this?
>>
>> I have searched far for several days now, but I don't know if I am on
>> the right track.  Any help is much appreciated.
>
> I use
>
> http://developer.snowmintcs.com/frameworks/sm2dgraphview/index.html
>
>
> under 10.4. I don't see why it shouldn't work under 10.5. I assume you
> use pyobjc? I had to use the signature-decorator to make the
> SM2DGraphDataSource-category work - but I'm not sure if pyobjc 2.0
> changes anything in that respect.
>
>
> Diez
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


deleting objects by finding all references and deleting?

2008-06-08 Thread Jacob Davis

Hi,

I read in some earlier messages that an object in Python is only  
removed or freed from memory when all references to that object have  
been deleted.  Is this so?


If so, is there a way to get all of the references to an object, so  
that they may all be deleted, thus actually deleting the object?


I have a very large python simulation, and I need to make sure that my  
object are deleted when I need them to be.  I am experiencing some  
speed/memory issues (I create an approx. 75,000 complex objects).


Thanks,

Jake--
http://mail.python.org/mailman/listinfo/python-list

Module not found in script that was found in command-line interpreter. Possible Path issue?

2008-04-02 Thread Jacob Davis

Hi.

I just installed the MySQLdb module and I have been able to get it to  
run in my command line interpreter.


I am running Mac Leopard, and Python 2.5.

 I have tested importing and actually connecting and using a MySQL  
database, although it issues some warning:


SnakeBite:MySQL-python-1.2.2 Snake$ python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg/_mysql.py:3:  
UserWarning: Module _mysql was already imported from /Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ 
MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg/_mysql.pyc, but /Library/ 
Python/MySQL-python-1.2.2 is being added to sys.path

  import sys, pkg_resources, imp
>>>


However, while writing a .py script (with Komodo Edit) I try to simply  
import the module and the in-Komodo interpreter returns an error:

Traceback (most recent call last):
  File "/Users/Snake/Documents/NPS/Thesis/Source_Code/Genetics/ 
mysql_connect_test.py", line 11, in 

import MySQLdb
ImportError: No module named MySQLdb

This script does, however, run fine when I call it from the command- 
line interpreter.  I don't really know much about Paths or anything,  
all I Know is that to get Komodo to run my Python scripts, I had to  
tell it that an interpreter is located at /usr/bin/pythonw


My goal is to use Komodo (or some simple IDE with syntax checking, and  
function hinting, and an embedded interpreter - so if you know of any  
others for Mac Leopard) to write and debug scripts.


-Jake


# >
# >
# > This file tests the connection to a mysql database  
("gene_test") on localhost:3306

# >  it gets all of the data from the table "3_weeks" and prints it
# >
# 


# import MySQL module
import MySQLdb

# connect
db = MySQLdb.connect(host="localhost", user="customer",  
passwd="customer", db="gene_test")


# create a cursor
cursor = db.cursor()

# execute SQL statement
cursor.execute("SELECT * FROM 3_weeks")

# get the resultset as a tuple
result = cursor.fetchall()

# iterate through resultset
for record in result:
print record[0] , "-->", record[1]-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Module not found in script that was found in command-line interpreter. Possible Path issue?

2008-04-15 Thread Jacob Davis

On Apr 3, 2008, at 10:54 AM, Trent Mick wrote:
> Jacob Davis wrote:
>> I just installed the MySQLdb module and I have been able to get it  
>> to run in my command line interpreter. I am running Mac Leopard,  
>> and Python 2.5.
>> I have tested importing and actually connecting and using a MySQL  
>> database, although it issues some warning:
>> SnakeBite:MySQL-python-1.2.2 Snake$ python
>> Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple  
>> Computer, Inc. build 5341)] on darwin
>> Type "help", "copyright", "credits" or "license" for more  
>> information.
>>>>> import MySQLdb
>> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ 
>> site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg/ 
>> _mysql.py:3: UserWarning: Module _mysql was already imported from
>
> From that message it looks like this "python" is /usr/local/bin/ 
> python (i.e. a separate installation than Apple's system python at / 
> usr/bin/python and /System/Library/Frameworks/Python.framework).
>
> You can tell for sure by doing:
>
>  $ which python
>
>> However, while writing a .py script (with Komodo Edit) I try to  
>> simply import the module and the in-Komodo interpreter returns an  
>> error:
>> Traceback (most recent call last):
>>  File "/Users/Snake/Documents/NPS/Thesis/Source_Code/Genetics/ 
>> mysql_connect_test.py", line 11, in 
>>import MySQLdb
>> ImportError: No module named MySQLdb
>
> I suspect that this is because your run of Komodo Edit doesn't have  
> "/usr/local/bin" on its PATH and is using "/usr/bin/python" instead  
> of the one you typically use on the command line.
>
> You can configure Komodo to know about /usr/local/bin by adding a  
> "PATH" setting in the "Environment" prefs panel. Arguably Komodo  
> should just add /usr/local/bin to its runtime PATH by default, but  
> unfortunately it currently doesn't. Komodo doesn't pick up your  
> normal bash shell environment because of problems trying to get that  
> information in general.
>
> Please let me know (or on the komodo-discuss list [^1] or Komodo bug  
> database [^2]) if you have any problems getting that going.
>
> Cheers,
> Trent
>
> [1]: http://listserv.activestate.com/mailman/listinfo/Komodo-discuss
> [2]: http://bugs.activestate.com/query.cgi?product=Komodo
>
> -- 
> Trent Mick
> trentm at activestate.com

Thanks, that seems to have worked.  I added "/usr/local/bin" to the  
PATH in the preferences Environment panel in Komodo.  Then in  
preferences I went into the Python pane and changed my selected  
interpreter from "/usr/bin/pythonw" to the now available "/usr/local/ 
bin/pythonw".

Thanks again,

Jake
-- 
http://mail.python.org/mailman/listinfo/python-list


Can't see variables declared as global in a function

2008-04-16 Thread Jacob Davis

Hi.

I have a hundred lines of code in a module that declare some global  
variables inside a function so that those variables can be used by  
other functions.  I want to import this module so that I can more  
easily debug by looking at the value of individual variables.  But  
when I try to reach these variables, I get a warning that they are not  
defined.


I am on an Intel Mac running Leopard 10.5.2, Python 2.5

Here is an example of some code that has the same problem:




#!/usr/bin/env python

global isglobal
isglobal=200

def somefunc():
global from_somefunc
from_somefunc=5

def anotherfunc():
return from_somefunc+30




So during debugging I want to look at the variable from_somefunc

here is my terminal output. I start by looking at dir(), then run  
somefunc(), then run anotherfunc(), then I want to look at  
from_somefunc but I get a warning:




Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from test_vars import *
>>> dir()
['__builtins__', '__doc__', '__name__', 'anotherfunc', 'isglobal',  
'somefunc']

>>> somefunc()
>>> anotherfunc()
35
>>> isglobal
200
>>> from_somefunc
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'from_somefunc' is not defined
>>> dir()
['__builtins__', '__doc__', '__name__', 'anotherfunc', 'isglobal',  
'somefunc']




Is there a way that I can view from_somefunc?

Thanks,

Jake

-- 
http://mail.python.org/mailman/listinfo/python-list