From: Rimon B. <ba...@cs...> - 2002-08-09 02:21:00
|
On Thu, 8 Aug 2002, Adrien Plisson wrote: >Hello ! i'm finally here after having had many troubles subscribing to >the list. (lists.sourceforge.net wants to be too RFC822 compliant so I >had to cheat it...) Hello Rien, Glad to have you here. Perhaps you can report your problems to SourceForge so that they can improve their system. The mailing list is out of my control. >I'm really new to spyce. It seemed to me to be a good way to achieve my >goals, but i ran into trouble at first use. since the documentation is >not complete (where is the spyceModule writer's guide i heard about ???), >i can't find any solutions to my problems. The documentation the pages that you should read before writing a Spyce module are: http://spyce.sourceforge.net/doc_mod.html http://spyce.sourceforge.net/doc_mod_new.html and you should go and look at the existing modules, as examples. If you can make a suggestion on how to make this more obvious, I'd be happy to consider it. If you problems that you can't solve... That is what this list is for. >the biggest one, and the only one i will submit today is: when i try to >import MySQLdb module from a spyce script, the module is corrupted and >all important methods, like Connect or such disappears (i mean, >dir(MySQLdb) does not show them), while this module works perfectly on a >python shell. I'm not sure where the problem lies. I don't have enough information to determine the exact cause. It might have something to do with the mod_python environment. Have you tried to run the scripts via CGI, FastCGI or even via the command-line just to test? This uses a standard Python environment, not one that is embedded inside Apache, and may solve your problem. If you can perform this test, then we will be able to further narrow down the problem and hopefully understand the cause. >here is my code: >[[.compact mode='full']] >[[.module name='stdout']] And later you write... >(btw, directive compact does not seem to work) It seems to work for me, and a few others. Perhaps you have uncovered a bug. Could you give an example of where this is not functioning? Input file and output would be nice. If you are not using any browser information, then you can even run it from the command-line: spyce foo.spy If you switch between the different compacting modes you should be able to see the difference in whitespace. >[[\ > import MySQLdb > > db_con = MySQLdb.connect(user='user', passwd='passwd', db='dbname') > db_cur = db_con.cursor() >]] > ><html> > <body> > [[\ > for i in range(db_cur.execute('SELECT * FROM links;')): > name, href = db_cur.fetchone() > print '<A HREF="' + href + '">' + name + '</a><BR>' > ]] > </body> ></html> > >and here is what i get: >Spyce exception: > index2.html:5-10, in (main): > import MySQLdb > >db_con = MySQLdb.connect(user='user', passwd='passwd', db='dbname') >db_cur = db_con.cursor() > >AttributeError: 'MySQLdb' module has no attribute 'connect' >anyone see where the problem might be ? Also, can you tell me what dir(MySQLdb) does show? Can you determine where this module was loaded from? Are you sure this is the right module that you expected? All the best, Rimon. -- * Rimon Barr Ph.D. candidate, Computer Science, Cornell University | ba...@cs... - http://www.cs.cornell.edu/barr - Y!IM: batripler | | Understanding is a kind of ecstasy. +---- -- Carl Sagan |