Re: [Tutor] best way to tell if i am connected to the internet

2007-04-30 Thread Jalil

ping a host on the net if you get an echo response back you are good.
better yet ping the host  page you are scraping.


On 4/30/07, shawn bright <[EMAIL PROTECTED]> wrote:


hello there all,

i am wondering, what would be the simplest way to get a true/false
am i connected to the internet ?

right now i am using httplib to fetch a webpage every 20 minutes to see,
but i am thinking that there is a better way,

any suggestions would be encouraging

thanks
shawn

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


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


Re: [Tutor] Please suggest a python book

2006-11-24 Thread Jalil

If you already know C you should be fine with python ref book.

*Python Essential Reference (2nd Edition)*




On 11/24/06, Narasimha <[EMAIL PROTECTED]> wrote:


 Hi! Friends,

I am new to python. I have a vacation of 15 days. Please suggest me a
python book (or a website).

I already know C language. I have heard much about Python.

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



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


[Tutor] python cx_Oracle.LOB

2007-01-02 Thread Jalil

I am trying to fetch a CLOB datatype with with cx_Oracle and I can seem to
get it to work.



I was able to fetch the text from the db with sql commands  but i can fetch
in a python code.

I get this output.

[(,)]

when I run my code.

any way to find out how to go around this?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python cx_Oracle.LOB

2007-01-02 Thread Jalil

Thanks Jason,
here is my code



import cx_Oracle

db = cx_Oracle.connect('xx','x','')
cursor=db.cursor()
#cursor.execute('set long 5000')
#sqlen="""set long 5000"""
#cursor.execute(sqlen)
sqtext="""select TExt from sq_updates where action_id= '851151'"""
cursor.execute(sqtext)
rettext = cursor.fetchmany()

print rettext



On 1/2/07, Jason Massey <[EMAIL PROTECTED]> wrote:


An example of your code would help. According to the cx_oracle docs at
http://www.python.net/crew/atuining/cx_Oracle/html/index.html under the
LOB Objects heading:

6. LOB Objects

*NOTE*: This object is an extension the DB API. It is returned whenever
Oracle CLOB, BLOB and BFILE columns are fetched.

*NOTE*: Internally, Oracle uses LOB locators which are allocated based on
the cursor array size. Thus, it is important that the data in the LOB object
be manipulated before another internal fetch takes place. The safest way to
do this is to use the cursor as an iterator. In particular, do not use the
fetchall() method. The exception "LOB variable no longer valid after
subsequent fetch" will be raised if an attempt to access a LOB variable
after a subsequent fetch is detected.

 *fileexists*( ) Return a boolean indicating if the file referenced by the
BFILE type LOB exists.

 *getfilename*( ) Return a two-tuple consisting of the directory alias and
file name for a BFILE type LOB.

 *read*( [offset = 1, [amount]]) Return a portion (or all) of the data in
the LOB object.

 *setfilename*( dirAlias, name) Set the directory alias and name of the
BFILE type LOB.

 *size*( ) Returns the size of the data in the LOB object.

 *trim*( [newSize = 0]) Trim the LOB to the new size.

 *write*( data, [offset = 1]) Write the data to the LOB object at the
given offset. Note that if you want to make the LOB value smaller, you must
use the trim() function.
I'd try the read method on your object.

On 1/2/07, Jalil <[EMAIL PROTECTED]> wrote:

> I am trying to fetch a CLOB datatype with with cx_Oracle and I can seem
> to get it to work.
>
>
>
> I was able to fetch the text from the db with sql commands  but i can
> fetch in a python code.
>
> I get this output.
>
> [(,)]
>
> when I run my code.
>
> any way to find out how to go around this?
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>

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


[Tutor] mod_python

2007-01-02 Thread Jalil

I was just wondering if anyone know of a any good site with examples of
mod_python tutorial.
the mod_python manual assume isnt really that helpful.

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


[Tutor] Python connecting to an exchange server

2007-01-24 Thread Jalil

I just wanted to know if its possible or if anyone can point me to a place
where I can get info on howto to get  python to talk to an MS exchange
server.
I would basically want the python code to  parse  the appointsments  in my
outlook calendar.


Is this possible?


Thank You
--
Shoot for the moon. Even if you miss, you'll land among the stars.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] file open error

2007-02-08 Thread Jalil

Hey guys,

I have this simple code and i cant seem to get it to run.
here is the code.


from os import *
import re

hostname =raw_input("Host name : ") or ''
mac_addr =input("Mac address : ")

filename='/etc/dhcpd.conf'
fh=open(filename)

m = re.match(hostname,fh.readlines())
if m!=None:
   m.group()


Here is the error I get when i try to run the code


monkeysee% python sys_wireless.py
Host name :
Mac address : 1234567
Traceback (most recent call last):
 File "sys_wireless.py", line 8, in ?
   fh=open("/etc/dhcpd.conf","r")
TypeError: an integer is required



I dont know what the issue is?

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


[Tutor] Accessing installed windows software from python

2007-02-12 Thread Jalil

I was wondering if its possible to go about writing a code to find out  all
the installed program on a windows machines.  Basically everything under Add
Remove Programs in the control panel.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Problem with Import

2007-02-28 Thread Jalil

check your python path

On 2/28/07, Nagendra Singh <[EMAIL PROTECTED]> wrote:


Hi all,

I am running python on Cygwin and I have also installed gdal which is a
raster translator library. When I run the command import gdal, Python gives
me an error :

Python 2.4.3 (#1, May 18 2006, 07:40:45)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/site-packages/gdal.py", line 191, in ?
import _gdal
ImportError: No module named _gdal

The file gdal.py and gdal.pyc are in : /usr/lib/python2.4/site-packages,
but still it gives this error.

Thanks

Singh


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


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