win32com COMAdminCatalogObject Value method

2007-10-01 Thread rc
I'm trying to convert VB code that registers COM+ components to
Python. However, I'm unable to set values on COMAdminCatalogObject
using the Value() method, it seems to think I'm trying to call the get
method.

VB Code:
Dim cat As COMAdminCatalog
Set cat = New COMAdminCatalog
Dim apps As COMAdminCatalogCollection
Set apps = cat.GetCollection("Applications")
Dim app As COMAdminCatalogObject
Set app = apps.Add
app.Value("ID") = AppID


Python Code:
objCOMAdminCatalog =
win32com.client.Dispatch("COMAdmin.COMAdminCatalog")
objApplications = objCOMAdminCatalog.GetCollection("Applications")
objCOMAdminCatalogObject = objApplications.Add()
print "ID", objCOMAdminCatalogObject.Value("ID")  #This is returning
the random ID
# app.Value("ID") = AppID # SyntaxError: can't assign to function call
objCOMAdminCatalogObject.Value("ID", AppID) #Exception thrown

Returns the following error:
TypeError: Value() takes at most 2 arguments (3 given)

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


Re: win32com COMAdminCatalogObject Value method

2007-10-02 Thread rc
> Try objCOMAdminCatalogObject.SetValue("ID", AppID).
>
>  Roger- Hide quoted text -
>
> - Show quoted text -

When I try that I get exception:
AttributeError: Add.SetValue

I think the only valid methods are: Key(), Name(), Valid() and Value()

The thing I'm most confused about is that it seems to be getting into
the __getattr__ method, not the set, here's the whole error:
Traceback (most recent call last):
  File "C:\programming\python\dev\src\FullInstallScripts
\COMObjectFullInstall.py", line 74, in 
CreateApplication()
  File "C:\programming\python\dev\src\FullInstallScripts
\COMObjectFullInstall.py", line 21, in CreateApplication
objCOMAdminCatalogObject.SetValue("ID", AppID)
  File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 496, in __getattr__
raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: Add.SetValue

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


Re: win32com COMAdminCatalogObject Value method

2007-10-04 Thread rc
On Oct 2, 11:11 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Tue, 02 Oct 2007 12:12:09 -0300, rc <[EMAIL PROTECTED]> escribi?:
>
> >> Try objCOMAdminCatalogObject.SetValue("ID", AppID).
> > When I try that I get exception:
> > AttributeError: Add.SetValue
>
> I think you would get more help asking in [EMAIL PROTECTED]
>
> --
> Gabriel Genellina

Thank you, python-win32 was able to help.
makepy needed to be run on the COM object allowing SetValue to be
called:
win32com.client.gencache.EnsureModule(pywintypes.IID('{F618C513-
DFB8-11D1-A2CF-00805FC79235}'), 0x0, 1, 0)

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


pymssql - insert NULL to int

2007-10-17 Thread rc
How to insert NULL values in to int field using params.

I'm trying to use pymssql.execute, passing the operation and list of
params.  One of the values in the params is a NULL value going to int
field.  The pymssql._quote() puts ' around the NULL which causes an
exception to be thrown, is there a way to use the params for this or
do I need to build the insert string myself?

pymssql.DatabaseError: internal error: SQL Server message 245,
severity 16, state 1, line 1:
Conversion failed when converting the varchar value 'NULL' to data
type int.
DB-Lib error message 10007, severity 5:
General SQL Server error: Check messages from the SQL Server.

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


Re: pymssql - insert NULL to int

2007-10-17 Thread rc
On Oct 17, 11:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> rc wrote:
> > How to insert NULL values in to int field using params.
>
> > I'm trying to use pymssql.execute, passing the operation and list of
> > params.  One of the values in the params is a NULL value going to int
> > field.  The pymssql._quote() puts ' around the NULL which causes an
> > exception to be thrown, is there a way to use the params for this or
> > do I need to build the insert string myself?
>
> > pymssql.DatabaseError: internal error: SQL Server message 245,
> > severity 16, state 1, line 1:
> > Conversion failed when converting the varchar value 'NULL' to data
> > type int.
> > DB-Lib error message 10007, severity 5:
> > General SQL Server error: Check messages from the SQL Server.
>
> Can you show us the actual code you use? I doubt that such a basic thing
> isn't working.
>
> You are aware that you have to pass None, not "NULL"?
>
> Diez

I had tried None and was getting the same error as 'NULL', however, I
tried again after your post and its working now.  Not sure what I
changed but thanks for getting me to tried it again.

rc

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


XML parser

2008-10-20 Thread RC

By default the

document = xml.dom.minidom.parse(inputFileName.xml)

This will convert all the & to &
But I want to convert the & back to &

Is there a module or method in Python?
I know there is such method in PHP, but I am
new in Python.
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list


What are the syntax for &&, ||

2008-10-22 Thread RC


if condition1 && condition2: # and
doThis
elif condition3 || condition4: # or
doThat

In most of language have &&, ||

How do I do in Python?
--
http://mail.python.org/mailman/listinfo/python-list


Simple print to stderr

2008-10-27 Thread RC

By default the print statement sends to stdout
I want to send to stderr

Try

print "my meeage", file=sys.stderr

I got

SyntaxError: invalid syntax


I try

print "my message", sys.stderr

But it still sent to stdout.
What is the syntax?

I wouldn't understand Python's manual





print([object, ...][, sep=' '][, end='n'][, file=sys.stdout])¶

Print object(s) to the stream file, separated by sep and followed by end. 
sep, end and file, if present, must be given as keyword arguments.

All non-keyword arguments are converted to strings like str() does and 
written to the stream, separated by sep and followed by end. Both sep and end 
must be strings; they can also be None, which means to use the default values. 
If no object is given, print() will just write end.

The file argument must be an object with a write(string) method; if it is 
not present or None, sys.stdout will be used.


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


Sorting a list

2008-10-28 Thread RC

unsortedList = list(["XYZ","ABC"])

sortedList = unsortedList.sort()
print sortedList


Why this return None?
How do I get return as ["ABC", "XYZ"]?
--
http://mail.python.org/mailman/listinfo/python-list


JPype, Jython or JEPP?

2008-06-25 Thread RC

Dear Python Experts/Programmers,

I'm going to write a Python program to
access some Java class methods from our *.jar
file.
In your opinion, which way is the good (not the best)
way to do that?

JPype?
http://sourceforge.net/projects/jpype

Jython?
http://www.jython.org/Project/

JEPP? (I don't think so)
http://sourceforge.net/projects/jepp

Others?
http://. ?

Thank Q very much in advance!
--
http://mail.python.org/mailman/listinfo/python-list


Python compiler

2006-03-15 Thread Rc
Hello everybody
I'm a newbie, fromBelgium.
My question is where can I find a compiler for free.
For Windows XP.
Thanks
Roger
Sorry for  my English 


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


Re: Python compiler

2006-03-18 Thread Rc

"DaveM" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI"
> <[EMAIL PROTECTED]> wrote:
>
>>Après, vous pourrez aussi fréquenter le newsgroup :
>>fr.comp.lang.python
>>qui a l'avantage d'être en français.
>
> But perhaps he's a Flemish speaker - are you trying to start a riot?
>
> DaveM
Yes,I'm a Flemish speaker, I have been to school in the evening
to study Englisch and also now for the last year I'm study French.
To improve my English it's maybe good to work with English
newsgroupes.I'm not looking for a riot,because I don't understand
the word.By the way, in case to learn Python,they told me it's
the most esay language to start.
But ,my question is when I start Python it is a Dos Window
that opened.I think it is not possible on a XP computer?
Or am I wrong.
Thanks by advances
Rc



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

Re: Python compiler

2006-03-19 Thread Rc

"robert" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
> Rc wrote:
>> "DaveM" <[EMAIL PROTECTED]> schreef in bericht
>> news:[EMAIL PROTECTED]
>>
>>>On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI"
>>><[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>>Après, vous pourrez aussi fréquenter le newsgroup :
>>>>   fr.comp.lang.python
>>>>qui a l'avantage d'être en français.
>>>
>>>But perhaps he's a Flemish speaker - are you trying to start a riot?
>>>
>>>DaveM
>>
>> Yes,I'm a Flemish speaker, I have been to school in the evening
>> to study Englisch and also now for the last year I'm study French.
>> To improve my English it's maybe good to work with English
>> newsgroupes.I'm not looking for a riot,because I don't understand
>> the word.By the way, in case to learn Python,they told me it's
>> the most esay language to start.
>> But ,my question is when I start Python it is a Dos Window
>> that opened.I think it is not possible on a XP computer?
>> Or am I wrong.
>> Thanks by advances
>> Rc
>
> install Pythonwin (pywin32) for a GUI


Thank for the answers.But I have looked to several sites
where can I download that install Pythonwin(pywin32) for a GUI.
There are so much ,I don't no exactly, which site or which download.
Thanks by advance
Rc



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