Multi Threading embedded python

2005-06-30 Thread amit
interpreter, and implement a lock on it so it can't be called simultaneously by multiple threads? Thanks Amit -- http://mail.python.org/mailman/listinfo/python-list

General questions about embedding Python.

2005-07-03 Thread amit
to handle/catch python exceptions in the embedding Python code? Forgive me if I have asked too many questions in one eMail, it is becuase I don't really know where to start learning this subject from. Thanks Amit -- http://mail.python.org/mailman/listinfo/python-list

Embedding performance.

2005-07-03 Thread amit
Hello, Is there any kind of performance differences to the different ways of embedding python? PyEval_EvalCode() PyRun_SimpleFile() PyObject_CallObject() Thanks Amit -- http://mail.python.org/mailman/listinfo/python-list

BaseHTTPServer ThreadMixIn not working

2011-10-03 Thread amit
Hi everyone, I am really stuck in a very simple problem and wanted to know if you could take some time to check it out - My code is simple. Using BaseHTTPServer and ThreadInMix I want to run a python script (Script1.py) for every request made simultaneously. My code-> from subprocess import PIPE

Make money to share your videos

2007-09-13 Thread amit
Make money to share your videos Goodtolove.com is sharing their 50% adsense revenue with you to post videos of anything. Just keep up logging in and start posting now to make money... -- http://mail.python.org/mailman/listinfo/python-list

Simple Python Project Structure

2008-10-10 Thread amit
have to be in the same directory. For example, project/ util/ config/ tests/ start.py I have a module in util/console.py, how do I import that. In start.py I have: from project.util.console import filetest but I get an ImportError. Thanks! Amit -- http://mail.python.org

Calling multiple programs with subprocess

2010-04-22 Thread amit
n the 'make clean' command. Any help is appreciated. Thanks, Amit -- http://mail.python.org/mailman/listinfo/python-list

compilation problem of python on AIX 6.1

2009-07-12 Thread Amit
Hello I want to intsall python on my AIX 6.1 Box. I couldn't get any rpm for python 2.5.x for AIX 6.1. THen I decided to compile python 2.5.4 on my AIX box. I downloaded the python source code from www.python.org and tried to compile on my AIX both using gcc. step 1 ./configure --with-gcc config

Re: [Python-Dev] [RELEASED] Python 3.3.0

2012-09-29 Thread Amit Saha
ons such as "sendfile()" > * Hash randomization, introduced in earlier bugfix releases, is now >switched on by default > > In total, almost 500 API items are new or improved in Python 3.3. > For a more extensive list of changes in 3.3.0, see > > http://docs.python.org/3.3/whatsnew/3.3.html Redirects to http://docs.python.org/py3k/whatsnew/3.3.html: 404 Not Found. Cheers, Amit. -- http://echorand.me -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] [RELEASED] Python 3.3.0

2012-09-29 Thread Amit Saha
On Sat, Sep 29, 2012 at 10:37 PM, Dave Angel wrote: > On 09/29/2012 08:23 AM, Amit Saha wrote: >> On Sat, Sep 29, 2012 at 10:18 PM, Georg Brandl wrote: >>> >>> >>> For a more extensive list of changes in 3.3.0, see >>> >>> http://docs

Re: Invalid syntax error

2012-03-10 Thread Amit Sethi
Its an indentation error -- A-M-I-T S|S -- http://mail.python.org/mailman/listinfo/python-list

MemoryError vs malloc error

2011-07-15 Thread Amit Dev
ng in pure python code (Eg. if ' '.join(biglist)) etc. Regards, Amit -- http://mail.python.org/mailman/listinfo/python-list

indentation

2011-08-11 Thread Amit Jaluf
Hello Group, i just start python is it necessary indentation in python ? thanks in advance ... -- http://mail.python.org/mailman/listinfo/python-list

Re: indentation

2011-08-11 Thread Amit Jaluf
On Aug 11, 8:15 am, MRAB wrote: > On 11/08/2011 13:56, Amit Jaluf wrote:> Hello Group, > > i just start python is it necessary indentation in python ? > > Yes, indentation is part of the language. > > Even in programming languages where it isn't necessary, it's

about if __name == '__main__':

2011-08-28 Thread Amit Jaluf
hello group i have one question about this if __name == '__main__': is it same as other languages like[c,c++] main function. because of i google and read faqs and also " http://docs.python.org/faq/programming#how-do-i-find-the-current-module-name"; this and i am confused. thanks -- http://m

Re: about if __name == '__main__':

2011-08-28 Thread Amit Jaluf
On Aug 28, 12:51 pm, Ian Kelly wrote: > On Sun, Aug 28, 2011 at 9:34 AM, Amit Jaluf wrote: > > hello group > > > i have one question about this > > > if __name == '__main__': sorry dear for this and thanks all of you for this -- http://ma

Re: Executing js/ajax in a sandboxed environment

2011-02-27 Thread Amit Sethi
On Sun, Feb 27, 2011 at 10:26 AM, Rohan Malhotra wrote: > BeautifulSoup library only fetches source of page. I need the access > to DOM after js execution with url as input parameter. > > Any pointers? > I am not sure but in case you need to make some ajax requests mechanize might help. http://

Reference Cycles with instance method

2011-03-08 Thread Amit Dev
ppears to be a cycle (between method m2 and A). I would expect this to behave the same as having another method "def m2(self): self.m1()", but unfortunately its not. In above case m2 seems to be in a.__dict__ which is causing the cycle. Any idea why this is so? Regards, Amit -- http://ma

Memory Usage of Strings

2011-03-16 Thread Amit Dev
he string size, it remains high till it reaches around 1000. In that case it is back to 100MB usage. Python 2.6.4 on FreeBSD. Regards, Amit -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory Usage of Strings

2011-03-16 Thread Amit Dev
sum(map(len, l)) => 8200 for 1st case and 9100 for 2nd case. Roughly 100MB as I mentioned. On Wed, Mar 16, 2011 at 11:21 PM, John Gordon wrote: > In Amit Dev > writes: > >> I'm observing a strange memory usage pattern with strings. Consider >> the followi

Re: Memory Usage of Strings

2011-03-16 Thread Amit Dev
;|^USER\\>' amdev 6906 0.0 0.1 3508 1424 p0 R+9:57PM 0:00.00 egrep \\<6903\\>|^USER\\> (sh) Regards, Amit On Thu, Mar 17, 2011 at 3:21 AM, Dan Stromberg wrote: > > On Wed, Mar 16, 2011 at 8:38 AM, Amit Dev wrote: >> >> I'm observing a strange m

Numpy and Scipy for Python3.5

2017-02-03 Thread Amit Yaron
Can I find those modules in the FreeBSD ports? -- https://mail.python.org/mailman/listinfo/python-list

Python27.dll module error from Python 2.7.15/PCbuild/get_externals.bat

2018-06-29 Thread amit . singh2241
nto the same trap though it goes ahead and compiles but then compiler throws error due to half-baked external modules. Any help will be highly appreciated ! --Amit Kumar Singh -- https://mail.python.org/mailman/listinfo/python-list

Regarding problem faced to run pandas

2020-04-20 Thread Amit Jain
ards * *Amit Kumar Jain* *Jaipur, Rajasthan* *India* -- *Thanks & Regards * *Amit Kumar Jain* *PGT(CS)* *KVS, (Under **Ministry of HRD)* -- https://mail.python.org/mailman/listinfo/python-list

Problem in importing pandas

2020-04-23 Thread Amit Jain
Dear Sir/Madam, After *successful installation of PIP for PANDAS *when I try to *import pandas*, It gives error as given below - >>> import pandas as pd Traceback (most recent call last): File "", line 1, in import pandas as pd File "C:\Users\Amit\AppData\Local\

Re: Problem in importing pandas

2020-04-24 Thread Amit Jain
For the same problem, The solution, I found is to install package spicy. Then *import spicy* along with *import pandas. * It really works - But the instructions should be - *import spicy* *import pandas* On Fri, 24 Apr 2020, 01:12 MRAB, wrote: > On 2020-04-23 18:57, Amit Jain wr

OSDC::Israel Conference 26-28 Feb. 2006

2005-11-21 Thread Amit Aronovitch
== Open Source Developers' Conference, 26-28 February, 2006, Netanya, Israel == Announcement and Call for Papers http://www.osdc.org.il/call_for_paper.html About -- The Open Source Developers' Conferences (OSDCs) are gras

OSDC::Israel Conference 26-28 Feb. 2006

2005-11-21 Thread Amit Aronovitch
== Open Source Developers' Conference, 26-28 February, 2006, Netanya, Israel == Announcement and Call for Papers http://www.osdc.org.il/call_for_paper.html About -- The Open Source Developers' Conferences (OSDCs) are gras

matching a string to extract substrings for which some function returns true

2005-11-22 Thread Amit Khemka
mple string and check the condition, I was wondering if there is any smarter way of doing the same, may be using regular-expressions. Thanks, amit. Endless the world's turn, endless the sun's spinning Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list

Re: matching a string to extract substrings for which some function returns true

2005-11-22 Thread Amit Khemka
, 2, 'foobar1', (3, 1)), ('foo2', 2, 'foobar2', (3, 2))" output: [('foo', 1, 'foobar', (3, 0)), ('foo1', 2, 'foobar1', (3, 1)), ('foo2', 2, 'foobar2', (3, 2))] I hope that explains it better... cheers,

Re: matching a string to extract substrings for which some functionreturns true

2005-11-22 Thread Amit Khemka
Fredrik, thanks for your suggestion. Though the html page that are generated are for internal uses and input is verified before processing. And more than just a solution in current context, actually I was a more curious about how can one do so in Python. cheers, amit. On 11/22/05, Fredrik Lundh

Re: matching a string to extract substrings for which somefunctionreturns true

2005-11-22 Thread Amit Khemka
thanks for you suggestions :-) .. cheers, On 11/23/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > I wrote: > > > if you cannot cache session data on the server side, I'd > > recommend inventing a custom record format, and doing your > > own parsing. turning your data into e.g. > > > >"foo:1:

How do i do this

2005-07-23 Thread Amit Regmi
rd" How do I manage to create an account usign the AddAccount() Python function ?? -- -Amit http://www.geocities.com/broamit -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBC3HHp/u1Xr7tKTYARAv6eAJoDpKVv45v/M7NSH+xekpX6jasBJACeLcB/ lSIVQ0AMXFQrKPLZFOd6Qno= =Tltk --

[newbie] - How to remain at prompt after script execution?

2005-02-14 Thread Amit Dhingra
I am a total newbie learning the very basics I would like to excute a script and upon completion, how can I just a python prompt with the functions and variables already defined. I know you can do this in the window gui(IDLE). I was wondering if this can be done in POSIX systems as well. -- htt

Re: [newbie] - How to remain at prompt after script execution?

2005-02-14 Thread Amit Dhingra
Thanx Fredrik, that works and thats what I wanted. Amit "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Amit Dhingra wrote: > > > I would like to excute a script and upon completion, how can I just a python > > prompt with the funct

Re: How can I get the variable to subtract the input please?

2013-11-18 Thread Amit Saha
have to convert the input into a data type such as an integer or a float and then try to do any mathematical operation: >>> int(age) - 10 0 >>> float(age)-10 0.0 Hope that helps. Best, Amit. -- http://echorand.me -- https://mail.python.org/mailman/listinfo/python-list

Re: Using try-catch to handle multiple possible file types?

2013-11-18 Thread Amit Saha
haps you would be better off using MIME types instead. Assuming you go ahead with using MIME type, how about using python-magic to detect the type and then look in your dictionary above, if there is a corresponding file_opener object. If you get a KeyError, you can raise an exception saying t

Re: Python application for rpm creation

2013-11-26 Thread Amit Saha
elf writing > something. > > if you guys ( others ) got something else for Redhat Linux rpm creation do > let me know. I played with creating a RPM SPEC file "generator" for Sphinx documentation: https://github.com/amitsaha/sphinx_doc_packaging It's written in Python, so

Re: input() on python 2.7.5 vs 3.3.2

2013-12-12 Thread Amit Saha
line 1 > Hello there > ^ > SyntaxError: unexpected EOF while parsing In Python 2, input() expects valid Python as it's input. If you provide your input as 'Hello there' (a Python string), it won't complain. HTH, Amit. -- http://echorand.me -- https://mail.python.org/mailman/listinfo/python-list

Have you ever wondered why there are so many flavors of python. This post answers all your queries.

2014-03-25 Thread Amit Khomane
http://www.techdarting.com/2014/03/why-different-flavors-of-python.html -- https://mail.python.org/mailman/listinfo/python-list

Calling Python Script from an SQL Proceudre

2015-06-03 Thread Amit Goutham
, Amit Goutham Ph:+91-8867801035 -- https://mail.python.org/mailman/listinfo/python-list

Re: Calling Python Script from an SQL Proceudre

2015-06-04 Thread Amit Goutham
Hi Laura, Thanks a Lot for the reply. I wanted to know if calling a Python script from SAP HANA database is possible. Thanks! On Jun 3, 2015 9:43 PM, "Laura Creighton" wrote: > In a message of Wed, 03 Jun 2015 15:17:16 +0530, Amit Goutham writes: > >Hi All, > >I a

argparse: use of double dash to separate options and positional arguments

2015-11-06 Thread Amit Ramon
t easy to check for it and remove it if it exists, but it still seems like it shouldn't be there - it is not really an argument, just a delimiter. Am I doing anything wrong, or is this a bug? I hope someone here can shed some light on this. Thanks, Amit -- -- https://mail.python.org/mailman/listinfo/python-list

Re: argparse: use of double dash to separate options and positional arguments

2015-11-06 Thread Amit Ramon
r program to decide what to do with the arguments it receives (So in your examples, rm would actually try to remove the "foo" directory). And although stripping the '--' is easy, why should the user of argparse need to handle it? Still unclear to me. Cheers, Amit -- https://mail.python.org/mailman/listinfo/python-list

Default Admin user on weblogic domain deleted after executing create command using WLST

2011-09-12 Thread Amit Jain
oup/comp.lang.java.programmer/browse_thread/thread/1927322accdb6e6e/223e1c7cd208a86c Please suggestion... regards, Amit J. -- http://mail.python.org/mailman/listinfo/python-list

writing IM bots

2005-12-13 Thread Amit Khemka
, - http://users.auriga.wearlab.de/~alb/msnlib/ cheers, amit. -- Endless the world's turn, endless the sun's spinning Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list

Re: writing IM bots

2005-12-14 Thread Amit Khemka
thank you all for ur suggestions .. I got msnp and curfoo(for yahoo) customized and working :-) .. though they are pretty slow in responding to messages ... will try jabber based protocols, cheers, amit. On 12/14/05, Linsong <[EMAIL PROTECTED]> wrote: >Why not twisted.word

Re: Timeout at command prompt

2006-01-11 Thread Amit Khemka
One way would be to use 'signal' s ... something like this should work import signal TIMEOUT = 5 # number of seconds your want for timeout signal.signal(signal.SIGALRM, input) signal.alarm(TIMEOUT) def input(): try: foo = raw_input() return foo except: # timeout return ch

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Amit Khemka
Ideally, I would have made a wrapper to add/delete/modify/read from the dictionay. But other than this, one way i can think straight off is to "pickle" the dict, and to see if the picked object is same as current object. cheers, amit. On 12 Jan 2006 01:15:38 -0800, [EMAIL PROTECTE

Re: Timeout at command prompt

2006-01-12 Thread Amit Khemka
its "Python 2.4.1" .. on linux On 12 Jan 2006 06:34:08 -0800, Thierry Lam <[EMAIL PROTECTED]> wrote: > Is there a windows equivalent for that solution? > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Endless the world's turn, endless the sun's spinning Endless the quest; I

Re: Timeout at command prompt

2006-01-12 Thread Amit Khemka
I tried it on "Python 2.4.1" on '2.6.11-1.1369_FC4smp with gcc version 4.0.0' .. which works fine .. may be it could be an issue with some other combinations .. cheers, amit On 12 Jan 2006 07:35:57 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >

Re: Timeout at command prompt

2006-01-12 Thread Amit Khemka
Another thing that can be tried is: import threading a="" def input(): global a a = raw_input() T = threading.Thread(target=input) T.start() T.join(2) ## does the trick ... I have not tested it but i guess should work. cheers, amit. On 1/12/06, Amit Khemka <[EM

Re: Encode filenames to safe format

2006-07-20 Thread Amit Khemka
On 7/20/06, Dara Durum <[EMAIL PROTECTED]> wrote: > Hi ! > > I want to encode filenames to safe format, like in browser url (space -> > %20, etc.). > What the module and function name that helps me in this project ? > import urllib urllib.quote('file name'

Re: import a user created python file as module

2006-07-30 Thread Amit Khemka
sys sys.path.append("/path/to/Base") import file1 cheers, amit. -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to safely extract dict values

2006-07-31 Thread Amit Khemka
if isinstance(_v, types.ListType): > vals.extend(_v) > else: > vals.append(_v) > # now we can safely iterate through acts > for val in vals: > . how about:

Re: how to safely extract dict values

2006-07-31 Thread Amit Khemka
oops ! my mistake :-D On 7/31/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Amit Khemka wrote: > > how about: > > > > vals = [] > > for val in mydict.values(): > > try: vals.extend(val) > > except: vals.append(val) > > >>> l

Re: PIL issues

2006-07-31 Thread Amit Khemka
2.0: "clean" the PIL build 2.1 In setup.py that comes with PIL, set the JPEG_ROOT to the jpeg-lib path 3.0 run setup.py I hope that should help .. cheers, amit -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the

Re: using globals

2006-08-03 Thread Amit Khemka
a python module "t1.py". And its very logical that all the (global) variables in "t1.py" have the value which one would expect after execution of the "t1.py" otherwise. And hence you see value of counter as 1. (or in other words you are accessing two different instan

Re: Running queries on large data structure

2006-08-04 Thread Amit Khemka
nsidered using some native XML database like BDB XML. 1. It allows you to retain hierarchical structure of data. 2. It also has support for precompiled queries. 3. You can open a persistent connection. cheers, amit. -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd0037

Re: How to change the path for python binary?

2006-08-10 Thread Amit Khemka
uot;python" in the shell? There could be various ways of doing so, like: Option 1: open your shell preference file ( ex. for bash ~/.bashrc) and add an alias: alias python="/path/to/python/version/of/your/choise" Option 2: make /usr/local/bin/python a symlink to python2.3.5 cheers

Re: Help with async xmlrpc design

2006-08-16 Thread Amit Khemka
n submitting a request, client-server agree upon a port on which client will listen for the results. 2. Registering a callback function. (Googling would point to more elaborate discussions on pros and cons ) cheers, amit. Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 E

Re: find, replace and save string in ascii file

2006-08-23 Thread Amit Khemka
er you want changes to the NAME and then write the 'block' to a temperory file. If you want the output to be written to same file just 'move' this temperory file to the input file once you are done. Note: if there is other stuff in the input file, apart from such 'blo

Re: Logging to a file and closing it again properly (logging module)

2006-06-14 Thread Amit Khemka
g.Logger.manager.loggerDict.values(): > .>>> l.handlers = [] You can "close" the logger by just removing the handler from the logging object # first creater a logger and file handler fooLogger = logging.getLogger('FOO') fooLogger.setLevel(logging.INFO)

Import: Multiple modules with same name

2006-06-29 Thread Amit Khemka
) return module But It looked like an overkill, Is there a more elegant and better way of doing it ? Thanks in advance, cheers, amit. -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I

Re: starting and stopping a program from inside a python script

2006-07-04 Thread Amit Khemka
n script exits, the process 'bar' is > still running and I have to issue ps -ef | grep 'bar' and then kill > it. > > Is there any better way of doing this? > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Amit Khemka -- onyomo.com Home

Re: Generating multiple lists from one list

2006-07-06 Thread Amit Khemka
f = output[:] ## ugly hack to work around references + for i in range(len(l)-1): for j in dfdf: k = j[:] output.append(k) # hack - for i in range(0, len(l)): for l1 in output[i*len(output)/len(l):((i+1)*len(output)/len(l))]: l1.append(l[i]) print output --

Re: ElementTree : parse string input

2006-07-06 Thread Amit Khemka
t; method. Btw, did you looked at cElementTree module ? It claims to be much 'faster' and has very similar api as ElementTree Module. link: http://effbot.org/zone/celementtree.htm cheers, amit. -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless t

Re: Activate a daemon several times a day

2006-07-06 Thread Amit Khemka
did you considered using signals ?! I guess that could well serve the purpose .. more of signals: http://docs.python.org/lib/module-signal.html cheers, amit. On 7/6/06, Yves Glodt <[EMAIL PROTECTED]> wrote: > Hi, > > I have a daemon which runs permanently, and I want it

Re: all ip addresses of machines in the local network

2006-08-24 Thread Amit Khemka
a particular network service, to allow you to "distribute the database". In such case you can use "nmap" with -p option, to find all the machines which are listening on the particular port. hth, amit. Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377

Re: all ip addresses of machines in the local network

2006-08-24 Thread Amit Khemka
On 8/24/06, Amit Khemka <[EMAIL PROTECTED]> wrote: > On 23 Aug 2006 21:46:21 -0700, damacy <[EMAIL PROTECTED]> wrote: > > hi, sandra. > > > > no, it's not as complicated as that. all i want to do is to load a > > database onto different machines residin

Re: how can i change the text delimiter

2006-08-30 Thread Amit Khemka
go about it? You can use the parser constructor to specify the field seperator: Python >>> parser(ms_double_quote = 1, field_sep = ',', auto_clear = 1) cheers, amit. -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endles

Re: how can i change the text delimiter

2006-08-30 Thread Amit Khemka
On 8/30/06, Amit Khemka <[EMAIL PROTECTED]> wrote: > sonald <[EMAIL PROTECTED]> wrote: > > Hi, > > Can anybody tell me how to change the text delimiter in FastCSV Parser > > ? > > By default the text delimiter is double quotes(") > > I want to chan

Re: all ip addresses of machines in the local network

2006-08-31 Thread Amit Khemka
python code. ( In my network "nmap -osscan_limit -p 22 -T5 Class_D_Network" completes in 1.5 seconds !) cheers, amit. -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list

Re: how can i change the text delimiter

2006-08-31 Thread Amit Khemka
t csv # standard csv module distributed with python inputFile = "csv_file_with_pipe_as_quotchar.txt" reader = csv.reader(open(inputFile), quotechar='|') for row in reader: # do what ever you would like to do cheers, amit. Amit Khemka -- onyomo.com Home Page: www.

Re: convert from date string to epoch

2006-12-15 Thread Amit Khemka
tup = map(int,date.split('/')) l = (tup[2], tup[0], tup[1], 0, 0, 0) epochs = calendar.timegm(l) return (int(epochs)) HTH, amit. -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spin

Re: catching exceptions

2006-12-16 Thread Amit Khemka
return statement in functions with two arguments. for example: def foo(self, value): try: a.x = value return True, '' except ValueError: return False, 'Float conversion error: %s' %(value) and when ever u call the function, check the first return va

Re: trouble getting google through urllib

2006-12-19 Thread Amit Khemka
import urllib2 req = urllib2.Request('http://www.google.com') # add 'some' user agent header req.add_header('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.5 Firefox/1.5') up = urllib2.urlopen(req) cheers, amit -- ---

Re: Unable to get PIL to load jpeg images

2006-02-08 Thread Amit Khemka
.. cheers, amit On 2/9/06, Andrew Gwozdziewycz <[EMAIL PROTECTED]> wrote: > On 2/7/06, Steve Holden <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > Someone out there must surely know - please! > > > > > > Peter > > > > >

ordered sets operations on lists..

2006-02-10 Thread Amit Khemka
Hello, Is there a *direct* way of doing set operations on lists which preserve the order of the input lists ? For Ex. l1 = [1, 5, 3, 2, 4, 7] l2 = [3, 5, 10] and (l1 intersect l2) returns [5, 3] (and (l2 intersect l1) returns [3, 5]) thanks in advance, amit

Re: Split file into several and reformat

2007-06-21 Thread Amit Khemka
... >1299} > End sels > > And turn it into an output file for each of the "sels" in the input file, i.e > sel1.txt: Once you have read Bruno's pointers ! Have a look at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877 cheers, --

Re: import

2007-07-06 Thread Amit Khemka
ogging up my python directory Yes. You can tell python where all to look for importing modules. import sys sys.path.append("/this/is/my/modules/path") > Thanks Welcome ! cheers, -- Amit Khemka website: www.onyomo.com wap-site: www.owap.in Home Page: www.cse.iitd.ernet.

Re: Fetching a clean copy of a changing web page

2007-07-16 Thread Amit Khemka
ags" in the XML May be you can use the above to check the xml and catch the "bogus" ones ! cheers, -- Amit Khemka website: www.onyomo.com wap-site: www.owap.in Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endle

Using Bessel Functions

2007-05-03 Thread amit soni
hat is the exact syntax for to use it. Thank you, Amit -- http://mail.python.org/mailman/listinfo/python-list

Re: how to use imaageop.scale

2007-05-23 Thread Amit Khemka
his? Thanks! Were there any exceptions/error-messasges ? Do you jpeg libraries installed for hadling jpeg format ? Cheers, -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, b

Re: how to use imaageop.scale

2007-05-24 Thread Amit Khemka
On 23 May 2007 18:58:28 -0700, Bruce <[EMAIL PROTECTED]> wrote: > On May 23, 5:31 pm, "Amit Khemka" <[EMAIL PROTECTED]> wrote: > > On 23 May 2007 00:02:34 -0700, Bruce <[EMAIL PROTECTED]> wrote: > > > > > Hi, I want to compress a jpg file. e.g.

Re: function nested

2007-05-24 Thread Amit Khemka
nd(path) > else: > f1(path) > f1(start) > return stack > > > i feel s stupid right now > forgot to call f1 > > any comments how to make this better? os.walk is just the way for you ! Cheers, Amit Khemka -- onyomo.com Home Page: www.cse.

Re: Changing Unicode object to Tuple Type

2007-05-24 Thread Amit Khemka
n that tuple ?! Or do you want to store the unicode string as one of the member in a tuple ? In which case you can just do it the obvious way (though i guess thats not the question you asked)! Cheers, Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's

Re: Web Archtecture using tow layers in Phyton

2007-05-24 Thread Amit Khemka
t (example)... i don't know if this is > possible and how can this be implemented... any help is aprreciated... Read the documentation of the framework ( if any) you choose to work with you may find templating system useful. For standalone app you can look at wxPython, which can communicate to you

Re: Xml parser

2007-05-25 Thread Amit Khemka
On 5/24/07, ashish <[EMAIL PROTECTED]> wrote: > Hi All, > > I want to know weather is there any api available in python for parsing > xml(XML parser) Checkout cElementTree . Cheers, -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the wor

Re: Newbie help understanding...

2007-05-26 Thread Amit Khemka
cards = [] for card in file(filename): cards.append(cards.split()) # i assume that suit and rank is separated by white space return cards or better still cards = [card.split() for card in file(filename)] Cheers, Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list

Re: Filtering content of a text file

2007-07-27 Thread Amit Khemka
27;) for line in file("myrecords.txt"): # iterate over the records if line.startswith("//-+"+alnum): # check your condition # write the matches to a file outfile.write(line) outfile.close() However rather than looping over the file for each alnum you

Re: Logging module gives duplicate log entries

2007-08-21 Thread Amit Khemka
remove the handler once you are done applog.removeHandler(hdl) Cheers, amit. Amit Khemka website: www.onyomo.com wap-site: www.owap.in Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, back to my own b

Re: for statement on empty iterable

2007-08-21 Thread Amit Khemka
lly I was thinking how do I > access the index inside a for statement? Can you help Have a look at "enumerate", You can iterate over a list like: for i,x in enumerate(['a', 'b', 'c']): print i, x It prints: 0 a 1 b 2 c cheers, amit Amit Khemka

Re: TypeError: 'module object is not callable'

2007-09-03 Thread Amit Khemka
;Step" defined IN the module "Step" example 2: from Step import Step # You directly import the class ( and make the name visible in your name space) a = Step("magn") Also have a look at: http://effbot.org/zone/import-confusion.htm http://docs.python.org/ref/import.html Cheers, -- Amit Khemka website: www.onyomo.com wap-site: www.owap.in -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: 'module object is not callable'

2007-09-03 Thread Amit Khemka
On 9/3/07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Amit Khemka a écrit : > (snip) > > The exception is being raised as you are being confused about the > > names ie: you have a class named "Step" in a module named "Step.py" . > > &g

Re: TypeError: 'module object is not callable'

2007-09-04 Thread Amit Khemka
t is: >>> l = ['1', '2', '3', '4'] you can do: >>> print "\t".join(l) # lookup join method in string module, assuming "\t" as the delimiter or, >>> for i in l: print i, '\t' , # note the

Re: TypeError: 'module object is not callable'

2007-09-04 Thread Amit Khemka
On 9/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Sep 4, 11:24 am, "Amit Khemka" <[EMAIL PROTECTED]> wrote: > > On 9/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > Thanks guys. Changing to how Python does things has a l

Re: Printing lists in columns

2007-09-05 Thread Amit Khemka
This is an example of "generator" functions, to understand what they are and how they work you can: 1. web-search for "python generators" 2. have a look at "itertools" module, for more generators -- Amit Khemka website: www.onyomo.com wap-site: www.owap.in -- http://mail.python.org/mailman/listinfo/python-list

Re: Looping through File Question

2007-09-05 Thread Amit Khemka
ow away) f.readline() a single time before > looping. > If the lenght of the first line is fixed, you can also use f.seek to start > reading from the second row. > > francesco Btw, if you are trying to read a csv file and parse it, you can save some work .. have a look at "c

Re: Using wild character

2007-09-05 Thread Amit Khemka
x27;artica'] To know more about list comprehensions, have a look at: http://docs.python.org/tut/node7.html#SECTION00714 Methods on strings: http://docs.python.org/lib/string-methods.html#string-methods Btw, not all of names in your list are countries ! Cheers, -- Amit Khemka website: www.onyomo.com wap-site: www.owap.in -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >