[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-28 Thread Ravi Teja P


Ravi Teja P  added the comment:

Hi

My CLA has been approved. Can someone review the PR.

--

___
Python tracker 
<https://bugs.python.org/issue41004>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-21 Thread Ravi Teja P


Ravi Teja P  added the comment:

Hi
I have raised a PR for this. But my PLA is yet to be updated (I have singed it).

But add the fix to the existing versions (3.8, 3.9 and 3.10), do I need to 
raise PR for each of those branches?

--

___
Python tracker 
<https://bugs.python.org/issue41004>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41004] Hash collisions in IPv4Interface and IPv6Interface

2020-06-21 Thread Ravi Teja P


Change by Ravi Teja P :


--
nosy: +rvteja92
nosy_count: 4.0 -> 5.0
pull_requests: +20204
pull_request: https://github.com/python/cpython/pull/21033

___
Python tracker 
<https://bugs.python.org/issue41004>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



help

2018-05-28 Thread Mutyala Veera Vijaya Teja
 Hello,
  This is vijayteja am getting an error like ssl certificate
failure when try to install packages. I've searched in the internet I've
not got any correct solution please maintain python's official blog which
contains all python issues and problems and how to solve them.

Thanks & Regards,


Mutyala Veera Vijay Teja

Software Developer

(M) +91- 8341841937

Skype ID: Veera Vijay Teja

<http://www.eunimart.com/>

[image: Facebook icon] <http://www.facebook.com/vijayteja30>[image:
LinkedIn icon] <http://www.linkedin.com/vijayteja30> [image: Twitter icon]
<https://twitter.com/eunimartltd> [image: Youtube icon]
<https://www.youtube.com/channel/UCmGtodAnLo8OeKHjgq6dBGQ>
-- 
https://mail.python.org/mailman/listinfo/python-list


[no subject]

2015-06-25 Thread Knss Teja via Python-list
I WANT TO install 4.3  version ... but the MSI file is giving a DLL error .. 
what should I do :/
please use REPLY ALL .. so that I get the mail to my gmail inbox-- 
https://mail.python.org/mailman/listinfo/python-list


Archiving emails in Gmail

2010-06-15 Thread teja
Hi,

I have a requirement that I want to log-in into a gmail account read
all unread mails, mark them as read and then archive them.
I am using libgmail (version 0.1.11) library to do so, using which I
am able to log-in into a gmail account fetch all unread message and
then read them one by one.
Now my problem is that I am not able to mark the unread mail as read
and archive it.

Below is sample code that I am using.


from libgmail import *

ARCHIVE_ACTION='rc_^i'  #the action string to archive a message
UNREAD_MAILS = is:unread

def ArchiveAll():
ga = GmailAccount(name='username', pw='password')
print 'logging in...',
ga.login()
print 'successful'

def _getAllUnreadMails():
return ga.getMessagesByQuery(UNREAD_MAILS, True)

def _readMail(email):
emailData = ga.getRawMessage(email)

def _archiveAndMarkRead(email):
ga._doThreadAction(ARCHIVE_ACTION, email)
ga._doThreadAction(U_MARKREAD_ACTION, email)

emails = _getAllUnreadMails()
for email in emails:
eData = _readMail(email)
#Process email data
_archiveAndMarkRead(email)

print 'done'

if __name__ == '__main__':
ArchiveAll()

after executing this code I am getting following error

HTTP Error 500: Internal Server Error
Traceback (most recent call last):
  File test_libgmail.py, line 30, in module
ArchiveAll()
  File test_libgmail.py, line 26, in ArchiveAll
[_archiveAndMarkRead(t) for t in sr[1]]
  File test_libgmail.py, line 21, in _archiveAndMarkRead
ga._doThreadAction(ARCHIVE_ACTION, thread)
  File /home/3rdparty/libgmail/libgmail.py, line 669, in
_doThreadAction
items = self._parsePage(_buildURL(**params))
  File /home/3rdparty/libgmail/libgmail.py, line 383, in _parsePage
items = _parsePage(self._retrievePage(urlOrRequest))
  File /home/3rdparty/libgmail/libgmail.py, line 99, in _parsePage
lines = pageContent.splitlines()
AttributeError: 'NoneType' object has no attribute 'splitlines'

Can anyone help me in figuring out what's going wrong here?
I guess google has deprecated this way of marking emails, correct me
if I am wrong here.
But if its true, is there any other way or library in Python to meet
my requirements?

Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Archiving emails in Gmail

2010-06-15 Thread teja
Ohh my bad...

thanks a lot for replying Alf..

The error which I've pasted above, was thrown before I modified the
code a bit..

Here's the error thrown on running the code I've pasted above..
there's not much of a difference in the error though.

HTTP Error 500: Internal Server Error
Traceback (most recent call last):
  File test_libgmail.py, line 40, in module
ArchiveAll()
  File test_libgmail.py, line 35, in ArchiveAll
_archiveAndMarkRead(email)
  File test_libgmail.py, line 28, in _archiveAndMarkRead
ga._doThreadAction(ARCHIVE_ACTION, email)
  File /home/3rdparty/test/libgmail/libgmail.py, line 670, in
_doThreadAction
items = self._parsePage(_buildURL(**params))
  File /home/3rdparty/test/libgmail/libgmail.py, line 384, in
_parsePage
items = _parsePage(self._retrievePage(urlOrRequest))
  File /home/3rdparty/test/libgmail/libgmail.py, line 99, in
_parsePage
lines = pageContent.splitlines()
AttributeError: 'NoneType' object has no attribute 'splitlines'

I tried to debug the issue here, when self._retrievePage(urlOrRequest)
is called (it is called internally in libgmail) a 500 internal server
error is thrown. And hence further processing on the response can not
be done.
I also caught the url which throws 500:
https://mail.google.com/mail/?ui=1search=allt=129374b41acebfcdview=upat=act=rc_^i

Now I don't know why 500 is thrown and on which side the exact problem
lies, i.e. the libgmail side or the gmail side.

And there's a email library provided in Python (supports both POP and
SMTP) but I dont know whether it allows us to archive mails or mark
them as read for that matter.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copy file over LAN

2008-03-26 Thread Teja
On Mar 27, 8:34 am, Astan Chee [EMAIL PROTECTED] wrote:
 Hi,
 I have afileon another machine on the localnetwork(my machine and
 local machines are on windows) and I want tocopyit locally. Now the
 machine requires authentication and when I try to do a
 import shutil
 shutil.copy(r'\\remotemachine\c$\temp\filename',r'C:\folder\test.txt')
 and it gives me a IOError: [Errno 13] Permission denied: error, which I
 expect. How do I provide authentication tocopythisfile?
 Thanks for the help.
 Cheers
 Astan

 --
 Formulations of number theory: Complete, Consistent, Non-trivial. Choose 
 two.

 Animal Logichttp://www.animallogic.com

 Please think of the environment before printing this email.

 This email and any attachments may be confidential and/or privileged. If you 
 are not the intended recipient of this email, you must not disclose or use 
 the information contained in it. Please notify the sender immediately and 
 delete this document if you have received it in error. We do not guarantee 
 this email is error or virus free.

Hi,

Is the folder where the file is present i.e. temp in your case,
shared
Can you share it and try it??

I  tried this way and it worked!

import shutil

shutil.copyfile(r'\\129.124.66.112\Samplesharedfolder\samplefile.txt',
r'C:\\Test\\temppp.txt')

Try this way and let me know
-- 
http://mail.python.org/mailman/listinfo/python-list


Regarding Threads and locals()

2008-03-20 Thread Teja
Hi all,

I have a GUI applicaion(along with threads). When the run button is
pressed in the GUI a separate thread starts( Thread is created using
beginthreadex) and does the
required activity.
Now, while the thread is being executed, i want the locals() present
inside the thread's run function to be avaialbe in the GUI class from
where the thread class is being created

EG:
 --
main.py
--
class WorkerThread(threading.Thread):

def __init__(self, ):
 threading.Thread.__init__(self)
 # Start the thread and invoke the run method
 self.start()

def run(self):
  # Start the thread. It executed self.func() as a separate
thread
  self.workerThread, tid = win32process.beginthreadex(None,
0 , self.func ,(), 1)
  ...

 def func(self):
   execfile(temp.py)

class GUI(wxFrame):
   def __init__(self):
   .
   .
   def  CreateThread(self):

 self.workerThread = WorkerThread()


if name == _main_:
.
.
..
-
temp.py
--
  i = 1
  j = 2
  k = 4
  while(1):
print i
print j
print k
i = 1+1
j = j+2
k = k + 3


Now, while the thread is executin func and printing i, j, k , In the
main GUI thread how do i get the values of i, j ,k
I tried with sys.modules, sys._current_frames, vars(). But nothing
worked out.

Ideally the locals() of func() should be passed to the GUI thread,
how?
-- 
http://mail.python.org/mailman/listinfo/python-list


COM server and EXE

2008-01-08 Thread Teja
Hi All,

I have a Python COM server. I need to deploy it on various sytems.
When I run the COM server from
python its showing an output  Registered : sample.lib

If I try to use the COM obj from a VB client like:

obj = CreateObject(sample.lib)

Its working fine without any errors

Now I am trying to convert this COM server to an exe through py2exe
and after I run the exe, I am
getting the same output  Registered : sample.lib

But If I try to use the COM obj from a VB client like

obj = CreateObject(sample.lib)

A console pops up saying  Registered : sample.lib and VB application
hangs there.
Its throwing a VB error that ActiveX object cannot be
created..etc etc

Any suggestions please...

Regards,
Tejovathi
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: COM server and EXE

2008-01-08 Thread Teja
On Jan 8, 3:33 pm, Teja [EMAIL PROTECTED] wrote:
 Hi All,

 I have a Python COM server. I need to deploy it on various sytems.
 When I run the COM server from
 python its showing an output  Registered : sample.lib

 If I try to use the COM obj from a VB client like:

 obj = CreateObject(sample.lib)

 Its working fine without any errors

 Now I am trying to convert this COM server to an exe through py2exe
 and after I run the exe, I am
 getting the same output  Registered : sample.lib

 But If I try to use the COM obj from a VB client like

 obj = CreateObject(sample.lib)

 A console pops up saying  Registered : sample.lib and VB application
 hangs there.
 Its throwing a VB error that ActiveX object cannot be
 created..etc etc

 Any suggestions please...

 Regards,
 Tejovathi

Here is my sample COM server and py2exe setup file

testCOM.py

import win32com.client
import os.path
import shutil
from win32api import Sleep
import string
import os
import sys
import pythoncom

class FirstEx:

_reg_clsid_ = {A6DE9DF8-5EBF-48E6-889E-C71CB84CFF2C}
pythoncom.frozen = 1
if hasattr(sys, 'importers'):
# In the py2exe-packed version, specify the module.class
# to use. In the python script version, python is able
# to figure it out itself.
_reg_class_spec_ = __main__.FirstEx
_reg_desc_ = My first COM server
_reg_progid_ = SAMPLE.Lib
_public_methods_ = ['init', 'Version']
_public_attrs_ = ['softspace', 'noCalls']
_readonly_attrs_ = ['noCalls']
_reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER

def __init__(self):
self.softspace = 1
self.noCalls = 0


def Version(self):
self.noCalls = self.noCalls + 1

# insert softspace number of spaces
return Version: 0.0.1


if __name__=='__main__':
import sys
if hasattr(sys, 'importers'):
# running as packed executable.
if '--register' in sys.argv[1:] or '--unregister' in
sys.argv[1:]:
# --register and --unregister work as usual
import win32com.server.register
win32com.server.register.UseCommandLine(FirstEx)
else:
# start the server.
from win32com.server import localserver
localserver.main()
else:
import win32com.server.register
win32com.server.register.UseCommandLine(FirstEx)

 Here is my setup file:

#Start here
from distutils.core import setup
import py2exe

setup(options = {py2exe: {compressed: 1,
  optimize: 2,
  ascii: 1,
  bundle_files: 1}},
zipfile = None,
com_server = [win32com.servers.interp],
console = [testCOM.py])
#End here


Here is my VB code:

Sub subRoutine()
Dim connection As Object
Dim returnvalue1 As String
Dim returnvalue2 As String
Dim flag3 As Boolean

Set connection = CreateObject(SAMPLE.Lib)
returnvalue1 = connection.Version()
MsgBox (returnvalue1)
End Sub


The non exe version of the COM server ie. directlly running the
testCOM.py registers the library properly and

in the VB application, the message box displays the version as 0.0.1.

But, after I create the EXE file using the setup.py file and run it,
it registers the library.

When I run the VB application, it hangs at the line

Set connection = CreateObject(SAMPLE.Lib)

and displays.  ACTIVEX cannot create the object

Any suggestions please


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


Re: Interop between C# and Python

2007-04-28 Thread Ravi Teja
On Apr 27, 8:25 pm, urielka [EMAIL PROTECTED] wrote:
 thx i will try this.

 i am also trying XML-RPC,i wrote a basic generator(in python) that
 genrate a Interface from the XML-RPC service module,but maybe with
 soaplib i don`t need this if i use wsdl as Visual Studio can generate
 the code from the wsdl

Typed remoting mechanisms (SOAP, CORBA, ICE etc) tend to be less work
with statically typed languages like C#. Untyped remoting mechanisms
are more convenient to work with dynamic languages (XML-RPC, JSON-RPC
etc). When combining them, typed one are more convenient because
working with typed systems is more convenient in dynamic languages
than it is to work with untyped systems in typed languages. Of course,
if the project is really small, none of this really matters. Pick your
poison.

Ravi Teja.

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


Re: Interop between C# and Python

2007-04-27 Thread Ravi Teja
On Apr 27, 6:09 pm, urielka [EMAIL PROTECTED] wrote:
 i need a easy way to write a Python Service(be it SOAP or JSONRPC or
 whatever) but i need to easily access it from C#,i created a web
 service in ZSI(which is really easy) like this:

 from ZSI import dispatch

 def hello():
 return hello

 dispatch.AsServer(port=8080)

 simple and easy but how i access it from C#,where is the wsdl for the
 service?

 is there any easier way to get this kind of interop?(not using a
 custom protocol over sockets)

 thx,
Uriel Katz

Use soaplib instead of ZSI. It has better WSDL support which makes it
easier to create client stubs from other languages.

http://trac.optio.webfactional.com/

Ravi Teja.

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


Helpbook and CHM

2007-04-19 Thread Teja
How to create a helpbook and display it using python(in Boa). Also,
how to generate CHM files in Boa(Python)???
Any pointers please

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


Re: Helpbook and CHM

2007-04-19 Thread Teja
On Apr 19, 3:48 pm, Tim Golden [EMAIL PROTECTED] wrote:
 Teja wrote:
  how to generate CHM files in Boa(Python)???

http://www.rutherfurd.net/software/rst2chm/index.html

 TJG

Can't I do it in Boa constructor ??? I have seen an option in Boa to
create a new helpbook and compile it to CHm and help files, But no
clue how to do it...

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


Re: Helpbook and CHM

2007-04-19 Thread Ravi Teja
On Apr 19, 3:58 am, Teja [EMAIL PROTECTED] wrote:
 On Apr 19, 3:48 pm, Tim Golden [EMAIL PROTECTED] wrote:

  Teja wrote:
   how to generate CHM files in Boa(Python)???

 http://www.rutherfurd.net/software/rst2chm/index.html

  TJG

 Can't I do it in Boa constructor ??? I have seen an option in Boa to
 create a new helpbook and compile it to CHm and help files, But no
 clue how to do it...

Not that I know of. Which version are you using? Where in the
application did you find it? Indicate the menu's you navigated to get
to that option.

MS HTML Help Workshop is the standard compiler for CHM files. There
are some other freeware/shareware. The workshop is simple enough
though.

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


Re: Helpbook and CHM

2007-04-19 Thread Teja
On Apr 19, 4:33 pm, Ravi Teja [EMAIL PROTECTED] wrote:
 On Apr 19, 3:58 am, Teja [EMAIL PROTECTED] wrote:

  On Apr 19, 3:48 pm, Tim Golden [EMAIL PROTECTED] wrote:

   Teja wrote:
how to generate CHM files in Boa(Python)???

  http://www.rutherfurd.net/software/rst2chm/index.html

   TJG

  Can't I do it in Boa constructor ??? I have seen an option in Boa to
  create a new helpbook and compile it to CHm and help files, But no
  clue how to do it...

 Not that I know of. Which version are you using? Where in the
 application did you find it? Indicate the menu's you navigated to get
 to that option.

 MS HTML Help Workshop is the standard compiler for CHM files. There
 are some other freeware/shareware. The workshop is simple enough
 though.

If u have Boa constructor 0.4.4, Go to File---New---helpbook

Save it. After saving, click File menu option and you will find, make
HTB and make CHM
But I dont know how to add files and generate a complete CHM file.


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


Re: Helpbook and CHM

2007-04-19 Thread Ravi Teja
Teja wrote:
 how to generate CHM files in Boa(Python)???

   http://www.rutherfurd.net/software/rst2chm/index.html

TJG

   Can't I do it in Boa constructor ??? I have seen an option in Boa to
   create a new helpbook and compile it to CHm and help files, But no
   clue how to do it...

  Not that I know of. Which version are you using? Where in the
  application did you find it? Indicate the menu's you navigated to get
  to that option.

  MS HTML Help Workshop is the standard compiler for CHM files. There
  are some other freeware/shareware. The workshop is simple enough
  though.

 If u have Boa constructor 0.4.4, Go to File---New---helpbook

 Save it. After saving, click File menu option and you will find, make
 HTB and make CHM
 But I dont know how to add files and generate a complete CHM file.

Right-click the file list view and select Add files. I didn't see
this Helpbook feature before. However, I could not get it to compile
after that. Unless, Boa Constructor is doing something while building
CHMs that integrates with the app development, I recommend that you
try a specialized tool for the job instead. Boa was an extremely
promising tool when I saw it about 6 yrs ago or so at 0.0.1 (it
already had a streamlined WYSIWYG GUI builder with a code aware editor
back then, something we still don't have elsewhere for Python). But
the development never seemed to gather steam since then. 0.4.4 is not
even listed as a release on the home page and it is almost 2 yrs old.

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


Kill thread

2007-04-09 Thread Teja
Hi all,

Can any on help me out in killing a thread (i.e deleteing the reources
like, stack ,memory etc) which is started with
win32process.beginthreadex()???

Rite now, I am suspending the thread. But any pointers as to how to
delete the thread permanently?

Its pretty urgent... Please...


Teja.P

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


Re: Kill thread

2007-04-09 Thread Teja
On Apr 9, 3:01 pm, Michel Claveau
[EMAIL PROTECTED] wrote:
 Hi!

 If you have the PID of the process (example: 1234), use this
 command-line :
TASKKILL/F /PID 1234

 --
 @-salutations

 Michel Claveau

Hi Michel,

Thnks for the replyBut TASKKILL kills the process entirely..Not
the thread.

I want only the thread to be killed.
Actually I am starting the thread in main thread. I jus want to kill
the child thread and
keep the main thread running.

With TASKKILL, the main thread is also exited...I dont want it to
happen..

Wht do i do??

Awaiting for a reply

Teja.P

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


Re: Kill thread

2007-04-09 Thread Teja
On Apr 9, 6:18 pm, Christian [EMAIL PROTECTED] wrote:
 On Apr 9, 5:14 am, Teja [EMAIL PROTECTED] wrote:

  Hi all,

  Can any on help me out in killing a thread (i.e deleteing the reources
  like, stack ,memory etc) which is started with
  win32process.beginthreadex()???

  Rite now, I am suspending the thread. But any pointers as to how to
  delete the thread permanently?

  Its pretty urgent... Please...

  Teja.P

 Well, the answer with Python threads is that you don't kill them - you
 ask them to go away.  But since you are using something in the pywin32
 package, that rule might not apply.  Perhaps you would have better
 luck asking on the python-win32 
 list:http://mail.python.org/mailman/listinfo/python-win32

 Christianhttp://www.dowski.com

Can TASKKILL kill threads? For the TASKKILL command

TASKKILL /F /PID 1234 , I gave thread id instead of PID

It didnt throw any error. Does that mean that thread is really killed,
releasing all its resources

How can I ensure that the thread is killed?






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


TASK KILL

2007-04-09 Thread Teja
Will TASKKILL kills a thread when thread id is given ?? Or does it
kill only a process??

How to ensure that a thread is killed?

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


Re: ZSI, SOAP and .NET web services - problem

2007-03-26 Thread Ravi Teja
On Mar 26, 3:47 pm, Jaroslaw Zabiello [EMAIL PROTECTED] wrote:
 Dnia Mon, 26 Mar 2007 20:06:28 + (UTC), David E. Konerding DSD staff
 napisa³(a):

  Try fixing your WSDL, then try again.

 The problem is I see no errors in my WSDL. Pythonic implementation of SOAP
 is just crapy.

 --
 Jaroslaw Zabiellohttp://blog.zabiello.com

As Lawrence suggested, did you try soaplib? It is a newer project. Try
the more recent svn version
svn co https://svn.optio.webfactional.com/soaplib/trunk soaplib

In my experience, it is more compliant than ZSI, although I mainly
used it as a server than a client.

Ravi Teja.

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


Re: Help me with this!!!

2007-02-01 Thread Ravi Teja
   It search a text inside that hex value.
   It works perfecly on a txt file but if I open a binary file (.exe,.bin
   ecc...) with the same value it wont work, why?
   Please help!

  Because the pattern isn't in the file, perhaps.

 This pattern IS in the file (I made it and I double check with an hex
 editor).
 It display the file correcltly (print line) but...

No! Peter is right. Regular expressions match ASCII representation of
data, not hex. In simple terms, do you see your pattern when you open
the file in notepad (or other text editor)? You do not use regex to
search binary files.

Ravi Teja.

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


Re: Hi, I'm new to python

2007-01-27 Thread Ravi Teja


On Jan 27, 5:37 am, [EMAIL PROTECTED] wrote:
 Hey Everyone

 Let me tell you all a little bit about my programming background so
 you can get an idea of my capability, or lack of, dealing with p.l;
 so far i've learned some visual basic when i was doing my a-levels
 and thats about it lol.

 Basically i like the sound of python and its ease of use and would
 like to know in depth more about it and its range of useage.  Please
 do tell me all you know, keeping in mind i am a n00b, so do be
 gentle. :)

 Thanks
 Millball54

Start Here
http://www.python.org/doc/
There is a ton of documentation tailored to learners with differing 
skills.

You might also want to pick up a book on Python.

Be sure to read the docs, use Google, search this group for similar 
questions in the past before you post questions. They are great 
resources. If you have very basic questions, IRC (freenode has a 
Python channel), is a better option. When you post, make the question 
as specific as possible. Sometimes typing a good question itself gives 
you an answer.

Ravi Teja.

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


Re: While loop with or? Please help!

2007-01-25 Thread Ravi Teja

 while usrinp != y or Y or N or n: PROBLEM

Correct way:
while usrinp != y or usrinp != Y or usrinp != N or usrinp != n:
There has to be a boolean evaluation on both sides of or.

Or in this case:
while usrinp not in ['Y', 'y', 'N', 'n']:

Ravi Teja.

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


Re: How to convert a string into an integer

2007-01-22 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
 Can you please tell me why the following code does not work in python?
 My guess is I need to convert 'count' from a string to an integer. How
 can I do that?
 And my understanding is python is a dynamic type language, should
 python convert it for me automatically?

 count = sys.argv[2]
 for i in range(count):
 #do some stuff

 Thank you.

You are confusing dynamic typing with weak typing. Weakly typed
languages (such as BASIC perform) such implicit conversions.

However, Python is dynamically and strongly typed.

With dynamic typing, the type information resides with the actual
object and not with the name referring to it. That simply means that
the type cannot be determined till the object is actually created (i.e
till runtime). But once created, the object does have a type.

So you will need to explicitly convert yourself. In this case with
int_value = int(string_value)

Ravi Teja.

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


Re: confused on python rpc with apache, is it possible?

2007-01-19 Thread Ravi Teja

krishnakant Mane wrote:
 On 19/01/07, Diez B. Roggisch [EMAIL PROTECTED] wrote:
 
  I'm unclear why you want the apache in there in the first place. Why don't
  you just create an e.g. twisted-based XMLRPC-server, and simply let that
  run? What is the apache intended for?


 twisted-based? what is that?  what is that.
 I am very new to xml-rpc so my questions may sound very basic.

All you have to do is Google when you have very basic questions
For example: twisted python xmlrpc

 any ways apache is doing nothing in there but I thought that if some
 thing needs to be done in php in the future then apache better be
 there but as I said that is no need if pythone can do it on a stand
 alone basis.

Use mod_python with some xmlrpc handler. There is more than one around.
Google for them. That way you can keep Apache for both Python and PHP.

Ravi Teja.

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


Re: Making a simple script standalone

2007-01-18 Thread Ravi Teja


On Jan 18, 2:19 pm, Rikishi 42 [EMAIL PROTECTED] wrote:
 On Thursday 18 January 2007 10:13, robert wrote:

  stay with py23 for a script (and more) and make 700kB
  independent distros - UPX and 7zip involved:

 http://groups.google.com/group/comp.lang.python/msg/edf469a1b3dc3802Thanks, 
 that might be an option. But I might just convince the person to
 let me install Python.  :-(

Like you note, it is far simpler to just install Python. Rarely does a
proper cost benefit analysis show any advantage for all the time you
put in for saving a few MB off the installer (since you noted that you
got it working with Py2Exe), especially when you seem to be installing
the app for just one person. How big is your Exe with Py2Exe? Say 3MB?
Is making it 1 MB worth maybe 2 hrs of your time for 1 install?

But just for kicks, check out ShedSkin. Since you mentioned that you
were using very few modules (ShedSkin supports os, stat, string, time),
it might just work. ShedSkin translates your Python code to fast C++
code that can be compiled to a tight app.

http://sourceforge.net/projects/shedskin/

Ravi Teja.

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


Re: I need to consume a .NET web service in a Python client

2007-01-12 Thread Ravi Teja

mohit wrote:
 Hello,

 I am a .NET developer experimenting with Python.
 I need to consume a .NET web service in a Python client. how do I go
 about it?
 which libraries do i need?
 pointers to help me get started would be much appreciated.
 I am just a newbie to the Python world so please be bear with my novice
 queries.

 thanks in advance,
 Mohit


Start Here
http://www.diveintopython.org/soap_web_services/index.html
Example Client
http://www.diveintopython.org/soap_web_services/first_steps.html

Ravi Teja

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


Re: Network failure when using urllib2

2007-01-08 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
 I have a script that uses urllib2 to repeatedly lookup web pages (in a
 spider sort of way).  It appears to function normally, but if it runs
 too long I start to get 404 responses.  If I try to use the internet
 through any other programs (Outlook, FireFox, etc.) it will also fail.
 If I stop the script, the internet returns.

 Has anyone observed this behavior before?  I am relatively new to
 Python and would appreciate any suggestions.

 Shuad

I am assuming that you are fetching the full page every little while.
You are not supposed to do that. The admin of the web site you are
constantly hitting probably configured his server to block you
temporarily when that happens. But don't feel bad :-). This is a common
Beginners mistake.

Read here on the proper way to do this.
http://diveintopython.org/http_web_services/review.html
especially 11.3.3. Last-Modified/If-Modified-Since in the next page

Ravi Teja.

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


Re: Network failure when using urllib2

2007-01-08 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
 I am fetching different web pages (never the same one) from a web
 server.  Does that make a difference with them trying to block me?
 Also, if it was only that site blocking me, then why does the internet
 not work in other programs when this happens in the script.  It is
 almost like something is seeing a lot of traffic from my computer, and
 cutting it off thinking it is some kind of virus or worm.  I am
 starting to suspect my firewall.  Anyone else have this happen?

 I am going to read over that documentation you suggested to see if I
 can get any ideas.  Thanks for the link.

 Shuad

No! What I suggested should not effect traffic from other servers. I
would go with Gabriel's suggestion and check for open connections just
in case. Although I can't imagine why that would give you a 404
response since it is a server response (implies successful connection).
I would expect that you would get a client error in such a case.

Of course, you can always rule out your suspicions of local conditions
(turn off security software briefly or try from a different machine)
unless your ISP is implementing safeguards against DOS attacks from
their network with normal users in mind.

Ravi Teja.

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


Re: private variables

2007-01-08 Thread Ravi Teja

belinda thom wrote:
 Hello,

 In what version of python were private variables added?

 Thanks,

 --b

Short answer - 1.5 (or - so long ago that it doesn't matter anymore)
Long answer - There are no true private variables in Python. Just
private variables names by convention.

See Python docs for a detailed explanation.

Ravi Teja.

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


Re: How to write temporary data to file?

2007-01-08 Thread Ravi Teja

Thomas Ploch wrote:
 Hi folks,

 I have a data structure that looks like this:

 d = {
   'url1': {
   'emails': ['a', 'b', 'c',...],
   'matches': ['d', 'e', 'f',...]
   },
   'url2': {...
 }

 This dictionary will get _very_ big, so I want to write it somehow to a
 file after it has grown to a certain size.

 How would I achieve that?

 Thanks,
 Thomas

Pickle/cPickle are standard library modules that can persist data.
But in this case, I would recommend ZODB/Durus.

(Your code example scares me. I hope you have benevolent purposes for
that application.)

Ravi Teja.

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


Re: How to write temporary data to file?

2007-01-08 Thread Ravi Teja

Thomas Ploch wrote:
 Ravi Teja schrieb:
  Thomas Ploch wrote:
  Hi folks,
 
  I have a data structure that looks like this:
 
  d = {
 'url1': {
 'emails': ['a', 'b', 'c',...],
 'matches': ['d', 'e', 'f',...]
 },
 'url2': {...
  }
 
  This dictionary will get _very_ big, so I want to write it somehow to a
  file after it has grown to a certain size.
 
  How would I achieve that?
 
  Thanks,
  Thomas
 
  Pickle/cPickle are standard library modules that can persist data.
  But in this case, I would recommend ZODB/Durus.
 
  (Your code example scares me. I hope you have benevolent purposes for
  that application.)
 
  Ravi Teja.
 

 Thanks, but why is this code example scaring you?

 Thomas

The code indicates that you are trying to harvest a _very_ (as you put
it) large set of email addresses from web pages. With my limited
imagination, I can think of only one group of people who would need to
do that. But considering that you write good English, you must not be
one of those mean people that needed me to get a new email account just
for posting to Usenet :-).

Ravi Teja.

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


Re: program deployment

2007-01-05 Thread Ravi Teja

king kikapu wrote:
 hi to all folks here,

 i am learning Python, just finished a book and i am starting to write
 programs.
 I just want to ask, is the correct way to deploy my programs to other
 computers, the .pyc files ??

 I now that with the -m compileall . switch can compile a .py file
 into bytecodes. So i suppose that if Python has to run a .pyc file, it
 will load and execute it faster. And if i have some sensitive data in
 my source, like passwords (and the source of cource!) they will be more
 secure in a compiled file.

 Is that correct ?

 Thanks a lot for any help!

Python code is normally deployed as straight source code. It gets
compiled  automatically on its first run and will subsequently load
this quickly. Passwords do not belong in the source code and they are
not secure simply by distributing bytecode instead. This applies to any
language, native or byte code compiled. Distributing bytecode may deter
non-technical users but that's just about it.

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


Re: How do I add users using Python scripts on a Linux machine

2007-01-02 Thread Ravi Teja

Ivan Voras wrote:
 Ramdas wrote:
  Well,
 
  I need to add users from a web interface for a web server, which runs
  only Python. I need to add users, set quotas and in future even look at
  managing ip tables to limit bandwidth.
 
  I know os.system(), but this has to be done through a form entry
  through a web interface.
 
  Anyways thanks, do advise if there more pythonic solutions

 What you're looking for is actually a pretty complex thing. You *could*
 in theory manage /etc/passwd (and its shadow file) - you can find
 crypto primitives like MD5 and DES on the 'net, but note that you must
 run your script under the 'root' account in order to write (and even
 read!) the passwd database. The same goes for using os.system and the
 built-in OS utility. Be aware of security implications if you're running
 your web server under the root account.

How about invoking scripts with SUID root set?

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


Re: How do I add users using Python scripts on a Linux machine

2007-01-02 Thread Ravi Teja
 
  How about invoking scripts with SUID root set?

 Linux seems to ignore SUID bit on scripts:

Yes. My bad. The work around was to use native launchers. I don't
remember the details. Perhaps with the interpreter embedded to launch
it in-process and to hard code the script paths (or at least a config
file/script pointing to them) for security.

 Anyway, you should definitely think about security issues. Not all
 people out there are friendly...

I agree. SUID is often risky.

Web applications such as webmin that do administrative functions
through a web interface require extra precautions for security such as
restricting access to specific IPs.

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


Re: C app and Python

2006-12-31 Thread Ravi Teja

Vertilka wrote:
 Hi,
 I need to create an application that the user ask for python script to
 run.
 this script will call the C application functions (in my app. the
 function will draw on screen).

 Do I need to create an extension ? Note that this is not a DLL, but a C
 application.
 or I need to embed Python in my C application.

 Thanks,
 Vertilka

A bit of both :-)
http://www.python.org/doc/ext/extending-with-embedding.html

Ravi Teja.

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


Re: Scaling pictures

2006-12-28 Thread Ravi Teja

Kajsa Anka wrote:
 I would like some advice, I'm going to build a small app that will, among
 other things, scale images so that they can be published on a web site. I've
 never done any image processing in python before so I would like to ask what
 is the best way of doing this, I will not do anything else than scaling the
 images.

 I found the Python Imaging Library but before I dive into that I would like
 to know if there is a better way of doing this.

Yes. Python Imaging Library (PIL) is the preferred Python way to do
this. The example is right in the documentation.
http://www.pythonware.com/library/pil/handbook/image.htm

from PIL import Image
import glob, os

size = 128, 128

for infile in glob.glob(*.jpg):
file, ext = os.path.splitext(infile)
im = Image.open(infile)
im.thumbnail(size, Image.ANTIALIAS)
im.save(file + .thumbnail, JPEG)

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


Re: Reverse of SendKeys??

2006-12-28 Thread Ravi Teja

Scripter47 wrote:
 Hey!

 I know there is a module named SendKeys.
 SendKeys module it can type strings as you where typing it, on the keyboard.
 But is there a module that does the reverse. A module that gets
 _anything_ what the keyboard writes.
 For example. If i type hey on my keyboard. Will the program get the
 string even if the program not is on focus..

PyHook is what you need.
http://www.cs.unc.edu/~parente/tech/tr08.shtml
It can signal for both global keyboard as well as mouse events.

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


Re: keypressed() function

2006-12-28 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
 I need a function (blocking or non-blocking) that tells me if a key has
 been pressed (even before it has been released etc.). Also, I would of
 course like to know _which_ key has been pressed.

 I know that this probably does not exist in the Python library already
 as a platform-independant abstraction (even though it probably could),
 but then I would at least like solutions that works on Windows and on
 Linux.

Hmm.. 2 questions on this today. On Windows PyHook will work. It
signals for both Key Up and Key Down events. However it is a Windows
only module making use of very platform specific API. I am not sure if
there is an equivalent for Linux.

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


Re: Xah's Edu Corner: Introduction to 3D Graphics Programing

2006-12-27 Thread Ravi Teja

Xah Lee wrote:

 Regarding VisualPython... i saw a demo in 2002 by a professor
 friend. I think it is good. Though, why is its licensing not GPL or
 otherwise Open Source? That's kinda odd since Pyhton is.

You are confusing VPython with Activestate's Visual Python IDE plugin
for Visual Studio.
From VPython's home page in very bold font - VPython is free and
open-source
http://www.vpython.org/

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


Re: merits of Lisp vs Python

2006-12-17 Thread Ravi Teja

Jean-Paul Calderone wrote:
 On 11 Dec 2006 03:01:32 -0800, Ravi Teja [EMAIL PROTECTED] wrote:
 Timofei Shatrov wrote:
 
  [snip]
 
 Of course, doctest is hardly the ultimate testing solution. But it does
 an admirable job for many cases where you don't need to setup elaborate
 tests.
 
  It's not surprising that no one uses this stuff for serious work.
 
 I have seen enough libraries that use doctest. Zope, Twisted and Paste
 are some of the popular Python projects in that use it. Epydoc supports
 it as well.

 Just as a factual correction, Twisted does not use doctests.

 Jean-Paul

You are right. I did a quick search on my Python Lib folder for that
post to list some well known projects. Twisted does have some doctests
in there but does not use them for actual testing (apparently, only to
check for doctest support).

Ravi Teja.

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


Re: merits of Lisp vs Python

2006-12-13 Thread Ravi Teja

Robert Uhl wrote:
 Ravi Teja [EMAIL PROTECTED] writes:

  Mark Tarver wrote:
 
  seems to show that Python is a cut down (no macros) version of Lisp
  with a worse performance.
 
  By that standard, every other mainstream dynamically typed language
  for you is a cut-down version of Lisp with worse performance.

 Pretty much;-)

 Fewer features, worse performance.  Why use 'em?

Usability. Especially when users quote a very significant difference
here.

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


Re: merits of Lisp vs Python

2006-12-11 Thread Ravi Teja

Kaz Kylheku wrote:
 Paddy wrote:
http://en.wikipedia.org/wiki/Doctest

 I pity the hoplelessly anti-intellectual douche-bag who inflicted this
 undergraduate misfeature upon the programming language.

 This must be some unofficial patch that still has a hope of being shot
 down in flames, right?

Sour grapes. Eh :-)
Or were you going to follow up with some intellectual argument to
support your adjectives?

1. pity
2. hopelessly
3. anti-intellectual
4. douche-bag
5. inflicted
6. undergraduate
7. misfeature
8. unofficial patch
9. shot down in flames

That's a lot of hate in 2 sentences for judging a novel feature you
barely came across.

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


Re: merits of Lisp vs Python

2006-12-11 Thread Ravi Teja

Timofei Shatrov wrote:
 But, you have to admit that it looks horrible (at least at the first glance). 
 If
 there's some programming style that I absolutely can't stand, it would be the
 one where programmer writes a huge block of commentary describing what a
 function does, followed by one-liner of code

You Sir, are no fan of Literate Programming :-).

 information in itself. With doctest it is even worse, because examples also
 contain superfluous information. Everyone can just copy-paste the code in REPL
 and see what happens when you execute it.

And doctest automates such REPL tests. Like macros, don't knock it till
you try it.

 Besides that, there are many reasons
 why tests should be stored in a separate file, or at least not in the same
 function that they are testing.

You need not have doctest as a part of source code. You can also create
a separate documentation file that contains prose as well as tests
intervening.

http://www.python.org/doc/lib/doctest-simple-testfile.html

Combine it with ReStructured Text and you have a wonderful
documentation and testing solution in one place. Personally, I like
this a lot better than Javadoc style documentation where usage examples
are often absent.

 Also Wikipedia article contains some Cons of doctest that look pretty nasty:

Of course, doctest is hardly the ultimate testing solution. But it does
an admirable job for many cases where you don't need to setup elaborate
tests.

 It's not surprising that no one uses this stuff for serious work.

I have seen enough libraries that use doctest. Zope, Twisted and Paste
are some of the popular Python projects in that use it. Epydoc supports
it as well.

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


Re: merits of Lisp vs Python

2006-12-11 Thread Ravi Teja

Mark Tarver wrote:
 Paul Rubin wrote:
  Mark Tarver [EMAIL PROTECTED] writes:
   How do you compare Python to Lisp?  What specific advantages do you
   think that one has over the other?
 
 http://google.com/search?q=python+lispbtnI=I'm+feeling+lucky

 Thanks;  a quick read of your reference to Norvig's analysis

 http://norvig.com/python-lisp.html

 seems to show that Python is a cut down (no macros) version of Lisp
 with a worse performance.

By that standard, every other mainstream dynamically typed language for
you is a cut-down version of Lisp with worse performance.

 The only substantial advantage I can see is
 that GUI, and Web libraries are standard.

Somehow you conveniently miss the fact that he stated that it is ...
1. An excellent language for his intended use.
2. Easy to use and learn.
3. Easier to read than Lisp.
4. Looks more like pseudo code than does Lisp.

Here is a quote from the same Peter Norvig

Python has been an important part of Google since the beginning, and
remains so as the system grows and evolves. Today dozens of Google
engineers use Python, and we're looking for more people with skills in
this language.

http://www.python.org/Quotes.html

 This confirms my suspicion
 that Lisp is losing out to newbies because of its
 lack of standard support for the things many people want to do.

You confirm things too easily :-).

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


Re: SOAP Server with WSDL?

2006-12-07 Thread Ravi Teja

tobiah wrote:
 Actually, do I have to make a WSDL?  Do people hand write these, or
 are there tools?  I don't really need to publish an interface.  I just
 want some in house apps to communicate.

Java and .NET based tools can auto-generate WSDL from code. Python does
not have such because function definitions do not contain the type
information required for such a tool. However , you can grab a free
Java (Netbeans with Enterprise pack) or .NET (Visual Studio Express)
IDE (or just the respective SDK if you don't mind reading through the
docs), create a stub function, mark it as a WebMethod, let it generate
the WSDL and pass it to wsdl2py that comes with ZSI. This is a twisted
approach.

But you state that you don't need to publish an interface. If that is
the case, it can be as simple as this.

  import SOAPpy
  def hello():
  return Hello World

  server = SOAP.SOAPServer((localhost, 8080))
  server.registerFunction(hello)
  server.serve_forever()

Pasted from
http://pywebsvcs.sourceforge.net/soappy.txt

 I can't figure out if I want SOAP, or CORBA, or would it just be
 easier if I just starting opening sockets and firing data around
 directly.  Ideally, I'd like to share complex objects.  That's why
 I thought that I needed one of the above standards.

I posted a few days ago a simple guide to choosing a remoting
framework.
http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/f53221adfca5c819/58057e83c0ad7c27?rnum=1hl=enq=webraviteja_done=%2Fgroup%2Fcomp.lang.python%2Fbrowse_frm%2Fthread%2Ff53221adfca5c819%2F3f056c5c87279aca%3Flnk%3Dgst%26q%3Dwebraviteja%26rnum%3D4%26hl%3Den%26#doc_3f056c5c87279aca

For *complex* objects, you need a stateful remoting mechanism. The
choice is Pyro if both the server and all the clients are written in
Python. Else, use CORBA or ICE with DMI. All of these are simple to use
for simple remote object invocations although distributed computing in
general does have a learning curve.

Ravi Teja.

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


Re: How to compile omniORBpy on Windows?

2006-12-04 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
 How do I compile omniORBpy 3.0 on Windows?  The readme.txt file seems
 to talk only about how to do this on Unix.  Unfortenuately, I can not
 use the binary because I need to use Python 2.3.5. (and the binary
 requires that I use Python 2.4).

 I tried to copy the omniORBpy 3.0 source code to top\src\lib of omniORB
 4.1 and then tried to execute a make export in top\src (this did not
 compile omniORBpy).  I also tried a make export in
 top\src\lib\omniORBpy-3.0 and this fails.

 Note, I was able to compile omniORB 4.1 on Windows w/o a problem.  I am
 using VS .NET 2003 (VC 7) on W2K.

 Many thanks for your help.

This is certainly not the best advice. But how about just downloading
an older release which did support Python 2.3 (unless you want the
latest and greatest)?
http://downloads.sourceforge.net/omniorb/omniORBpy-2.6-win32-python2.3.zip?modtime=1115987834big_mirror=1

Hopefully you will get a more pertinent reply from the OmniORB mailing
list :-).

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


Re: How to realize the interactive python in Eclipse?

2006-12-03 Thread Ravi Teja

purple wrote:
 I have installed the Eclipse and the plug-in Pydev. Also, I have add an
 python program in the external tools. When I run the python program in
 the external tools, i can type python command just like in the python
 shell.But when I finished running a python file, in the console, I
 could not type any command to check some argument generated in the
 process. Is there any way I can make it?
 thank you~~

I am beginning to wonder if you attempting to use PyDev as nothing more
than a programmer's editor. PyDev is a lot more. You need not debug
this way since it includes a visual debugger. Be sure to read the
documentation at the web site.

http://pydev.sourceforge.net/debug.html
http://pydev.sourceforge.net/faq.html

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


Re: How good is CORBA?

2006-11-27 Thread Ravi Teja
On Nov 21, 11:20 am, Sai Krishna M [EMAIL PROTECTED] wrote:
 there are certainly client/server interactions.

But are they cross-language interactions?

This is how I would choose to distribute code.
Same machine, all in Python - organize in modules in Python path.
Different machines, all in Python - Pyro
Different machines, different languages, stateless calls, simple use -
XMLRPC/ReST
Different machines, different languages, stateless calls, more complex
requirements - SOAP
Different machines, different languages, statelful, typed - CORBA
(omniORB is the best bet at Python end)

ICE
A lot of the CORBA folks have been mad with ICE because it is subtly
discrediting CORBA while not being a standard. It is cleaner, comes
with good documentation, supports more languages than any single ORB
(however you are stuck with only those languages that ZeroC implements
support for). For simple apps, I would stick with omniORBPy. It is not
any more complicated than ICE. While ICE is simpler on the whole, you
will likely use only a fraction of the CORBA/ICE feature set. So the
difference won't necessarily show.

I like my tools to be simple. Lately, I have been happily using JSON
over HTTP.

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


Re: Python script and C++

2006-11-27 Thread Ravi Teja
Thuan Seah Tan wrote:
 Hi all,

 I am new to python  and currently I am working on a traffic simulation
 which I plan to define the various agents using scripting. It's kind of like
 scripting for non-playable character in games. I am thinking of using python
 for this but I am concerned with running time. Is scripting a lot slower
 compared to direct implementation in C++? Does compiling the script help in
 any way?

Python is perfectly suitable for this use. Python was in use in video
games in this way when computers were a lot slower. I doubt that you
will need to bother compiling the script or see any observable
enhancement if you do.

One example I can remember is Kingdom Under Fire (2001).

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


Re: Will GPL Java eat into Python marketshare?

2006-11-16 Thread Ravi Teja
 Personally, I've never gotten jpype to work.  Is it just me, or is it
 a troublesome install?

 Harry George
 PLM Engineering Architecture

It works fine for me now. However, I do recall having an issue a while
ago (most likely me, rather than JPype).

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


Re: Programming Language that is Spreadsheet/Table Based

2006-11-05 Thread Ravi Teja
Omar wrote:
 I'm looking for a programming language or module that sorta looks and
 feels like MS Excel (I love and think in tables), yet has the power and
 open-endedness of python or javascript.  I'm still pretty new to
 python.

PyCells
http://pycells.pdxcb.net/
http://pycells.pdxcb.net/wiki/index.php?title=Basic_Tutorial

 any ideas?  i've been having some fun with VBA in excel
 but I want something I can save as en exe and call my own creation, y'know?

You can also do Excel automation using Python.
http://www.markcarter.me.uk/computing/python/excel.html

There are many packaging tools for Python. Py2exe is the most popular.
Although in Excel's case, it would be difficult to make stand alone.

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


Regular Expression for a string

2006-11-01 Thread Teja
HI all,

I need to write a regular experssion for a string which satisfies the
following a criteria :

1) it should start with an alphabet
2) it can contain alphabets/digits/_ from second character
3) it can contain [a-z] or [0-9] at the end. but this is optional

 can any one please help me out pls


Teja.P

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


Re: Regular Expression for a string

2006-11-01 Thread Teja

James Stroud wrote:

 Teja wrote:
  HI all,
 
  I need to write a regular experssion for a string which satisfies the
  following a criteria :
 
  1) it should start with an alphabet
  2) it can contain alphabets/digits/_ from second character
  3) it can contain [a-z] or [0-9] at the end. but this is optional
 
   can any one please help me out pls
 
 
  Teja.P
 

 This is as general as could be constructed given your vague requirements:

 [a-zA-Z][a-zA-Z0-9_]+

 You may need to provide examples.

 James



 --
 James Stroud
 UCLA-DOE Institute for Genomics and Proteomics
 Box 951570
 Los Angeles, CA 90095

 http://www.jamesstroud.com/

Thnks James for ur quick reply.
Here is what I want actually

Some examples

string1
string_1
string1[0]
string_1_str[a]
STRING_1_[2]
STRING_1_str[a][1][2]

etc
etc

I need a regular expression for such strings

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


Re: Regular Expression for a string

2006-11-01 Thread Teja

Roy Smith wrote:

 In article [EMAIL PROTECTED],
  Teja [EMAIL PROTECTED] wrote:

  HI all,
 
  I need to write a regular experssion for a string which satisfies the
  following a criteria :
 
  1) it should start with an alphabet

 I assume you mean, It should start with a letter?

  2) it can contain alphabets/digits/_ from second character
  3) it can contain [a-z] or [0-9] at the end. but this is optional

 How about:  ^[a-zA-Z][a-zA-Z0-9_]*[a-z0-9]?$

 Probably many variations on that theme will also work.

Thnks Roy for ur quick reply.
Here is what I want actually

Some examples

string1
string_1
string1[0]
string_1_str[a]
STRING_1_[2]
STRING_1_str[a][1][2]

etc
etc

I need a regular expression for such strings

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


Re: Regular Expression for a string

2006-11-01 Thread Teja

John Machin wrote:

 Teja wrote:
  HI all,
 
  I need to write a regular experssion for a string which satisfies the
  following a criteria :
 
  1) it should start with an alphabet
  2) it can contain alphabets/digits/_ from second character
  3) it can contain [a-z] or [0-9] at the end. but this is optional

 Based on the examples you give later, you don't mean optional (0 or 1
 occurrences), you mean 0 or more occurrences.
 Assuming alphabet means English alphabetic:

 r[a-zA-Z][a-zA-Z0-9_]*(\[[a-z0-9]\])*
 
 HTH,
 John

Thnks a lot:)

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


Get coordinates of a cell

2006-10-26 Thread Teja
I have a GUI application with a Frame and a grid in it. I want to popup
a menu after the user enters some text in a cell and hits ENTER key. I
was able to popup the menu. However the menu is not popping up exactly
at the position where I want it. It should be popped up immediately
after the cell in which the user has entered the text. To get the co
ordinates I am using the function event.GetPosition(). Here event is
wx.EVT_KEY_DOWN. Any pointers please?

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


Re: More Noob Questions

2006-10-19 Thread Ravi Teja
 1) I'm also learning to program flash movies while I learn to do
 python.  How can one implement flash movies into their python code?

Depending on what implementing flash movies into Python code means.
Python and Flash can be complementary. You can develop the UI in Flash
and have it talk to Python via web services. I suppose that you can
embed the Flash Player control in a wxPython app as well and drive it
from there.

But such integrations typically deal with some slightly advanced issues
that are best left aside in context of a beginner.

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


Re: Rapid desktop application development

2006-10-19 Thread Ravi Teja

Stephen Eilert wrote:
 Hi all,

 There has been much hype lately about web megaframeworks, like
 TurboGears, Django and Rails(Ruby side). Those are all fantastic
 frameworks, nicely integrated so that the user can focus on solving his
 problem, instead of doing all the scaffolding and framework integration
 by hand.

 Now, I am not a fan of web applications so I'm creating a few GUI
 applications using Python. Thanks to wxPython, those are all
 native-looking, with powerful components. This is quite nice. Now, I
 want to use some OR-Mapper, so I chose SQLObjects. This is nice too. I
 do have to write controllers, model, and all the glue code between the
 frameworks by hand.

 However, I don't have to do that with a framework such as TurboGears,
 for web applications. Everything is neatly integrated so that I just
 have to fill in the blanks. It would be the same application, except
 that the presentation is GUI-based, instead of Web-based. MVC
 architecture too and so on.

 Are there any frameworks like those, for GUI applications? It would be
 interesting to abstract away that repetitive work.

Dabo
http://dabodev.com/

TraitsUI
http://code.enthought.com/traits/

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


Re: COM Error -- Urgent help

2006-10-17 Thread Teja
Méta-MCI wrote:
 Hi!


 .func(  is not defined...


 @-salutations
 --
 Michel Claveau

I am sorry. By func(dest) I meant MyNavigate(dest). Can u please help
me out...

Thnks, 
Teja.P

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


Re: COM Error -- Urgent help

2006-10-17 Thread Teja

Fredrik Lundh wrote:
 Teja wrote:

  I am sorry. By func(dest) I meant MyNavigate(dest). Can u please help
  me out...

 nobody here can read your mind.  please post the code you're actually
 using, *and* the error you're getting.

 /F

Thnks for your immediate reply.

Here is the code:

I have a class GenericFunctions which is defined as
follows:

import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1

class GenericFunctions:

   def __init__(self):
 print In Constructor of Generic Functions

   def MyNavigate(self,dest):
 ie.Navigate(dest)


Now there  is another file Main.py which is defined as follows:

import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()

def threadFunction(self,dest):
pythoncom.CoInitialize()
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
obj.MyNavigate(dest)  # this is gving an error.
pythoncom.CoUninitialize()

if __name__ == __main__:

s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,i­­e)

   thread.start_new_thread(self.nav, (s,'www.google.com')

I am getting an attribute error

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


Re: COM Error -- Urgent help

2006-10-17 Thread Teja

Dennis Lee Bieber wrote:
 On 17 Oct 2006 00:58:59 -0700, Teja [EMAIL PROTECTED] declaimed
 the following in comp.lang.python:

 thread.start_new_thread(self.nav, (s,'www.google.com')
 
  I am getting an attribute error

   That can not be the REAL code... I'd expect a syntax error... You
 have mismatched parens on that line!
 --
   WulfraedDennis Lee Bieber   KD6MOG
   [EMAIL PROTECTED]   [EMAIL PROTECTED]
   HTTP://wlfraed.home.netcom.com/
   (Bestiaria Support Staff:   [EMAIL PROTECTED])
   HTTP://www.bestiaria.com/

Hi,

Ya its a copy paste error... But can u please let me know what is the
reason for attribute error and how to rectify it??

Thnks, 
Regards
Teja.P

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


Re: COM Error -- Urgent help

2006-10-17 Thread Teja

Diez B. Roggisch wrote:
 Teja wrote:

 
  Dennis Lee Bieber wrote:
  On 17 Oct 2006 00:58:59 -0700, Teja [EMAIL PROTECTED] declaimed
  the following in comp.lang.python:
 
  thread.start_new_thread(self.nav, (s,'www.google.com')
  
   I am getting an attribute error
 
  That can not be the REAL code... I'd expect a syntax error... You
  have mismatched parens on that line!
  --
  Wulfraed Dennis Lee Bieber   KD6MOG
  [EMAIL PROTECTED][EMAIL PROTECTED]
  HTTP://wlfraed.home.netcom.com/
  (Bestiaria Support Staff:[EMAIL PROTECTED])
  HTTP://www.bestiaria.com/
 
  Hi,
 
  Ya its a copy paste error... But can u please let me know what is the
  reason for attribute error and how to rectify it??

 How many times need you a beating with a clue-stick?

 Post the _actual_ code, not something that closely resembles it - in _your_
 opinion

 Post the error message

 And before you do all this, read:

 http://www.catb.org/~esr/faqs/smart-questions.html

 Diez


OK Ok .. Here is the final code thats giving an error:

GenericFunctions.py
--

import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1

class GenericFunctions:
def __init__(self):
print In Constructor of Generic Functions
def MyNavigate(self,dest):
ie.Navigate(dest)
---
MainThread.py
--

import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()
import sys,traceback


def threadFunction(s,dest):
pythoncom.CoInitialize()
try:
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
#d.MyNavigate(dest)
obj.MyNavigate(dest)  # this is gving an error.
except:
my_ie = None
print traceback.print_exc(file= sys.stdout)
pythoncom.CoUninitialize()

if __name__ == __main__:

s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)

thread.start_new_thread(threadFunction, (s,'www.google.com'))


-
And here is the error:

Traceback (most recent call last):
  File C:\Documents and Settings\dzxbrn\Desktop\Stop Test\13
Oct\MainThread.py, line 13, in threadFunction
obj.MyNavigate(dest)  # this is gving an error.
  File C:\Documents and Settings\dzxbrn\Desktop\Stop Test\13
Oct\GenericFunctions.py, line 9, in MyNavigate
ie.Navigate(dest)
  File C:\Python24\Lib\site-packages\win32com\client\dynamic.py, line
489, in __getattr__
raise AttributeError, %s.%s % (self._username_, attr)
AttributeError: internetexplorer.application.Navigate
None


This is highly urgent and important... Please help me out

Thnks  Regards,
Tejovathi.P

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


Re: COM Error -- Urgent help

2006-10-17 Thread Teja
This is the trae back ,can you help me please.

Traceback (most recent call last):
  File C:\Documents and Settings\dzxbrn\Desktop\Stop Test\13
Oct\MainThread.py, line 13, in threadFunction
obj.MyNavigate(dest)  # this is gving an error.
  File C:\Documents and Settings\dzxbrn\Desktop\Stop Test\13
Oct\GenericFunctions.py, line 9, in MyNavigate
ie.Navigate(dest)
  File C:\Python24\Lib\site-packages\win32com\client\dynamic.py, line
489, in __getattr__
raise AttributeError, %s.%s % (self._username_, attr)
AttributeError: internetexplorer.application.Navigate
None
Fredrik Lundh wrote:
 Teja wrote:

  s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,i­­e)
 
 thread.start_new_thread(self.nav, (s,'www.google.com')
 
  I am getting an attribute error

 the traceback tells you what attribute Python was looking for, and may also 
 provide
 additional clues.  can you post the traceback too?  make sure you include all 
 of it.
 
 /F

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


COM and threads

2006-10-16 Thread Teja
HI all,

I have a problem in accesing COM objects in threads. To be precise,
lets assume that I have a class GenericFunctions which is defined as
follows:

import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1

class GenericFunctions:

   def __init__(self):
 print In Constructor of Generic Functions

   def MyNavigate(self,dest):
 ie.Navigate(dest)


Now there  is another file Main.py which is defined as follows:

import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()

class Mainclass:
   def __init__(self);
print In Constructor of Main class

   def threadFunction(self,dest):
pythoncom.CoInitialize()
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
obj.func(dest)  # this is gving an error.
pythoncom.CoUninitialize()

if __name__ == __main__:

s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)
 thread.start_new_thread(self.nav, (s,'www.google.com')

Basically, I want to access object of GenericFunctions class inside
threadFunction(). However I was able to execute
my_ie.Navigate(google.com). But that was not I wanted. I am not
knowing where the error is
Please let me know the solution ASAP...

Teja.P

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


Re: Attribute error

2006-10-16 Thread Teja

Max Erickson wrote:
 Teja [EMAIL PROTECTED] wrote:

  Hi all,
 
  What is attribute error? what causes that error, especially with COM
  objects?
 
  To be precise :
 
  Attribute Error: LCAS.LabcarController.writeLogWindow()
 
  Here, LCAS is a COM object
 
  Thanks
  Teja.P
 

 LabcarController might be a function. See:

 http://groups.google.com/group/comp.lang.python/msg/d7341f1aedcae6d3

 for more detail.

 hope this helps,
 max


HI all,

I have a problem in accesing COM objects in threads. To be precise,
lets assume that I have a class GenericFunctions which is defined as
follows:

import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1

class GenericFunctions:

   def __init__(self):
 print In Constructor of Generic Functions

   def MyNavigate(self,dest):
 ie.Navigate(dest)


Now there  is another file Main.py which is defined as follows:

import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()

class Mainclass:
   def __init__(self);
print In Constructor of Main class

   def threadFunction(self,dest):
pythoncom.CoInitialize()
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
obj.func(dest)  # this is gving an error.
pythoncom.CoUninitialize()

if __name__ == __main__:

s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)
 thread.start_new_thread(self.nav, (s,'www.google.com')

Basically, I want to access object of GenericFunctions class inside
threadFunction(). However I was able to execute
my_ie.Navigate(google.com). But that was not I wanted. I am not
knowing where the error is
Please let me know the solution ASAP...

Teja.P

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


Re: COM error

2006-10-16 Thread Teja

Neil Cerutti wrote:
 On 2006-10-14, Teja [EMAIL PROTECTED] wrote:
  What is ValueError: argument is not a COM object ? I get this
  error when I try to pass a COM object to a thread.
 
  Any pointers

 Try passing it to Larry Bird, instead. He's bound to score some
 points.

 Seriously, the function you called expected a COM object and you
 passed it something else. Without seeing more code, it's hard to
 be any helpfuller.

 --
 Neil Cerutti

HI all,

I have a problem in accesing COM objects in threads. To be precise,
lets assume that I have a class GenericFunctions which is defined as
follows:

import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1

class GenericFunctions:

   def __init__(self):
 print In Constructor of Generic Functions

   def MyNavigate(self,dest):
 ie.Navigate(dest)


Now there  is another file Main.py which is defined as follows:

import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()

class Mainclass:
   def __init__(self);
print In Constructor of Main class

   def threadFunction(self,dest):
pythoncom.CoInitialize()
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
obj.func(dest)  # this is gving an error.
pythoncom.CoUninitialize()

if __name__ == __main__:

s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)
 thread.start_new_thread(self.nav, (s,'www.google.com')

Basically, I want to access object of GenericFunctions class inside
threadFunction(). However I was able to execute
my_ie.Navigate(google.com). But that was not I wanted. I am not
knowing where the error is
Please let me know the solution ASAP...

Teja.P

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


Re: COM and Threads

2006-10-16 Thread Teja

Teja wrote:
 Roger Upole wrote:
  Teja [EMAIL PROTECTED] wrote:
  
   Roger Upole wrote:
  
   Teja [EMAIL PROTECTED] wrote:
   
Roger Upole wrote:
   
Teja [EMAIL PROTECTED] wrote:
I have an application which uses COM 's Dispatch to create a COM 
based
 object. Now I need to upgrade the application to a threaded one. But
 its giving an error that COM and threads wont go together. 
 Specifically
 its an attribute error at the point where COM object is invoked. Any
 pointers please??

   
An actual traceback would help.
At a guess, when using COM in a thread
you need to call pythoncom.CoInitialize and
CoUninitialize yourself.
   
 Roger
   
Actually Roger, this is the scenario
   
I create a COM object at the beginnning of the main thread. In the sub
thread, I need to access the same instance of the COM object. If it
were a normal object ie. not a COM obj, i was able to do it. But if it
were a COM object, its giving an attribute error? Should I pass a COM
object to the thread. If so How? Please let me know ASAP... Thnks
   
  
   To pass COM objects between threads, usually they'll need to be marshaled
   using pythoncom.CoMarshalInterThreadInterfaceInStream, and unmarshaled
   with pythoncom.CoGetInterfaceAndReleaseStream.
  
Roger
  
   I really appreciate your quick replyCan u please let me know how to
   do marshalling and unmarshalling or any good refrences to do it.
   Because i tried to do it. I got some errors ans so I left it...
  
   Thnks again...
  
 
  Here's a simple example using Internet Explorer.
 
  import win32com.client, pythoncom, thread
  ie=win32com.client.Dispatch('internetexplorer.application')
  ie.Visible=1
 
  def nav(istream, dest):
  pythoncom.CoInitialize()
  d=pythoncom.CoGetInterfaceAndReleaseStream(istream, 
  pythoncom.IID_IDispatch)
  my_ie=win32com.client.Dispatch(d)
  my_ie.Navigate(dest)
  pythoncom.CoUninitialize()
 
  s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)
  thread.start_new_thread(nav, (s, 'www.google.com'))
 
Roger

 Thnks a lot Roger, Its working gr8..Now, once the thread is started
 with start_new_thread, is there any way to terminate it upon user's
 request. I have explored and found out that there is no thread.kill().
 So wht to do now?

 Teja

HI all,

I have a problem in accesing COM objects in threads. To be precise,
lets assume that I have a class GenericFunctions which is defined as
follows:

import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1

class GenericFunctions:

   def __init__(self):
 print In Constructor of Generic Functions

   def MyNavigate(self,dest):
 ie.Navigate(dest)


Now there  is another file Main.py which is defined as follows:

import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()

class Mainclass:
   def __init__(self);
print In Constructor of Main class

   def threadFunction(self,dest):
pythoncom.CoInitialize()
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
obj.func(dest)  # this is gving an error.
pythoncom.CoUninitialize()

if __name__ == __main__:

s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)
 thread.start_new_thread(self.nav, (s,'www.google.com')

Basically, I want to access object of GenericFunctions class inside
threadFunction(). However I was able to execute
my_ie.Navigate(google.com). But that was not I wanted. I am not
knowing where the error is
Please let me know the solution ASAP...

Teja.P

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


Re: ADO with Python

2006-10-16 Thread Ravi Teja
Ralf wrote:
 Is their anybody with xperience in using the both and can provide me with
 some xamples.

Googling for python ado returns this simple tutorial
http://www.markcarter.me.uk/computing/python/ado.html

COM access in Python is straight forward with win32all.

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


COM Error -- Urgent help

2006-10-16 Thread Teja
HI all,

I have a problem in accesing COM objects in threads. To be precise,
lets assume that I have a class GenericFunctions which is defined as
follows:


import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1


class GenericFunctions:


   def __init__(self):
 print In Constructor of Generic Functions


   def MyNavigate(self,dest):
 ie.Navigate(dest)


Now there  is another file Main.py which is defined as follows:


import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()


class Mainclass:
   def __init__(self);
print In Constructor of Main class


   def threadFunction(self,dest):
pythoncom.CoInitialize()
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
obj.func(dest)  # this is gving an error.
pythoncom.CoUninitialize()


if __name__ == __main__:


s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,i­e)

 thread.start_new_thread(self.nav, (s,'www.google.com')


Basically, I want to access object of GenericFunctions class inside
threadFunction(). However I was able to execute
my_ie.Navigate(google.com). But that was not I wanted. I am not
knowing where the error is
Please let me know the solution ASAP... 


Teja.P

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


Re: COM and Threads

2006-10-13 Thread Teja

Roger Upole wrote:

 Teja [EMAIL PROTECTED] wrote:
 
  Roger Upole wrote:
 
  Teja [EMAIL PROTECTED] wrote:
  I have an application which uses COM 's Dispatch to create a COM based
   object. Now I need to upgrade the application to a threaded one. But
   its giving an error that COM and threads wont go together. Specifically
   its an attribute error at the point where COM object is invoked. Any
   pointers please??
  
 
  An actual traceback would help.
  At a guess, when using COM in a thread
  you need to call pythoncom.CoInitialize and
  CoUninitialize yourself.
 
   Roger
 
  Actually Roger, this is the scenario
 
  I create a COM object at the beginnning of the main thread. In the sub
  thread, I need to access the same instance of the COM object. If it
  were a normal object ie. not a COM obj, i was able to do it. But if it
  were a COM object, its giving an attribute error? Should I pass a COM
  object to the thread. If so How? Please let me know ASAP... Thnks
 

 To pass COM objects between threads, usually they'll need to be marshaled
 using pythoncom.CoMarshalInterThreadInterfaceInStream, and unmarshaled
 with pythoncom.CoGetInterfaceAndReleaseStream.

  Roger

I really appreciate your quick replyCan u please let me know how to
do marshalling and unmarshalling or any good refrences to do it.
Because i tried to do it. I got some errors ans so I left it...

Thnks again...

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


Re: COM and Threads

2006-10-13 Thread Teja

Roger Upole wrote:
 Teja [EMAIL PROTECTED] wrote:
 
  Roger Upole wrote:
 
  Teja [EMAIL PROTECTED] wrote:
  
   Roger Upole wrote:
  
   Teja [EMAIL PROTECTED] wrote:
   I have an application which uses COM 's Dispatch to create a COM based
object. Now I need to upgrade the application to a threaded one. But
its giving an error that COM and threads wont go together. 
Specifically
its an attribute error at the point where COM object is invoked. Any
pointers please??
   
  
   An actual traceback would help.
   At a guess, when using COM in a thread
   you need to call pythoncom.CoInitialize and
   CoUninitialize yourself.
  
Roger
  
   Actually Roger, this is the scenario
  
   I create a COM object at the beginnning of the main thread. In the sub
   thread, I need to access the same instance of the COM object. If it
   were a normal object ie. not a COM obj, i was able to do it. But if it
   were a COM object, its giving an attribute error? Should I pass a COM
   object to the thread. If so How? Please let me know ASAP... Thnks
  
 
  To pass COM objects between threads, usually they'll need to be marshaled
  using pythoncom.CoMarshalInterThreadInterfaceInStream, and unmarshaled
  with pythoncom.CoGetInterfaceAndReleaseStream.
 
   Roger
 
  I really appreciate your quick replyCan u please let me know how to
  do marshalling and unmarshalling or any good refrences to do it.
  Because i tried to do it. I got some errors ans so I left it...
 
  Thnks again...
 

 Here's a simple example using Internet Explorer.

 import win32com.client, pythoncom, thread
 ie=win32com.client.Dispatch('internetexplorer.application')
 ie.Visible=1

 def nav(istream, dest):
 pythoncom.CoInitialize()
 d=pythoncom.CoGetInterfaceAndReleaseStream(istream, 
 pythoncom.IID_IDispatch)
 my_ie=win32com.client.Dispatch(d)
 my_ie.Navigate(dest)
 pythoncom.CoUninitialize()

 s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)
 thread.start_new_thread(nav, (s, 'www.google.com'))

   Roger

Thnks a lot Roger, Its working gr8..Now, once the thread is started
with start_new_thread, is there any way to terminate it upon user's
request. I have explored and found out that there is no thread.kill().
So wht to do now?

Teja

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


Thread termination

2006-10-13 Thread Teja
Hi all,

Does any one know how to terminate or kill a thread that is started
with start_new_thread() in the middle of its execution?

Any pointers?

Thanks in advance

Teja.

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


COM error

2006-10-13 Thread Teja
What is ValueError: argument is not a COM object ? I get this error
when I try to pass a COM object to a thread.

Any pointers

Thanks

Teja

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


terminate execfile

2006-10-13 Thread Teja
How to terminate execfile() in the middle of its execution. Any
pointers ???
Its very urgent please


Thanks
Teja.P

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


Re: terminate execfile

2006-10-13 Thread Teja

Teja wrote:

 How to terminate execfile() in the middle of its execution. Any
 pointers ???
 Its very urgent please


 Thanks
 Teja.P

Can I raise an interrupt using PyErr_SetInterrupt??? Is so , does any
one know how to do it?

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


Attribute error

2006-10-13 Thread Teja
Hi all,

What is attribute error? what causes that error, especially with COM
objects?

To be precise :

Attribute Error: LCAS.LabcarController.writeLogWindow()

Here, LCAS is a COM object

Thanks
Teja.P

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


COM and Threads

2006-10-12 Thread Teja
I have an application which uses COM 's Dispatch to create a COM based
object. Now I need to upgrade the application to a threaded one. But
its giving an error that COM and threads wont go together. Specifically
its an attribute error at the point where COM object is invoked. Any
pointers please??

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


Re: COM and Threads

2006-10-12 Thread Teja

hg wrote:

 Teja wrote:
  I have an application which uses COM 's Dispatch to create a COM based
  object. Now I need to upgrade the application to a threaded one. But
  its giving an error that COM and threads wont go together. Specifically
  its an attribute error at the point where COM object is invoked. Any
  pointers please??
 

 If COM is not thread safe, then use processes

Thanks a LOT for your reply.. Can u please tell me how to
processes..

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


Re: COM and Threads

2006-10-12 Thread Teja

Roger Upole wrote:

 Teja [EMAIL PROTECTED] wrote:
 I have an application which uses COM 's Dispatch to create a COM based
  object. Now I need to upgrade the application to a threaded one. But
  its giving an error that COM and threads wont go together. Specifically
  its an attribute error at the point where COM object is invoked. Any
  pointers please??
 

 An actual traceback would help.
 At a guess, when using COM in a thread
 you need to call pythoncom.CoInitialize and
 CoUninitialize yourself.

  Roger

Actually Roger, this is the scenario

I create a COM object at the beginnning of the main thread. In the sub
thread, I need to access the same instance of the COM object. If it
were a normal object ie. not a COM obj, i was able to do it. But if it
were a COM object, its giving an attribute error? Should I pass a COM
object to the thread. If so How? Please let me know ASAP... Thnks

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


Re: COM and Threads

2006-10-12 Thread Teja

hg wrote:

 Teja wrote:
  hg wrote:
 
  Teja wrote:
  I have an application which uses COM 's Dispatch to create a COM based
  object. Now I need to upgrade the application to a threaded one. But
  its giving an error that COM and threads wont go together. Specifically
  its an attribute error at the point where COM object is invoked. Any
  pointers please??
 
  If COM is not thread safe, then use processes
 
  Thanks a LOT for your reply.. Can u please tell me how to
  processes..
 

 I gather pywin32 gives you the trick to do it (CreateProcess ?) as I
 gather forking is not available under Windows.

Hg, This is the scenario..

I create a COM object in main. I need to access that object in a thread
or subprocess or whatever. Can u pls tell me how to do it. Its a COM
object.

Thnks

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


Re: newbie IronPython compiled scripts speed question

2006-09-24 Thread Ravi Teja
In most cases, carefully examine why you need native code at all. Since
a good number of performance sensitive CPython modules are in fact
written in C to begin with, the improvements may not always be
significant.

I don't know about your application but here are some general
observations. Beginers are often enamored with native code. This is
normal. Unless your application is explicitly low level, native code is
not worth bothering with.

 thanks, I'll check out psyco's documentation, since unfortunately the
 scripts will be run on a Windows box, and using a compiler other than
 VC++ is not an option...

1.) mingw works quite well for writing Python extensions.
2.) ctypes is a great way to incorporate native code. Create a dll in
whatever native language you please and call it from Python.
3.) Since you are on just MS Windows, you can use COM to wrap your
native code.

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


Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Ravi Teja
 A trivial question - I have a working Python script that I have to
 invoke from C++ code. No fancy stuff - just run the whole script with
 its parameters. No callbacks, no signalling - nada, just
 stupid,primitive, straightforward call.

 And while there is a lot of help on embedding, I could not find out how
 to run script as a whole.SOS

System::Diagnostics::Process::Start

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


Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Ravi Teja
 A trivial question - I have a working Python script that I have to
 invoke from C++ code. No fancy stuff - just run the whole script with
 its parameters. No callbacks, no signalling - nada, just
 stupid,primitive, straightforward call.

 And while there is a lot of help on embedding, I could not find out how
 to run script as a whole.SOS

System::Diagnostics::Process::Start

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


Re: Writing Video conference software for Windows

2006-09-22 Thread Ravi Teja
 Someone said about VNC... I'll take a look, but since it is an
 exercise I need to do it,

Exercises typically need you to implement, not invent (leave that for a
thesis or a dissertation). Rather than invent VNC, you could just
implement it on your own from the specs.

http://realvnc.com/docs/rfbproto.pdf

 I can't just say someone else arelady did that :)

No. But you can build upon it :-). Few construct software from the
scratch.

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


Re: Writing Video conference software for Windows

2006-09-21 Thread Ravi Teja
 I need to write a software that allow to see the desktop

That would be the VNC protocol. Don't reinvent the wheel.

VNC is relatively efficient in that it only updates the portions of the
screen that changed.

Maybe this project could be your starting point.
PyVNC
http://bdash.net.nz/blog/2005/07/17/pyvnc-the-beginnings-of-a-python-vnc-client/

 and hear the
 microphone capture of a remote PC across a network.
 I need to do that
 for a unviresity assignement. The software must  run on Windows. Since
 I like Python very much I am thinking to write that software in
 Python. Do you thinkit is a good choice? Are there libraries for audio
 compression (OGG or MP3 or maybe GSM or something like realaudio)

PyMedia can record and it works for mp3 and oggs.

 and video compression (btw what can be some good libraries to transmit
 images of a desktop in a bandwidth-efficent way?).

See above. You can lossy compress images in VNC.

 (Probably i will need some Win32 system call,
 there are bindings in Python, aren't they?)

The above modules should take care of everything. BTW, PIL can take
screen shots if you want to do this manually.

You need to create a streaming server for audio. Take a look at Edna, a
streaming MP3 server. http://edna.sourceforge.net/

Also of interest ... Twisted and Shtoom.

And finally... since you are on Windows - you can just try using the
NetMeeting ActiveX control through Python. It already does everything
you want.

Disclaimer: While I tinkered with many of the above, I have not used
most of the above projects recently. These are just leads for you to
explore.

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


Re: include statement

2006-09-20 Thread Ravi Teja
 is it possible in python to include another python source file into the
 current namespace, i.e.completely analogous to the #include statement
 in C.

By using a pre-processor, like C does.
http://www.freenet.org.nz/python/pyp/

If you are new to Python, keep in mind that this is for special cases
only. Since Python has a module system, there isn't a need for #include
as in C.

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


Re: RegexBuddy (anyone use this?)

2006-09-16 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
 Has anyone tried this thing..
 http://www.regular-expressions.info/regexbuddy.html

 If I had $30 would this be worth getting or should I just try to learn
 the manual.  (I was hopeing the essential refrence would clear things
 up but I am downloading a gilgillion pages on the re module to try to
 learn it)

 http://www.dexrow.com

The time spent on reading about regular expressions will reward you
many times over. A tool is no substitute for that.

However, a visual tool does help in constructing complex expressions.
Python includes one such. Search for redemo.py

On Windows
C:\Python24\Tools\scripts\redemo.py

There are also several good open source tools on Sourceforge. Try them
out.

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


Re: auto fill out web form

2006-09-03 Thread Ravi Teja

Chris Smith wrote:
 Does anyone know of any python scripts that can help me automatically
 navigate through some forms so I can schedule the download the file at the
 end of all the questions?

ClientForm
http://wwwsearch.sourceforge.net/ClientForm/

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


Re: Python web service ...

2006-08-26 Thread Ravi Teja

Tim Williams wrote:
  At this time right now I prefer to do something that works the quickest
  possible...
  I never had any experience with CGI, do I need to set up a web server
  for that ?
  can you point me some usefull reading material so I can get a start ?
  I will post for a comment at Zope , I had installed once and it was
  very easy. Don't know if it will be easy too to get my job done...

 If you need a quick-start and short learning curve,  Karrigell is the
 one to go for.   You can have the beginnings of your own site/web-app
 running within minutes of downloading it.

 It now has better CGI handling too - if you must go that route :)

 www.karrigell.com

 I recommend the Karrigell tour also,  click on the icon next to each
 example to see how each one is coded, and it has a file upload example
 that should get you started.

 http://karrigell.no-ip.info/demo/frame_tour_en.htm

 :)

I second Karrigell on simplicity. Zope despite recent improvements,
still has a steep learning curve.

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


Re: text editor suggestion?

2006-08-23 Thread Ravi Teja

John Salerno wrote:
 Ravi Teja wrote:

  ???
 
  In the same file, near the top.
 
  keywordclass.python=and assert break class continue def del elif \
  else except exec finally for from global if import in is lambda None \
  not or pass print raise return try while yield
 
  I could add my own keywords to it.
 

 But I don't want all my keywords to be highlighted in the same way. I
 have different colors for Python keywords, functions and methods,
 exceptions, other words like 'self', etc. and there's no way to do this
 without rewriting the lexer file (which is in C++) and recompiling Scite
 to build the changes into it.

I don't know if SciTE somehow supports function highlighting but the
properties file for php will perhaps give you some ideas on having
seperate groups with different highlight properties. I recall
repurposing something similar when I used to use Spyce for web apps.

http://mailman.lyra.org/pipermail/scite-interest/attachments/20050912/c9d5e51b/html-0001.obj

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


Re: text editor suggestion?

2006-08-22 Thread Ravi Teja

John Salerno wrote:
 Ravi Teja wrote:

  Stick to SciTE. It takes almost no learning effort and meets everyone
  of those requirements. As far as customerization goes, SciTE can be
  customerized quite well. In fact, it can even be scripted with Lua. You
  seem to be using the single file executable which does not come with
  the configuration files. Otherwise, I cannot see how you could be
  missing this ability.

 I really like Scite, but I find it's syntax highlighting abilities to be
 quite limited. You can't specify your own groups of words, you can only
 use what is already preset in the lexer files.

???

In the same file, near the top.

keywordclass.python=and assert break class continue def del elif \
else except exec finally for from global if import in is lambda None \
not or pass print raise return try while yield

I could add my own keywords to it.

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


Re: What would be the best way to run python client in the background

2006-08-21 Thread Ravi Teja
 The reason for the a seperate persistant check is because it will be
 used to enable software to be installed in whole lab of PCs but only
 allow a predifined number to run the software at any time one time.
 And then when a user stop using the software a licence will become
 available to for someone else on the same or another PC to use the
 software.  The reason that the process of the software being check is
 not used is because it will be used for software written by other
 people.  I hope this makes what and why a little clearer.  Let me know
 if you think that I have misunderstoood you.

Hmm... I don't have experience with such architecture personally. The
software being managed must have some sort of dependency on the license
manager if the manager is to be external. I don't know how you can
reliably manage external programs that are decoupled from the license
manager. You can however create a plug-in of sorts if the other authors
would be willing to incorporate it without much work to them.

I mostly explored license management in Delphi apps. Since Delphi
is/was a Shareware favorite, it has quite a few open source /
commercial components available to manage such licensing, usually with
trivial effort from the component user. You could take a look at them
(http://www.torry.net/quicksearchd.php?String=sharewareTitle=No). Some
of them might even compile on Lazarus to expose them to Python. By
large, the culture of Python is open source and such expertise may not
be common place here.

You might want to subscribe to the mailing lists of Association of
Shareware Professionals (http://www.asp-shareware.org/). I have not
been on this path in 5 years and so am out of touch.

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


Re: Python Editor with Autocorrection

2006-08-21 Thread Ravi Teja

Laurentiu wrote:
 hello!


 i am searching for a free python editor with
 autocorrection capabillities.

 for example: the wrong setfocus() call to become
 SetFocus(), etc.


 thanks

Python is a dynamic language, which means that methods that may not
exist in your source code may spring to being at runtime at any point.
So it may be undesirable to have such feature. (For example, take a
look at an XML binding tool such as Amara which creates objects at
runtime after parsing an XML file).

Most good editors (Scintilla based editors, Emacs, Vi etc) have
auto-completion for symbols that have occured in the current file; and
some advanced IDEs (PyDev, WingIDE, SPE, Komodo etc) will auto-complete
to some degree based on your imports through static analysis.

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


Re: text editor suggestion?

2006-08-21 Thread Ravi Teja
 I also just started using Scite, and I really like it, except I find its
 syntax highlighting to be very inflexible. You aren't able to define
 your own groups of words -- you have to use what's given, basically. One
 thing I like about UltraEdit is that you simply define as many groups of
 keywords as you want and then assign a style to each one. Scite has a
 very strange and rigid method of highlighting.

Stick to SciTE. It takes almost no learning effort and meets everyone
of those requirements. As far as customerization goes, SciTE can be
customerized quite well. In fact, it can even be scripted with Lua. You
seem to be using the single file executable which does not come with
the configuration files. Otherwise, I cannot see how you could be
missing this ability.

Try this one instead if you are on Windows.
http://gisdeveloper.tripod.com/scite.html

You need to edit the file python.properties to add keywords.

Windows - C:\Program Files\SciTe\python.properties
Debian - /usr/share/scite/python.properties

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


Re: What would be the best way to run python client in the background

2006-08-20 Thread Ravi Teja

gel wrote:
 Hi
 I have written a python client server app that keeps an eye on
 processes starting and ending on a client and makes decision on what to
 do based on information from the server end.  I want to run the client
 end of the app more or less invisibly (no console) on the XP clients
 when ever a users logs on.  What would be the best way to get this
 done?  A bit more info on the purpose of the app... it is to act as a
 licence server, where we have a limited number of licences for software
 and the software installed on all PCs.  The app will only allow a pre
 defined number of clients to run the software at any one time.

To run a python script without a console - use *.pyw extension.

But from what you stated you perhaps don't want to do this. Whether you
deploy this check as a service (through py2exe for example) or a
straight script, the users may simply kill it if they want to bypass
the check. Plus it is not common to use a seperate persistant process
to check for licenses. A better way is to incorporate the check
directly into the process of the software.

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


Re: Text to MP3 using pyTTS - Non-programmer question

2006-08-19 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
 Thanks for the script. Are there any online python intrepreters?

 I'd like to play around with the script. I don't have access to my home
 PC.

You probably will have to wait till you get to yours. There were some
AJAXian ones but I doubt that you will find a free (assuming that you
meant that) online interpreter on a MS Windows box that allows you to
install your modules and give you an FTP or such account to get the
recorded file back.

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


  1   2   3   >