Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'memory.': 0.07; 'posting.': 0.07; 'python': 0.08; '(unless': 0.09; '>>>>': 0.09; 'compiling': 0.09; 'dependant': 0.09; 'importerror:': 0.09; 'pyodbc': 0.09; 'setup.py': 0.09; 'solved': 0.09; 'scripts': 0.09; '>>>': 0.11; 'pm,': 0.12; 'described': 0.13; 'wrote:': 0.14; 'arguments': 0.15; 'skip:" 40': 0.15; 'traceback': 0.15; '2.6,': 0.16; 'finney': 0.16; 'furman': 0.16; 'install.': 0.16; 'iterates': 0.16; 'mrab': 0.16; 'stdin': 0.16; 'subject: ???': 0.16; 'subject:CSV': 0.16; 'subject:pass': 0.16; 'subject:possible': 0.16; 'thru': 0.16; 'workaround': 0.16; '(most': 0.17; 'versions': 0.17; '2.7': 0.18; 'skip:b 20': 0.19; 'guess': 0.21; 'tried': 0.22; 'fine': 0.22; 'object': 0.22; 'installed': 0.22; 'jan': 0.22; '64-bit': 0.23; 'last):': 0.23; 'header:In-Reply-To:1': 0.23; 'version': 0.24; 'words,': 0.24; 'script': 0.25; 'not.': 0.25; 'input': 0.25; 'runs': 0.27; 'module': 0.27; 'windows': 0.28; 'process,': 0.28; 'specified': 0.28; "can't": 0.28; 'problem': 0.28; 'message- id:@mail.gmail.com': 0.29; 'thanks': 0.30; 'cmd': 0.30; 'csv': 0.30; 'trick': 0.30; 'import': 0.31; 'to:addr:python-list': 0.31; 'actually': 0.31; 'url:mailman': 0.31; 'load': 0.31; 'says': 0.31; 'earlier': 0.31; 'fri,': 0.31; 'source': 0.31; "doesn't": 0.32; 'supports': 0.32; 'error': 0.32; 'bit': 0.32; "won't": 0.32; 'uses': 0.32; 'skip:" 20': 0.33; 'under': 0.33; 'file': 0.34; 'install': 0.34; 'running': 0.34; '2.6': 0.34; 'accessing': 0.34; 'structured': 0.34; 'thats': 0.34; 'pass': 0.34; 'where': 0.35; 'explain': 0.35; 'another': 0.35; 'but': 0.36; 'later': 0.36; 'understood': 0.36; 'sorry': 0.36; 'case,': 0.37; 'two': 0.38; 'works': 0.38; 'received:google.com': 0.38; 'i.e.': 0.38; 'might': 0.38; 'url:org': 0.38; 'subject:: ': 0.39; 'some': 0.39; 'url:python': 0.39; 'to:addr:python.org': 0.40; 'could': 0.40; "you've": 0.61; 'your': 0.61; 'released': 0.62; 'results': 0.62; 'details': 0.63; '8bit%:4': 0.64; 'here': 0.64; 'link': 0.66; 'below': 0.66; '26,': 0.67; 'downloading': 0.67; 'show': 0.67; 'click': 0.78; 'ethan,': 0.84; 'failed:': 0.84; 'subject:Reader': 0.84; 'url:answers': 0.84; 'yourself?': 0.84; 'thereafter': 0.91 MIME-Version: 1.0 In-Reply-To: <2c9f82cd-756b-4460-940b-31e2a866f24e@n36g2000pre.googlegroups.com> References: <2c35653e-3565-48c6-8939-b6b09b885e3f@d23g2000prj.googlegroups.com> <876b6c52-1a6d-4afa-83e9-fa987c9359a5@v31g2000pri.googlegroups.com> <87lj272vpo.fsf@benfinney.id.au> <430714cd-20b4-4a67-bd2d-54e8f0c44ad5@s18g2000vbe.googlegroups.com> <2c9f82cd-756b-4460-940b-31e2a866f24e@n36g2000pre.googlegroups.com> Date: Fri, 28 Jan 2011 13:52:15 -0500 Subject: Re: Is it possible to pass CSV Reader Object As Argument to another Python File ??? From: Benjamin Kaplan To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A020208.4D431060.016A,ss=1,fgs=0, ip=74.125.82.182, so=2010-02-10 23:06:36, dmn=2009-09-10 00:05:08, mode=single engine X-Junkmail-IWF: false X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 109 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1296240747 news.xs4all.nl 41117 [::ffff:82.94.164.166]:48793 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55968 On Fri, Jan 28, 2011 at 1:33 PM, bansi wrote: > On Jan 28, 9:46=A0am, bansi wrote: >> On Jan 26, 8:31=A0pm, MRAB wrote: >> >> >> >> >> >> > On 27/01/2011 00:57, bansi wrote: >> >> > > On Jan 26, 6:25 pm, Ethan Furman =A0wrote: >> > >> bansi wrote: >> >> > >> =A0 > =A0First namelookupWrapper.py running under Python 2.6 accept= arguments >> > >> =A0 > =A0from stdin and uses csv reader object to read it i.e. >> > >> =A0 > =A0r=3Dcsv.reader(sys.stdin) >> >> > >> =A0 > =A0And then it has to pass csv reader object to another pytho= n script >> > >> =A0 > =A0namelookup.py running under Python 2.7 because it uses pyo= dbc to >> > >> =A0 > =A0connect to database and iterates thru reader object >> >> > >> Ben Finney wrote: >> > >>> bansi =A0writes: >> >> > >>>> Thanks Chris. Sorry for mis-communicating, the two python scripts= are >> > >>>> dependant in a way that namelookupWrapper.py needs to pass csv re= cord >> > >>>> object to another python script >> >> > >>> Why have you structured them that way, though? What constraint is >> > >>> keeping you from doing the work in a single process, where the CSV >> > >>> reader object can be shared? >> >> > >>>> If thats not possible then please let me know how to do the worka= round >> > >>>> i didnt understood the import thing and not sure if it helps in m= y >> > >>>> case >> >> > >>> The problem as you've described it so far is best solved by having= a >> > >>> single process accessing the CSV reader object in memory. If that >> > >>> doesn't suit your use case, you'll need to explain why not. >> >> > >> In other words, why can't you use Python 2.7 to accept input and >> > >> generate a csv.reader? >> >> > >> ~Ethan~- Hide quoted text - >> >> > >> - Show quoted text - >> >> > > Ethan, >> > > The python script takes the input from Splunk (http://www.splunk.com= / >> > > base/Documentation/) which supports only Python 2.6 >> > > So the real constraint is Splunk supports only Python 2.6 . >> >> > > As you know Python 2.6 doesnt support or doesnt have pyodbc install >> > > for Windows =A064 bit OS >> > > So i installed Python 2.7 and thereafter pyodbc install for Windows = 64 >> > > bit OS for Python 2.7 >> >> > Have you actually tried Splunk with Python 2.7? It might not work with >> > versions which are earlier than Python 2.6, but that doesn't >> > necessarily mean that it won't work with versions of Python 2 which ar= e >> > later than Python 2.6 (unless the documentation says that it must be >> > Python 2.6).- Hide quoted text - >> >> > - Show quoted text - >> >> Splunk's latest version 4.1.6 doesn't support Python 2.7 >> I tried the import trick but it didnt work because the real script >> which runs under Python 2.7 has import pyodbc so it results in >> following error >> >> c:\Splunk\etc\apps\search\bin>splunk cmd python namelookupWrapper.py >> memberId memberName < memberInput.csv >> Traceback (most recent call last): >> =A0 File "namelookupWrapper.py", line 3, in >> =A0 =A0 import namelookup >> =A0 File "c:\Splunk\etc\apps\search\bin\namelookup.py", line 7, in >> >> =A0 =A0 import pyodbc >> ImportError: DLL load failed: The specified module could not be found. >> >> Please let me know if i am missing something on import. If so please >> provide me with an example- Hide quoted text - >> >> - Show quoted text - > > Here are some more details from my earlier posting. Please click the > below link > > http://answers.splunk.com/questions/11145/its-getting-mysterious-to-make-= the-lookup-script-work > -- > http://mail.python.org/mailman/listinfo/python-list > Have you tried downloading the source for PyODBC and compiling it yourself? All you need to do is python setup.py install. My guess would be that it works just fine on 64-bit Python 2.6, they just never released a re-compiled version of it for that platform.