Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'below)': 0.05; 'sys': 0.05; 'imports': 0.07; 'script,': 0.07; 'python': 0.08; 'none)': 0.09; 'silently': 0.09; '0.0,': 0.16; 'enthought': 0.16; 'ideas?': 0.16; 'received:192.168.200': 0.16; 'timeout': 0.16; 'windows).': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; 'linux': 0.17; 'string,': 0.18; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'somewhere': 0.23; '(or': 0.23; 'command': 0.24; 'shell': 0.24; 'fine': 0.26; 'windows': 0.26; 'problem': 0.28; 'import': 0.28; 'script.': 0.29; 'print': 0.29; 'script': 0.29; 'cc:addr:python.org': 0.30; 'cmd': 0.30; 'installation': 0.30; 'list': 0.32; 'certainly': 0.32; 'usually': 0.32; 'there': 0.33; 'difference': 0.34; 'however,': 0.34; 'header :User-Agent:1': 0.34; 'fail': 0.34; 'trouble': 0.35; 'skip:i 30': 0.37; 'using': 0.37; 'run': 0.37; 'but': 0.37; 'some': 0.38; 'subject:: ': 0.39; 'received:192': 0.39; 'under': 0.39; 'data': 0.39; 'why': 0.39; 'case': 0.39; "it's": 0.40; 'header:Received:6': 0.60; 'your': 0.61; 'expert': 0.62; 'dear': 0.63; 'press': 0.72; "skip:' 180": 0.84; 'following.': 0.91; 'subject:Data': 0.93; 'working,': 0.93 X-IronPort-AV: E=Sophos;i="4.69,404,1315173600"; d="scan'208";a="2328159" X-Virus-Scanned: amavisd-new at zimbra.sequans.com Date: Tue, 25 Oct 2011 18:15:22 +0200 From: Jean-Michel Pichavant User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) MIME-Version: 1.0 To: spintronic Subject: Re: Data acquisition References: <362e368f-829e-4477-bcfc-c0650d231029@j7g2000yqi.googlegroups.com> In-Reply-To: <362e368f-829e-4477-bcfc-c0650d231029@j7g2000yqi.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org 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: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1319559327 news.xs4all.nl 6976 [2001:888:2000:d::a6]:52410 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:14971 spintronic wrote: > Dear friends, > > I have a trouble with understanding the following. I have a very short > script (shown below) which works fine if I "run" step by step (or line > by line) in Python shell (type the first line/command -> press Enter, > etc.). I can get all numbers (actually, there are no numbers but a > long string, but this is not a problem) I need from a device: > > '0.3345098119,0.01069121274,0.02111624694,0.03833379529,0.02462816409,0.0774275008,0.06554297421,0.07366750919,0.08122602002,0.004018369318,0.03508462415,0.04829900696,0.06383554085, ...' > > However, when I start very the same list of commands as a script, it > gives me the following, which is certainly wrong: > > [0.0, 0.0, 0.0, 0.0, 0.0,...] > > Any ideas? Why there is a difference when I run the script or do it > command by command? > > =========================== > from visa import * > > mw = instrument("GPIB0::20::INSTR", timeout = None) > > mw.write("*RST") > mw.write("CALC1:DATA? FDATA") > > a=mw.read() > > print a > =========================== > (That is really all!) > > > PS In this case I use Python Enthought for Windows, but I am not an > expert in Windows (I work usually in Linux but now I need to run this > data acquisition under Windows). > Just in case you have a local installation of visa and it silently fails on some import, try to add at the begining of your script: import sys sys.path.append('') When using the python shell cmd line, '' is added to sys.path by the shell, that is one difference that can make relative imports fail in your script. If it's still not working, well, it means the problem is somewhere else. JM