Communicating from Flash to Python

2011-03-03 Thread Victor Subervi
Hi; I have an AS3 script that is supposed to communicate with a python script and I don't think it is. The python script is to email. How can I trouble-shoot this? Beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Communicating from Flash to Python

2011-03-04 Thread Victor Subervi
On Fri, Mar 4, 2011 at 2:57 AM, Godson Gera wrote: > You can use PyAMF http://pyamf.org > Thanks! Beno -- http://mail.python.org/mailman/listinfo/python-list

Absolutely Insane Problem with Gmail

2011-03-05 Thread Victor Subervi
Hi; I have this code: #!/usr/bin/python import sys, os, string import cgitb; cgitb.enable() import cgi cwd = os.getcwd() dirs = string.split(cwd, '/') dirs = dirs[1:-1] backLevel = '/' + string.join(dirs, '/') sys.path.append(cwd) sys.path.append(backLevel) import string form = cgi.FieldStorage()

Re: Absolutely Insane Problem with Gmail

2011-03-06 Thread Victor Subervi
On Sat, Mar 5, 2011 at 11:11 PM, Littlefield, Tyler wrote: > >ourEmail = ' > myemaila...@gmail.com' > > >ourEmail = ' > q...@xxx.com' > > You redefine this twice. > Right. The second definition, of course, overwrites the first. That is deliberate. I simply comment out the second when I'm testin

How Translate This PHP

2011-03-06 Thread Victor Subervi
Hi; How do I translate this PHP code? if($ok){ echo "returnValue=1"; }else{ echo "returnValue=0"; } In other words, when the email successfully sends, send back both the name of the variable and its value. TIA, Beno -- http://mail.python.org/mailman/listinfo/python-list

Re: How Translate This PHP

2011-03-06 Thread Victor Subervi
On Sun, Mar 6, 2011 at 10:53 AM, Noah Hall wrote: > On Sun, Mar 6, 2011 at 2:45 PM, Victor Subervi > wrote: > > Hi; > > How do I translate this PHP code? > > > > if($ok){ > > echo "returnValue=1"; > > }else{ > > echo &qu

Re: How Translate This PHP

2011-03-09 Thread Victor Subervi
On Sun, Mar 6, 2011 at 12:00 PM, Noah Hall wrote: > On Sun, Mar 6, 2011 at 3:11 PM, Victor Subervi > wrote: > > Ah. I thought I had to "return" something! > > Well, based on what you asked, you would've, but based on the code, > all it was doing is printing

Re: Don't Want Visitor To See Nuttin'

2011-03-10 Thread Victor Subervi
On Wed, Mar 9, 2011 at 5:33 PM, Ian wrote: > On 09/03/2011 21:01, Victor Subervi wrote: > >> The problem is that it prints "Content-Type: text/html" to the screen >> > If you can see what is intended to be a header, then it follows that you > are not sendi

Re: Don't Want Visitor To See Nuttin'

2011-03-10 Thread Victor Subervi
On Thu, Mar 10, 2011 at 8:50 PM, Benjamin Kaplan wrote: > > print "Content-Type: text/html" > > print > > print ''' > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > > > > > > > > and this has worked in the past, so I'm surprised it doesn't work here. > > Don't understan

Re: Don't Want Visitor To See Nuttin'

2011-03-11 Thread Victor Subervi
On Fri, Mar 11, 2011 at 3:54 AM, Ian Kelly wrote: > On Wed, Mar 9, 2011 at 2:01 PM, Victor Subervi > wrote: > > Maya 2012: Transform At the Source > > Yow. You're designing a Maya 2012 website to help some travel company > bilk gullible people out of thousands of do

Re: Don't Want Visitor To See Nuttin'

2011-03-11 Thread Victor Subervi
On Fri, Mar 11, 2011 at 4:26 AM, Dennis Lee Bieber wrote: > On Thu, 10 Mar 2011 18:00:10 -0800 (PST), alex23 > declaimed the following in gmane.comp.python.general: > > > He's comp.lang.python's version of Sisyphus. Or maybe Sisyphus' > > boulder...I forget where I was going with this. > >

Try/Except/Yield/Finally...I'm Lost :-}

2007-11-28 Thread Victor Subervi
Hi; I am trying to find words in a document that are identical to any word in a vocabulary list, to replace that word with special markup. Let's say the word is "dharma". I don't want to replace the first few letters of, say "dharmawuhirfuhi". Also, to make matters more difficult, if the word "adha

Why Don't Return?

2007-12-03 Thread Victor Subervi
Hi; Here is sample function: def a(): b() print c def b(): c = "Hi" return c if __name__ == "__main__": a() then run a(). Throws error about c not being defined. How do I return c from b? TIA, Victor -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Don't Return?

2007-12-05 Thread Victor Subervi
Thanks :) On Dec 3, 2007 6:58 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Victor Subervi" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | def a(): > | b() > > Here is the error: should be > c = b() > > | print c >

Fill In a Form Automatically

2007-12-07 Thread Victor Subervi
Hi; I'm trying to fill in a Zope form automatically. I have this script, which works great for creating the page...but how do I write to it? import urllib2 theurl = 'example.com' protocol = 'http://' my_id = "test" text = "Hello, world!" realm_dir = '/a_dir/' realm1 = 'manage_addProduct/PageTempl

Re: Fill In a Form Automatically

2007-12-10 Thread Victor Subervi
Thanks! Mechanize looks really cool :)) Victor On Dec 7, 2007 4:11 PM, Ismail Dönmez <[EMAIL PROTECTED]> wrote: > Friday 07 December 2007 22:06:23 tarihinde Victor Subervi şunları > yazmıştı: > > Hi; > > I'm trying to fill in a Zope form automatically. I have this sc

Re: [Plone-Users] Why Can't I Do This?

2007-12-14 Thread Victor Subervi
...but applicable ONLY for that instance. The other solution provided is more universal ;) On Dec 14, 2007 10:41 AM, Encolpe Degoute <[EMAIL PROTECTED]> wrote: > Victor Subervi a écrit : > > Hi; > > Why can't I do this? > > > >>>> author = "

Re: [Plone-Users] Why Can't I Do This?

2007-12-14 Thread Victor Subervi
Great! Thanks! On Dec 14, 2007 10:38 AM, Eric Smith <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > Hi; > > Why can't I do this? > > > > >>> author = "By Juan Garcia" > > >>> if author[0:2] == "by " | &

Re: [Plone-Users] Why Can't I Do This?

2007-12-14 Thread Victor Subervi
whatever[0:2] will yield THREE characters, so my "by " is correct and "by" will fail every time :)) Victor On Dec 14, 2007 12:06 PM, Derek Broughton <[EMAIL PROTECTED]> wrote: > Encolpe Degoute wrote: > > > Derek Broughton a écrit : > >> Victor Sub

How Does This Static Variable Work?

2008-01-04 Thread Victor Subervi
Hi; I read this example somewhere, but I don't understand it <:-) Can someone please explain how static variables work? Or recommend a good how-to? import random def randomwalk_static(last=[1]): # init the "static" var(s) rand = random.random() # init a candidate value if last[0] < 0.1: #

Re: How Does This Static Variable Work?

2008-01-04 Thread Victor Subervi
Thanks. I'll study that. Victor On Jan 4, 2008 12:34 PM, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On Jan 4, 2008 10:17 AM, Victor Subervi <[EMAIL PROTECTED]> wrote: > > > Hi; > > I read this example somewhere, but I don't understand it <:-) Can >

Unicode Problem

2008-01-28 Thread Victor Subervi
Hi; New to unicode. Got this error: Traceback (most recent call last): File "", line 1, in File "", line 29, in tagWords File "/usr/local/lib/python2.5/codecs.py", line 303, in write data, consumed = self.encode(object, self.errors) UnicodeDecodeError: 'ascii' codec can't decode byte 0x

Anyone Know Unicode? Help!

2008-01-30 Thread Victor Subervi
Hi; Second post on this. Googling shows many others with same problem, but no answers! Help! New to unicode. Got this error: Traceback (most recent call last): File "", line 1, in File "", line 29, in tagWords File "/usr/local/lib/python2.5/codecs.py", line 303, in write data, consumed

Can´t Surf Python Pages in Windoze

2008-12-26 Thread Victor Subervi
Hi; I try to surf to this code in Windoze and it doesn't work...just posts a small, black screen for a split second. Why? print "Content-Type: text/html" print print """ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en"> Yeah """ Also, Zope is i

Re: Can´t Surf Python Pages in Windoze

2008-12-26 Thread Victor Subervi
On 12/26/08, Tino Wildenhain wrote: > > > print "Content-Type: text/html" >> print >> print """ >> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> >> http://www.w3.org/1999/xhtml"; xml:lang="en"> >> >> >> >> Yeah >> >> """ >> > > this could be fine if called in CGI context. Can you st

Re: Can´t Surf Python Pages in Windoze

2009-01-02 Thread Victor Subervi
On Fri, Dec 26, 2008 at 8:00 PM, Gabriel Genellina wrote: > En Fri, 26 Dec 2008 15:11:44 -0200, Victor Subervi < > victorsube...@gmail.com> escribió: > >> On 12/26/08, Tino Wildenhain wrote: >> > > print "Content-Type: text/html" >>>> pr

Re: Can´t Surf Python Pages in Windoze

2009-01-06 Thread Victor Subervi
On Fri, Jan 2, 2009 at 4:24 PM, Victor Subervi wrote: > On Fri, Dec 26, 2008 at 8:00 PM, Gabriel Genellina > wrote: > >> En Fri, 26 Dec 2008 15:11:44 -0200, Victor Subervi < >> victorsube...@gmail.com> escribió: >> >>> On 12/26/08, Tino Wildenhain w

How Get Name Of Working File

2009-03-22 Thread Victor Subervi
Hi; If I am writing a script that generates HTML, how do I grab the name of the actual file in which I am working? For example, let us say I am working in test.py. I can have the following code: import os dir = os.getcwd() and that will give me the working dir. But what about "test.py"? TIA, Vict

Printing Out Called Function Calls

2009-03-31 Thread Victor Subervi
Hi; Due to screwy problems at my server farm that they refuse to fix, I need to call lines that execute code from other files, like this: theContent += `tidBits[i][y][:-2]` but what that returns is this (as an example): tableTop(348,180) when I need it to execute the fn tableTop. What do? TIA,

Re: Printing Out Called Function Calls

2009-03-31 Thread Victor Subervi
> > change server famrs? > Really. But I imagine they are all trash for the price I pay. > > use eval() or exec()? > eval worked, exec no. Thanks! > > andrew > > -- http://mail.python.org/mailman/listinfo/python-list

Eval Problem

2009-04-06 Thread Victor Subervi
Hi: I have this code: x = 1 while x <= bitties: file = open(p + str(x) + ".txt") for line in file: print line print eval(bits[x - 1]) x += 1 which throws this error: [Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler mod_python.cgihandler: Traceback (most recent

Re: Eval Problem

2009-04-07 Thread Victor Subervi
ll nicely print the commands, such as this: tableTop(123,456) which is supposed to call said fn. If I place that line in the file calling the text files and the bits file it will execute just fine, but that inevitably makes my job harder. Ideas? TIA, Victor On Mon, Apr 6, 2009 at 6:37 PM, J. Clif

Re: Custom Classes?

2008-05-13 Thread Victor Subervi
On 5/9/08, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Thu, 08 May 2008 12:33:55 -0300, Victor Subervi < > [EMAIL PROTECTED]> escribió: > > Okay, trying this again with everything working and no ValueError or any > > other errors, here we go: > >

Re: Custom Classes?

2008-05-13 Thread Victor Subervi
> En Thu, 08 May 2008 12:33:55 -0300, Victor Subervi < > [EMAIL PROTECTED]> escribió: > > Okay, trying this again with everything working and no ValueError or any > > other errors, here we go: > > > > getpic = "getpic" + str(w) + ".py" >

Re: Custom Classes?

2008-05-15 Thread Victor Subervi
Well, you are right. It looks like one of those instances where I fixed something and did not check to see if it influenced the problem now at hand. Thanks again. Victor On 5/15/08, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Tue, 13 May 2008 15:10:21 -0300, Victor Suberv

Simplify Code

2008-07-15 Thread Victor Subervi
Hi; Forgive multiple posts in one day: online very infrequently I set the following variables: # Headers are kept in order to determine nesting of chapters # They are labeled according to font size h36 = '' h26 = '' h22 = '' h18 = '' h14 = '' h12 = '' header_sizes = [36, 26, 22, 18, 14, 12] # Size

Type Problem

2008-07-15 Thread Victor Subervi
Hi; Forgive multiple posts in one day: online very infrequently Why am I getting this error? import os dir_dict = {6:36, 5:26, 4:22, 3:18, 2:14, 1:12} cur_dir = os.getcwd() dirs = os.path.split(cur_dir) len = len(dirs) type(len(dirs)) Traceback (most recent call last): File "", line 1, in ty

Characters Being Misread

2008-07-15 Thread Victor Subervi
Hi; Forgive multiple posts in one day: online very infrequently I'm having the darndest time trying to figure out how the character '\b0' is being read in "('\x0c')" >>> test = re.search('(?<=\\b)[0]', '\x0c0') >>> test.group(0) '0' >>> type('\x0c') >>> import binascii >>> binascii.unhexlify('\x0c

Re: Simplify Code

2008-07-29 Thread Victor Subervi
Thanks. That worked. Victor On 7/16/08, Alexandr N Zamaraev <[EMAIL PROTECTED]> wrote: > > header_sizes = (36, 26, 22, 18, 14, 12) > if x not in header_sizes: > raise Exception() > else: > h36, h26, h22, h18, h14, h12 = tuple( >line if x == size else '' for x in header_sizes) > > > > -- > h

Windows Interpreter

2008-07-29 Thread Victor Subervi
Hi: I would like to make my windows python interpreter work like my linux one. I want to be able to cut and paste multiple lines of code. Now I can only paste one line at a time. I do not want it to indent automatically. How can I change this? TIA, Victor -- http://mail.python.org/mailman/listinfo/

RTF Parsing

2008-07-29 Thread Victor Subervi
Hi; I have this code: def a(): chars = ['\\i0', '\\u0', '\\qc', '\\b0', '\\ql', '\\i', '\\u', '\\b', '\\yz'] rtf_markup = 'viewkind4\uc1\pard\nowidctlpar\qc\i\f0\fs36 Who is like the Beast? Who can wage war against him?\par' for char in chars: c = '(?<=' + char + ')' test = re.search(c, rtf_mar

Re: Windows Interpreter

2008-07-29 Thread Victor Subervi
butt! And it indents automatically. How change that behavior. TIA, Victor On 7/29/08, Tim Golden <[EMAIL PROTECTED]> wrote: > > Victor Subervi wrote: > >> Hi: >> I would like to make my windows python interpreter work like my linux one. >> I want to be able to cut and paste

Re: Windows Interpreter

2008-07-29 Thread Victor Subervi
I´ll try that. Back online in a week. Victor On 7/29/08, Tim Golden <[EMAIL PROTECTED]> wrote: > > Victor Subervi wrote: > >> def a(): >> chars = ['\\i0', '\\u0', '\\qc', '\\b0', '\\ql', '\\i', '\\u&#

Cutting and Pasting in Windows IDLE

2008-08-12 Thread Victor Subervi
Hi; A couple of weeks ago I asked how to cut and paste multiple lines in the Windows IDLE interface. I can only paste one line at a time! Frustrating. I want it to work like my Linux interpreter. Why doesn´t it? Please help. Someone wrote this, which did not help at all: Well, I'm not really sure

Adding Images to MySQL

2008-04-01 Thread Victor Subervi
Hi; I´m trying to figure out how to upload images into a MySQL database. (Yes, that is what I want to do.) I have a form that asks for data, like this: 1ra Foto Pequeña: Then I send that form to a python script that processes like this: cursor.execute('insert into products (' + col_names + ') valu

Re: Adding Images to MySQL

2008-04-02 Thread Victor Subervi
is the c.execute statement. Please advise. TIA, Victor On Tue, Apr 1, 2008 at 1:37 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 01 Apr 2008 09:36:00 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > > > Hi; > > I´m trying to figure out how to upl

Strange MySQL Problem...

2008-04-02 Thread Victor Subervi
Hi; I have this code which works fine: #!/usr/local/bin/python import _mysql import MySQLdb, cPickle host = 'mysqldb2.ehost-services.com' user = 'user' passwd = 'pass' db = 'bre' print 'Content-Type: image/jpeg\r\n' print '\nHi!\n' connection = MySQLdb.connect(host=host, user=user, passwd=passwd,

Re: Strange MySQL Problem...

2008-04-03 Thread Victor Subervi
Comments in line... On Thu, Apr 3, 2008 at 12:35 AM, John Nagle <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > Define "no longer works". > Sorry. Throws HTTP 200 error. On Thu, Apr 3, 2008 at 12:35 AM, John Nagle <[EMAIL PROTECTED]> wrote: > John Nagle wrote: > > "works fine"? Please ch

Re: Strange MySQL Problem...

2008-04-03 Thread Victor Subervi
On Thu, Apr 3, 2008 at 9:34 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 03 Apr 2008 09:43:57 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > > >> Steve Holden wrote: > >> Define "no longer works". > > Sorry. Throws HTT

Re: Adding Images To MySQL

2008-04-05 Thread Victor Subervi
>* *(What a mess! I don't know where to begin...) Yeah. Never claimed to be any good at this :( Just persistent :) >* *- You say Content-Type: image/jpeg but you emit HTML code. You're lucky if you see any >* *text at all. Well, I tried Content-Type: text/html and that threw an HTTP 500 Error

Re: Adding Images To MySQL

2008-04-07 Thread Victor Subervi
in line... On 4/5/08, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Sat, 05 Apr 2008 11:32:00 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > > >> * *- You say Content-Type: image/jpeg but you emit HTML code. You're > >> lucky > >

String Literal to Blob

2008-04-08 Thread Victor Subervi
Hi: I am able (finally) to upload an image to the database. However, when I try to retrieve it, I get a string literal. Here is my code: #!/usr/local/bin/python import cgitb; cgitb.enable() import MySQLdb def test(): host = 'mysqldb2.ehost-services.com' user = 'user' passwd = 'pass' db = '

Re: String Literal to Blob

2008-04-08 Thread Victor Subervi
Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > Hi: > > I am able (finally) to upload an image to the database. However, when I > > try to retrieve it, I get a string literal. Here is my code: > > > > #!/usr/local/bin/python > > import cgitb;

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > Thanks. I apparently am printing some holder for the image. I stripped > > out > > most of it with this > > content[0][0] > > but then I am left with this: > > > > array('c', '\xff\xd8\xff\xe0\\0\x10JFI...) > > How do

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina > > <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: > > Now all you have to do is what I told you i

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > > On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote: > > connection = MySQLdb.connect(host=host, user=us

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > > On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote: > > > > I'm having a problem believing this, but I

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 1:49 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > I imagine the following code should do so, given yo

Re: String Literal to Blob

2008-04-10 Thread Victor Subervi
Okay, here is where we find the fly in the ointment. If I run this code: #! /usr/bin/python import MySQLdb print "Content-type: image/jpeg\r\n" host = 'mysqldb2.ehost-services.com' db = 'benobeno_bre' user = 'benobeno' passwd = '21122112' connection = MySQLdb.connect(host=host, user=user, passwd=p

Re: String Literal to Blob

2008-04-10 Thread Victor Subervi
Well, what I did was this: content = col_fields[0][14].tostring() pic = "tmp" + str(i) + ".jpg" img = open(pic, "w") img.write(content) print '' % pic img.close() where I am incrementing i. Ugly. Stupid. But if it is the only

Re: String Literal to Blob

2008-04-11 Thread Victor Subervi
Nope. Do not see it. My ugly stupid way works. I guess I will just proceed with that and write my howto accordingly. Victor On Thu, Apr 10, 2008 at 9:01 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 10 Apr 2008 14:04:43 -0300, Victor Subervi > <[EMAIL PROTE

Re: String Literal to Blob

2008-04-11 Thread Victor Subervi
. Victor On Fri, Apr 11, 2008 at 8:55 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > Nope. Do not see it. My ugly stupid way works. I guess I will just > > proceed with that and write my howto accordingly. > > Victor > > > OK, but be prepar

Re: String Literal to Blob

2008-04-12 Thread Victor Subervi
in line... On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > I have worked on this many hours a day for two weeks. If there is an > > easier way to do it, just take a minute or two and point it out. Have > > you hear

Re: String Literal to Blob

2008-04-14 Thread Victor Subervi
Thanks to all, especially Gabriel. The base64 is a good idea, but you state a definite problem. I will look at your code at home (offline)...thank you very much! It looks like the kicker is this line here: " % (picid, cgi.escape(title)) Now, why didn´t you share that before? I can see how cal

Re: String Literal to Blob

2008-04-15 Thread Victor Subervi
4 -0300, Steve Holden <[EMAIL PROTECTED]> > escribió: > > Victor Subervi wrote: > >> Thanks to all, especially Gabriel. [...] > >> Steve, thank you for all your help, but do overcome your temper :)) > > > > I'm glad the penny finally dropped. You may have bee

Re: String Literal to Blob

2008-04-16 Thread Victor Subervi
at 10:55 AM, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > It is published. On comp.lang.python. Google groups has it, so google > (search) will find it. > > Cheers, > Cliff > > > On Tue, 2008-04-15 at 17:04 +0200, Victor Subervi wrote: > > Gabriel; > > >

Importing My Own Script

2008-04-17 Thread Victor Subervi
Hi: How do I import my own script from a second script? That is, I have script x and I want to import script y. How? TIA, Victor -- http://mail.python.org/mailman/listinfo/python-list

More Fun With MySQL and Images

2008-04-17 Thread Victor Subervi
Hi again: Here is my code, an edit of Gabriel´s: #!/usr/local/bin/python import cgitb; cgitb.enable() import MySQLdb def test(): host = 'host' db = 'db' user = 'user' passwd = 'pass' db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db) cursor= db.cursor() cursor.execute('

Re: Importing My Own Script

2008-04-17 Thread Victor Subervi
[error] [client 190.166.0.245] PythonHandler mod_python.cgihandler: ImportError: No module named test2 I´m running through Plesk, if that makes a difference. TIA, Victor > > - Original Message > From: Victor Subervi <[EMAIL PROTECTED]> > To: python-list@python.org > Sen

Re: More Fun With MySQL and Images

2008-04-17 Thread Victor Subervi
Never mind. Apparently, these tags throw it for that loop: print '\n' I´m surprised they would, but gratified I found the problem. Victor On Thu, Apr 17, 2008 at 9:42 AM, Victor Subervi <[EMAIL PROTECTED]> wrote: > Hi again: > Here is my code, an edit of Gabriel´s: >

Re: More Fun With MySQL and Images

2008-04-17 Thread Victor Subervi
Yeah, I figured that out between posts ;) On Thu, Apr 17, 2008 at 10:39 AM, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > On Thu, 2008-04-17 at 09:52 -0500, Victor Subervi wrote: > > Never mind. Apparently, these tags throw it for that loop: > > print '\n' &g

Prob. w/ Script Posting Last Value

2008-04-17 Thread Victor Subervi
Hi; Gabriel provided a lovely script for showing images which I am modifying for my needs. I have the following line: print '\n' % (d, y) where the correct values are entered for the variables, and those values increment (already tested). Here is the slightly modified script it calls: #!/usr/loc

Re: Prob. w/ Script Posting Last Value

2008-04-17 Thread Victor Subervi
On Thu, Apr 17, 2008 at 1:07 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > > Hi; > > Gabriel provided a lovely script for showing images which I am modifying > > for my needs. I have the following line: > > print '\n' % (

Error Handling

2008-04-17 Thread Victor Subervi
Hi; I have the following code: try: cursor.execute(sql) print '¡Exito en introducir!' print 'Esta página va a regresar a la página principal del carrito de compras en 10 segundos.' except IntegrityError: print 'Lo siento, pero el ID que entraste está usado actualmen

Re: Importing My Own Script

2008-04-17 Thread Victor Subervi
Apr 18, 2008 at 12:34 PM, Ben Kaplan <[EMAIL PROTECTED]> > wrote: > > >It might be something in mod python. Try asking on their mailing > > list. > > > > - Original Message > > From: Victor Subervi <[EMAIL PROTECTED]> > > To: Ben Kaplan &

Another MySQL Images Question

2008-04-18 Thread Victor Subervi
Hi; If I grab an image in the database thus: sql = "select pic1 from products where id='" + str(id) + "';" cursor.execute(sql) pic1 = cursor.fetchall()[0][0].tostring() # pic1 = cursor.fetchall()[0][0] // either this or the above line and try and re-insert it thus: c

Re: Another MySQL Images Question

2008-04-18 Thread Victor Subervi
ting for whatever type of data you pass it. > > Cheers, > Cliff > > > On Fri, 2008-04-18 at 10:13 -0500, Victor Subervi wrote: > > Hi; > > If I grab an image in the database thus: > > > > sql = "select pic1 from products where id='&quo

Re: Error Handling

2008-04-22 Thread Victor Subervi
That worked. Thanks! Victor On Sun, Apr 20, 2008 at 11:02 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 17 Apr 2008 16:19:12 -0300, Victor Subervi < > [EMAIL PROTECTED]> escribió: > > > try: > > cursor.execute(sql) > > print

Goodbying Spaces

2008-04-25 Thread Victor Subervi
Hi; Whenever I call a field from the preceeding form using cgi.FieldStorage() I get a space on either side. I end up writing code like this to get rid of that space: try: if id[0] == ' ': id = id[1:len(id)] except: pass try: if id[len(id) - 1] == ' ': id = id[0:len(id) - 1] exce

Re: Goodbying Spaces

2008-04-29 Thread Victor Subervi
On Fri, Apr 25, 2008 at 4:29 PM, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > > Whats the result of using id.strip()?: > > In [1]: " asdfasdf ".strip() > Out[1]: 'asdfasdf' > > It should work, I guess... It didn´t for some reason. That was the first thing I tried. > > > Btw, you can write yo

Colors for Rows

2008-04-29 Thread Victor Subervi
Hi; why doesn't this work? z = 3 for d in id: z += 1 if z % 4 == 0: bg = '#ff' elif z % 4 == 1: bg = '#d2d2d2' elif z % 4 == 2: bg = '#F6E5DF' else: bg = '#EAF8D5' try: print '\n' % bg except: print '\n' It never increments z! Yet, if I print z,

Re: Colors for Rows

2008-04-29 Thread Victor Subervi
On Tue, Apr 29, 2008 at 11:11 AM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > On Tue, 29 Apr 2008 09:33:32 -0500 > "Victor Subervi" <[EMAIL PROTECTED]> wrote: > > why doesn't this work? > > First, let me remove some blank lines to reduce sc

Re: Colors for Rows

2008-04-30 Thread Victor Subervi
Thank you all. You helped clean up my code. The stupid mistake was in where I set the initial value of the variable z. Victor On Tue, Apr 29, 2008 at 3:20 PM, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > On Tue, 2008-04-29 at 15:39 -0400, D'Arcy J.M. Cain wrote: > > On Tue, 29 Apr 2008 15:03:23 -04

Custom Classes?

2008-04-30 Thread Victor Subervi
Hi; I have the following code which produces a file every time I need to display an image from MySQL. What garbage! Surely, python is capable of better than this, but the last time I asked for help on it, I got no responses. Is this only possible with custom classes? Please, give me some guidance

Re: Colors for Rows

2008-04-30 Thread Victor Subervi
The problem was that z was not incrementing. It kept getting reset to 3, then incremented to 4 immediately, and reset back to 3. Stupid :/ On Wed, Apr 30, 2008 at 11:01 AM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > On Wed, 30 Apr 2008 10:57:44 -0500 > "Victor Sube

Re: Custom Classes?

2008-05-01 Thread Victor Subervi
On Wed, Apr 30, 2008 at 12:35 PM, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > Post working code, and I'll answer your actual question. Good grief! The code is *not* double spaced! Take a look. Click to the end of the first line and hit the right arrow key, and see for yourself. As for not initi

Re: Custom Classes?

2008-05-02 Thread Victor Subervi
Thank you for your patience. I apologize for so many errors. Also, apparently your email client renders those double-spaces whereas mine does not. Hopefully the below is better: #!/usr/bin/python import MySQLdb import sys,os sys.path.append(os.getcwd()) from login import login user, passwd, db, h

Re: Custom Classes?

2008-05-08 Thread Victor Subervi
Okay, trying this again with everything working and no ValueError or any other errors, here we go: Load this code. Unless you use a similar login() script, you will want to edit your own values into the user, passwd, db and host: #!/usr/bin/python import MySQLdb import sys,os sys.path.append(os

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber wrote: > On Thu, 26 Nov 2009 13:32:12 -0500, Victor Subervi > declaimed the following in > gmane.comp.python.general: > > > > A problem occurred in a Python script. Here is the sequence of function > > calls leading up

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 9:02 AM, Rami Chowdhury wrote: > On Fri, Nov 27, 2009 at 02:59, Victor Subervi > wrote: > > On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber < > wlfr...@ix.netcom.com> > > wrote: > >> Nothing hinting at having > >> op

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 12:13 PM, Carsten Haese wrote: > Victor Subervi wrote: > > The difficulty I am having is that for > > some reason it's not inserting. The form inserts the first image but not > > the second. > > My guess is that you're not calling db.

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 1:43 PM, Dennis Lee Bieber wrote: > On Fri, 27 Nov 2009 05:59:39 -0500, Victor Subervi > declaimed the following in > gmane.comp.python.general: > > > > > > > > The following complained that there weren't enough arguments: > >

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
> > > > > > > > > The problem here is that only one of the images prints on the said page! > > However, if I surf to those URLs, the images appear! > > Are you sure that you're surfing to *exactly* those URLs? When I go to > http://www.angrynates.com/cart/getpic.py?pic=2&id=1, I get an image, but

Exec Statement Question

2009-11-29 Thread Victor Subervi
Hi; I have the following line of code: exec('%s()' % table) where 'table' is a variable in a for loop that calls variables from another script. I've made it so that it only calls one variable. I know for a fact that it's calling that variable in the script because it found errors in that script.

Re: Exec Statement Question

2009-11-30 Thread Victor Subervi
On Sun, Nov 29, 2009 at 10:23 PM, Dave Angel wrote: > exec is a statement, and statements don't have "return values." It's not > a function, so there are no parentheses in its syntax, either. exec is also > a technique of last resort; there's nearly always a better/safer/faster way > to accom

Completely OT

2009-11-30 Thread Victor Subervi
Hi; I need a recommendation. I want to print out data like this: blue red and enable the user to select the various colors he wants to add to a list that would populate itself on the same page where the selections are, and then, once he's selected all the colors he wants, click to add them all at

Re: Exec Statement Question

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 12:25 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Taking out the parenthesis did it! Thanks. Now, you state this is an > > option of last resort. Although this does indeed achieve my desired aim, > > here is a complete example of what I am t

Re: Completely OT

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 1:15 PM, Rami Chowdhury wrote: > On Mon, Nov 30, 2009 at 04:26, Victor Subervi > wrote: > > Hi; > > I need a recommendation. I want to print out data like this: > > > > blue > > red > > > > and enable the user to selec

Re: Exec Statement Question

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 1:12 PM, Dave Angel wrote: > Victor Subervi wrote: > >> On Sun, Nov 29, 2009 at 10:23 PM, Dave Angel wrote: >> >> >> >>> exec is a statement, and statements don't have "return values." It's >>> n

Re: Completely OT

2009-11-30 Thread Victor Subervi
that won't help me actually print to screen the user's choices as he selects them, which in my application, is important. Please advise. TIA, V > > On Mon, Nov 30, 2009 at 7:26 AM, Victor Subervi > wrote: > > Hi; > > I need a recommendation. I want to print out data

  1   2   3   4   5   6   >