'import' error in csh

Joonas Paalasmaa joonas.paalasmaa at nokia.com
Thu Jul 12 09:50:28 EDT 2001


Jerry Olup wrote:
> 
> Howdy all,
> 
> I am using py 1.5.2 on sunos 5.6.
> 
> When I run this code (snip below) from csh, I get the following
> errors:
>    import: command not found
>    badly placed ()'s
> 
> When I run the code from the interpreter, however, it runs just fine.
>    >>> import xilcorelib
> 
> Any ideas?  I searched the group and found a '97 thread (Strange
> import error ... how?), but no conclusions therein.
> 
> # !/usr/bin/local/python
> import re, string, os  # regexp, string handling, system calls
> 
> # xilinx core library parse script.
> #
> #  ... other drivel
> #
> 
> # file opening and sizing.
> compfile = open('vhdl_analyze_order', 'r');
> outfile  = open('xilinxcorelib_comp.tcl', 'w')
> list_lines = compfile.readlines()
> linecount = len(list_lines)
> #<etc...>

That code hasn't gone thru Python interpreter, because the error message
comes from csh.
Try to fix the first line from '# !/usr/bin/local/python' to
'#!/usr/bin/local/python'
                                 ^
                                 Note that space

You can also try 'python myscript.py'



More information about the Python-list mailing list