Re: shutil.move has a mind of its own

2005-01-10 Thread drs
"Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Daniel Bickett wrote:

> > shutil.move( "C:\omg.txt" , "C:\folder\subdir" )
  ^  ^^ ^
> The problem is that backslash is the escape character. In particular,
> '\f' is a form feed.

> You have a couple of options:

You can also include an r to make it a raw string if extra or reversed
slashes look odd

shutil.move( r"C:\omg.txt" , r"C:\folder\subdir" )


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


Re: Newbie: Pythonwin

2005-01-12 Thread drs
"Brent W. Hughes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 1)  I'm running a program within Pythonwin.  It's taking too long and I
want
> to stop/kill it.  What do I do (other than ctrl-alt-del)?
>
Right click on the little python icon in the sys tray and select break into
running code



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


encryption/decryption help

2005-01-12 Thread drs
Hi, I need to send secure data over an insecure network.  To that end, I am
needing to encrypt serialized data and then decrypt it. Is there a builtin
way to do this in Python?  MD5, SHA, etc encrypt, but I am not seeing a way
to get back my data.  Encryption is totally new to me, so any pointers of
what to read up on would be appreciated.

As a side note, I understand that I could use https, but this would involve
changing things that I may not be at liberty to change -- though if this
turns out to be the best solution, then I'll find a way to use it.

Thanks


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


Random number generation from functions

2004-11-29 Thread drs
Is there any way to generate random numbers based on arbitrary real valued
functions? I am looking for something like random.gauss() but with natural
log and exponential functions.

thanks,

-d


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


Silly questions about True and False

2004-12-20 Thread drs
I just upgraded my Python install, and for the first time have True and
False rather than 1 and 0.  I was playing around at the command line to test
how they work (for instance, "if 9:" and "if True:" both lead to the
conditional being executed, but True == 9 -> False, that this would be true
was not obvious to me -- "True is True" is True, while "9 is True" is false
even though 9 evaluates to True.)  Anyhow, in doing my tests, I accidentally
typed

>>> False = 0

rather than

>>> False == 0

and I lost the False statement.
Thus,

>>> False
0

To get it back, I found that I could do

>>> False = (1 == 2)

which seems to put False back to False, but this seems weird.

>>> 1 = 0

throws an error (can't assign to literal), why doesn't False = 0 throw the
same error?  Also, why doesn't False = 0 make

>>> 1 == 2
0

Instead of False?

-d


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


mod_python, COM, on win2k3 server

2006-05-20 Thread drs
I have an application that runs on mod_python/apache using the publisher 
handler.  It uses an access db as the backend and connects via ADO.  In a 
test environment on XP it runs fine, but when on a win2k3 server it will 
load one page, but all subsequent page loads throw a 
pythoncom.CoInitializeEX error until I restart the apache.

Presumably, this is a threading issue, but I am not sure what the best 
approach to fixing it is.  Should I simply wrap all COM calls with 
pythoncom.CoInitialize/pythoncom.CoUninitialize calls, or is this somethig 
that needs to be done at a lower level.

This is mod_python 3.2, Python 2.3.5, apache2.0.*, win2k3, ado 2.8, and the 
server has 2 processors in case that matters.

Thanks,

-d 


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


Re: mod_python, COM, on win2k3 server

2006-05-20 Thread drs
Some details, and this is weirder than I thought.

It is working fine with internet explorer or mozilla as the client, but only 
crashes with Firefox.  Moreover, even while firefox is getting errors, IE 
stilll works fine.

The error I get is:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "C:\Python23\Lib\site-packages\mod_python\apache.py", line 299, in 
HandlerDispatch
result = object(req)

  File "C:\Python23\Lib\site-packages\mod_python\publisher.py", line 213, in 
handler
published = publish_object(req, object)

  File "C:\Python23\Lib\site-packages\mod_python\publisher.py", line 410, in 
publish_object
return publish_object(req,util.apply_fs_data(object, req.form, req=req))

  File "C:\Python23\Lib\site-packages\mod_python\util.py", line 439, in 
apply_fs_data
return object(**args)

  File "E:\http_server\timeslips\index.py", line 84, in index
rtn.append(ts_widget.make_employee_picker())

  File "C:\Python23\lib\site-packages\ecptimeslips\ts_widget.py", line 128, 
in make_employee_picker
rs = win32com.client.Dispatch("ADODB.Recordset")

  File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line 95, 
in Dispatch
dispatch, userName = 
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)

  File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 91, 
in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)

  File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 79, 
in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, 
pythoncom.IID_IDispatch)

com_error: (-2147221008, 'CoInitialize has not been called.', None, None)

? 


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