python & Tkinter - library loading failure in linux

2005-11-29 Thread Venky
When I do 'import Tkinter', I get the
ImportError: "libtk.so.0: cannot open shared object file: No such file 
or directory"

I work around the issue by creating a softlink libtk.so.0 in the current 
directory to /usr/lib/libtk8.3.so and then updating env variable 
LD_LIBRARY_PATH to the current directory. After this, Tkinter module 
loads up fine.

Is there a better way to do this (from within the python script) ?

TIA

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


classobj?

2007-02-26 Thread Venky
Hi,

I am trying to create classes at runtime based on input from a textfile. 
I am trying to use the function new.classobj. I am able to create the 
new classes successfully, however I fail to understand on how to add 
this new class to the current dictionary.

cl = new.classobj('SomeClass', (BaseClass, ), {})

After this call, how do I instantiate SomeClass?

I understand cl() will instantiate this, however this defeats my 
purpose, since the name of the class is obtained at runtime.

Thanks

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


Re: classobj?

2007-02-26 Thread Venky
...
> 
> Do you mean that you want to add it to globals()?
> 
> globals()['SomeClass'] = cl
> 
> myinst = SomeClass()
> print isinstance(myinst, SomeClass)
> print isinstance(myinst, BaseClass)
> 
> --
> Hope this helps,
> Steven
> 
> 
> 

Thanks. That's what I was looking for.
-- 
http://mail.python.org/mailman/listinfo/python-list


where to start with

2009-05-01 Thread venky
Hi,

As iam very new to python i would like explore python. Can any body
guide me as your guidance is more worth than googling and finding it.

Thanks,
Venkat
http://www.prog2impress.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Testing for connection to a website

2008-07-17 Thread Venky Shankar
ping the universal DNS ? (4.2.2.2)

-Venky

On Wed, Jul 16, 2008 at 1:17 AM, Jordan <[EMAIL PROTECTED]> wrote:

> On Jul 15, 3:43 pm, Alexnb <[EMAIL PROTECTED]> wrote:
> > Okay, I already made this post, but it kinda got lost. So anyway I need
> to
> > figure out how to test if the user is able to connect to a specific
> website.
> > Last time I got pointed to the urllib2 page, but if I do urlopen() and
> and
> > am not connected, the program stops. So I don't know if that was what you
> > guys wanted me to do, but I don't think so, you guys are smarter than
> that.
> > So, how can I test for connection to a website.
> > --
> > View this message in context:
> http://www.nabble.com/Testing-for-connection-to-a-website-tp18473382p...
> > Sent from the Python - python-list mailing list archive at Nabble.com.
>
> Ping it? ~_^
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list

Re: Testing for Internet Connection

2008-07-17 Thread Venky Shankar
may be try to open a connection to 4.2.2.2 at port 53 ?

-vks

On Wed, Jul 16, 2008 at 12:13 AM, norseman <[EMAIL PROTECTED]> wrote:

>
> Grant Edwards wrote:
>
>> On 2008-07-15, Alexnb <[EMAIL PROTECTED]> wrote:
>>
>>  What exactly do you think will work? I am not sure what you
>>> think I should do? If I use urlopen("http://www.google.com";)
>>> and I am not connected, I am not going to get an exception,
>>> the program will fail.
>>>
>>
>> Bullshit.  You get an exception.  Here's my program:
>>
>>   import urllib2
>>   try:
>>   con = urllib2.urlopen("http://www.google.com/";)
>>   data = con.read()
>>   print data
>>   except:
>>   print "failed"
>>
>> If I run it with no internet connection, I get this:
>>
>>   $ python testit.py
>>   failed
>>
>> If I bring up the internet connection, then I get a bunch of
>> HTML.
>>
> =
> Yep -me two
>
> Process:
> copy/paste into afile
> slide lines left to create proper indent values
> save
> python afile
>
> I get same as Grant
>
>
> If one does a copy/paste into interactive Python, it does fail.
> (Lots of indent error messages.  After all, it is Python :)
>
>
> Steve
> [EMAIL PROTECTED]
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list

Re: Question

2008-07-19 Thread Venky K Shankar
On Saturday 19 July 2008 03:14:20 pm Peter Otten wrote:
> [EMAIL PROTECTED] wrote:
> > Why is Perl so much better than python?
>
> Because you have the video:
>
> http://mail.python.org/pipermail/python-list/2004-March/253370.html

>> what about this ? i feel python's better :)
>> http://www.monstersandcritics.com/people/news/article_1339060.php
>
> --
> http://mail.python.org/mailman/listinfo/python-list


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

Re: How do you check if a program/process is running using python?

2008-07-19 Thread Venky K Shankar
On Sunday 20 July 2008 12:08:49 am Lamonte Harris wrote:
> How do you check if a program or process is running when using python? 
> What I want to do is have an infinite loop to check if a program is running
> or not and send data to my web server to check yes or no.  Is this
> possible? If so how?

you can execute OS system call.

here i execute ps -ef and grep the required process name (or you can grep by 
pid on that particular column using awk)

import os
os.system("ps -ef | grep -v grep | grep ")  

in my system it gives result 0 if the process is running

>>> a = os.system("ps -ef | grep -v grep | grep python")
root  8749  5331  0 Jul19 pts/100:00:00 python
>>> a
0

else gives non 0 :

>>> a = os.system("ps -ef | grep -v grep | grep python123")
>>> a
256

you can check this inside while True:

I am sure there should be a far better solution that this in python.

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