Re: [Tutor] Problem installing MySQLdb under windows

2006-04-25 Thread Andy Koch
Kent Johnson wrote:
> Peter Jessop wrote:
>> I am running Python 2.4.3, MySQL 5.0.
>> On trying to install MySQLdb 1.2.1 I ran into the following problem.
>> "
>> D:\Python24\Lib\site-packages\MySQLdb>setup.py build
>> running build
>> running build_py
>> copying MySQLdb\release.py -> build\lib.win32- 2.4\MySQLdb
>> running build_ext
>> error: The .NET Framework SDK needs to be installed before building 
>> extensions f
>> or Python.
>>
>> "
>> Is it really necessary to install The .NET Framework SDK (354Mb) or is 
>> there a simpler way?
> 
> Download the windows binary, for example 
> http://prdownloads.sourceforge.net/mysql-python/MySQL-python.exe-1.2.0.win32-py2.4.zip?download
> 
> The latest version with a Windows build is 1.2.0.
> 
> Kent
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
Greetings Python group,

I have a question related to the MySQLdb, I have recently installed the 
1.2.0 version and it works fine.  However, I am running ver. 4.1 of 
MySQL and the problem is that the python client version does not support 
the new password protocol of MySQL 4.1+.  This only means that one must 
go into the MySQL and set the password using the OLD_PASSWORD function 
of MySQL.

The question, do any of the newer versions of MySQLdb support the new 
password protocol?  And if not, are there plans to implement this?

Disclosure: this is my first post in this group, also it may be worth 
noting that I'm learning python as a side effect of developing a Plone 
site.  So if my python knowledge comes across as a bit warped... well, 
Plone can sometimes be a strange thing ;)

Regards,

Andy Koch

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] die or exit function?

2006-06-13 Thread Andy Koch
Bkgd: I've been doing PHP for the last several years.

Q: In PHP there are functions die and exit which terminate processing of 
a script with an optional string output.  Is there something similar to 
this in Python?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] die or exit function?

2006-06-14 Thread Andy Koch
doug shawhan wrote:
> Hi Andy,
> 
> Putting a try:/except: loop in your __main__() (or whatever you call
> your base function) with sys.exit("Message") is pretty much the way I
> always do it.
> 
> try:
> gak = puke + die
> except:
> sys.exit("Oy!")
> 
> If you would like sys.exit() to provide you with a bit more
> information (like what actually happened during the failure and
> where!) I found this handy function:
> 
> 
> def formatExceptionInfo(maxTBlevel=5):
>   cla, exc, trbk = sys.exc_info()
>   excName = cla.__name__
>   try:
>   excArgs = exc.__dict__["args"]
>   except KeyError:
>   excArgs = ""
>   
>   excArgsString = ''
>   for item in excArgs:
>   excArgsString = excArgsString + ' ' + str(item)
>   
>   excTb = traceback.format_tb(trbk, maxTBlevel)
>   excTbString = ''
>   for item in excTb:
>   excTbString = excTbString + " " + str(item)
>   
>   report = "%s %s %s"%(excName, excArgsString, excTbString)
>   return(report)
> 
> This function now goes in most of what I do that requires error reporting.
> 
> Hope this helps!
> 
> On 6/13/06, Andy Koch <[EMAIL PROTECTED]> wrote:
>> Bkgd: I've been doing PHP for the last several years.
>>
>> Q: In PHP there are functions die and exit which terminate processing of
>> a script with an optional string output.  Is there something similar to
>> this in Python?
>>
>> ___
>> Tutor maillist  -  Tutor@python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
Hi Doug,

copied and pasted, thanks

although my reason for the die() was that I've started using Python to 
do DB maintenance. I find it very handy (ie IDLE) and the DB api's for 
all the different DB's I work with are nice and standardized (PHP could 
learn a thing there).  One thing that has happened, though, is that I've 
clicked (via Winders Explorer) on a .py to open it for edit only to it 
have run, which is not what I want when the code could start modifying 
data.  Thus far it hasn't caused any damage.  So my safety check is to 
do a raw_input from a commonly included module which does the sys.exit() 
if running the code is not desired.

A basic safety catch.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] UnicodeDecodeError in kinterbasdb

2007-04-05 Thread Andy Koch
Hello,

I've installed Python 25 on an XP machine, installed kinterbasdb (and 
eginix-mx-base).  Python works fine.

However, when I try to load the firebird module in IDLE I get ...


Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
(Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
 >>> import kinterbasdb
Traceback (most recent call last):
   File "", line 1, in 
   File "C:\Python25\Lib\site-packages\kinterbasdb\__init__.py", line 
98, in 
 _instPath, 'bin'
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 
237: ordinal not in range(128)


..

 From searching the web I'm led to think this is related to the default 
encodings on the machine.  But I'm not sure what to do about this.

For what it's worth, I have another machine and this same library works 
just fine.

Thank You,

Andy Koch

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor