import module unbelieveable behaviour

Peter Fodrek peter.fodrek at stuba.sk
Thu Jul 16 08:38:57 CEST 2009


On Thursday 16 July 2009 07:38:23 Carl Banks wrote:
> On Jul 15, 10:16 pm, Peter Fodrek <peter.fod... at stuba.sk> wrote:
> > On Wednesday 15 July 2009 17:41:54 Diez B. Roggisch wrote:
> > > Peter Fodrek wrote:
> >
> > ......
> >
> > > What does
> > >
> > > import nc
> > > print nc.__file__
> >
> > python
> > Python 2.6 (r26:66714, Feb  3 2009, 20:49:49)
> > [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.>>>
> > import nc
> >
> > >>> print nc.__file__
> >
> > nc/__init__.pyc
>
> What does it do if you run this from a script?

Ouch, I am and python rookie, that was needed to try to edit undocumented 
script from German author

this answers everything

/home/opt/HeeksCAD8/HeeksCNC> python ./test.py
/usr/local/lib/heekscnc/nc/__init__.py 

and it is because begining of the script

# -*- coding: utf-8 -*-
import sys
sys.path.insert(0,'/usr/local/lib/heekscnc/')
import kurve
import kurve_funcs
from nc.nc import *
import nc
print nc.__file__
import nc.rez

and

ls -a /usr/local/lib/heekscnc/nc
.          emc2_read.py    hpgl2dv_read.py  iso_codes.py  nc_read.py
..         hpgl2d.py       hpgl3d.py        iso.py        num_reader.py
attach.py  hpgl2d_read.py  hpgl3d_read.py   iso_read.py   siegkx1.py
emc2.py    hpgl2dv.py      __init__.py      nc.py         siegkx1_read.py

Thank you for your help, once more.


Peter



More information about the Python-list mailing list