import module unbelieveable behaviour

2009-07-15 Thread Peter Fodrek
Dear conference!

I have test Why python based script for HeeksCNC post-processing does not 
work...  And I've got unbelievable behavior  When importing module module 
manually it works, but same opertaion from script does not
 work as seen

/opt/HeeksCAD8/HeeksCNC> 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.rez
>>>
/opt/HeeksCAD8/HeeksCNC> python test.py
Traceback (most recent call last):
  File "test.py", line 7, in 
import nc.rez
ImportError: No module named rez


/opt/HeeksCAD8/HeeksCNC> python ./test.py
Traceback (most recent call last):
  File "./test.py", line 7, in 
import nc.rez
ImportError: No module named rez


Would anyone be helpful for me to get more information about this problem 
because  pydb does not show anything usable for me,please?

I look forward hearing form you

Yours  faithfully

Peter Fodrek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import module unbelieveable behaviour

2009-07-15 Thread Peter Fodrek

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

and as well

ls nc 
attach.py   hpgl2dv_read.py  iso_codes.pyc  nc_read.py 
emc2.py hpgl3d.pyiso.py nc_read.pycrez.pyc
emc2_read.pyhpgl3d_read.py   iso_read.pynum_reader.py  rez_read.py
hpgl2d.py   __init__.py  machines.txt   rez_codes.py   siegkx1.py 
hpgl2d_read.py  __init__.pyc nc.py   siegkx1_read.py
hpgl2dv.py  iso_codes.py nc.pyc rez.py 


and module is compiled well
ls -la nc/rez*
-rwxr-xr-x 1 peto users  1391 2009-07-15 13:18 nc/rez_codes.py
-rwxrwxrwx 1 peto users   255 2009-07-15 14:28 nc/rez.py
-rwxr-xr-x 1 peto users   222 2009-07-15 14:28 nc/rez.pyc
-rwxr-xr-x 1 peto users  5920 2009-07-15 13:17 nc/rez_read.py

Thank you 

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import module unbelieveable behaviour

2009-07-15 Thread Peter Fodrek
On Thursday 16 July 2009 02:18:52 Carl Banks wrote:
> On Jul 15, 6:12 am, Peter Fodrek  wrote:
> That's a tricky one, indeed.
>
> Here's my guess: test.py is a symlink to a file in another directory.

It is not true guess
ls -la test.py
-rw-r--r-- 1 peto users 1990 2009-07-15 14:19 test.py  

But maybe access rights  needed to be corrected...

Thank you 

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import module unbelieveable behaviour

2009-07-15 Thread Peter Fodrek
On Thursday 16 July 2009 07:38:23 Carl Banks wrote:
> On Jul 15, 10:16 pm, Peter Fodrek  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.pyhpgl2dv_read.py  iso_codes.py  nc_read.py
.. hpgl2d.py   hpgl3d.pyiso.pynum_reader.py
attach.py  hpgl2d_read.py  hpgl3d_read.py   iso_read.py   siegkx1.py
emc2.pyhpgl2dv.py  __init__.py  nc.py siegkx1_read.py

Thank you for your help, once more.


Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import module unbelieveable behaviour

2009-07-15 Thread Peter Fodrek
On Thursday 16 July 2009 08:38:57 Peter Fodrek wrote:
> On Thursday 16 July 2009 07:38:23 Carl Banks wrote:
> > On Jul 15, 10:16 pm, Peter Fodrek  wrote:
> > > On Wednesday 15 July 2009 17:41:54 Diez B. Roggisch wrote:

> sys.path.insert(0,'/usr/local/lib/heekscnc/')

I was mentioned that this adds system path to multipath list(As $PATH)  and it 
replaces path instead. That was problem..

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: error when compiling source on linux

2009-07-17 Thread Peter Fodrek
On Friday 17 July 2009 06:44:26 aj wrote:
> when I try to compile Python 2.6 from source code on ubuntu, I get the
> message
> /usr/bin/ld: cannot open output file python: Is a directory

This says that there is directory in the sources with same name as will be 
named output

It can only occur when you are not compiling software correctly via INSTALL or 
README file

I think you made 

./configure
make

as compiling process

if this is true try 

mkdir bulid
cd build
../configure
make
make install


Kind regards 

Peter 
-- 
http://mail.python.org/mailman/listinfo/python-list


Regular expression

2009-07-21 Thread Peter Fodrek
Dear conference!

I have  third party regular expression

 self.pattern_main = re.compile('(\s+|\w(?:[+])?\d*(?:\.\d*)?|\w\#\d+|\(.*?\)|
\#\d+\=(?:[+])?\d*(?:\.\d*)?)')

with code

 def readline(self):
self.line = self.file_in.readline().rstrip()  
if (len(self.line)) : return True
else : return False

 while (self.readline()):
words = self.pattern_main.findall(self.line)


This handles text file  like

// remark
PL_OFF
PARK
FS
MA  52.8806 ,  18.0914
SS
AD_W
PL_ON
C   52.3955 ,  -16.1511 ,  -90.

It handles file correctly with two exceptions

1) omits ',' in the a output
2) omits minus sign in the numbers...

Would anyone recommend me what to change regular expression to add thesee two 
think to the output,please?

Thank you for any help.

I  look forward hearing form you
Yours faithfully

Peter Fodrek
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regular expression

2009-07-21 Thread Peter Fodrek


21.7.2009 v 16:50, MRAB:


Peter Fodrek wrote:

Dear conference!
I have  third party regular expression
self.pattern_main = re.compile('(\s+|\w(?:[+])?\d*(?:\.\d*)?|\w\#\d 
+|\(.*?\)|

\#\d+\=(?:[+])?\d*(?:\.\d*)?)')

[snip]

It handles file correctly with two exceptions
1) omits ',' in the a output
2) omits minus sign in the numbers...
Would anyone recommend me what to change regular expression to add  
thesee two think to the output,please?


self.pattern_main = re.compile(r'(\s+|,|-?\w\+?\d*(?:\.\d*)?|\w#\d+|\ 
(.*?\)|#\d+=\+?\d*(?:\.\d*)?)')


Thank you I will try yesterday...

Peter 
--

http://mail.python.org/mailman/listinfo/python-list


Re: Embedded Systems development using Python

2010-09-06 Thread Peter Fodrek
On Monday 06 September 2010 13:02:56 VGNU Linux wrote:
> Hi List,
> Can Python be used for embedded systems development ?

It is hard to say yes or no. For hard Real-time systems or hard Real-time 
parts of complex system answer is no, in another type of embedded systems yes 
or maybe

> If Yes can anyone point me to a tutorial/reference website which explains
> about this.

There are no tutorials to do so as I know.


Peter
-- 
http://mail.python.org/mailman/listinfo/python-list