SOLVED: Trouble getting at the tool table via Python...
- pferrick
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 89
- Thank you received: 3
29 Apr 2020 18:40 #166124
by pferrick
Trouble getting at the tool table via Python... was created by pferrick
Hi all-
This is probably going to hilight my pathetic efforts to learn python, gtk, GladeVCP etc. all at the same time, but....I'm trying to put values from my tool table into various labels on a GladeVCP side panel.
I have this (among much else which is working) in a file called tools.py:
And when this code runs I get this in the terminal that I ran linuxcnc from:
The thing is that I do have offsets and stuff in my tool file (which exists and is referenced correctly in my .ini file), not the zeros- which tells me (as if the error message didn't!) that it is apparently not being read.
Any suggestions?
tnx,
Patrick
This is probably going to hilight my pathetic efforts to learn python, gtk, GladeVCP etc. all at the same time, but....I'm trying to put values from my tool table into various labels on a GladeVCP side panel.
I have this (among much else which is working) in a file called tools.py:
import linuxcnc as l
s = l.stat()
s.poll()
print s.tool_offset
And when this code runs I get this in the terminal that I ran linuxcnc from:
File "/usr/lib/pymodules/python2.7/gladevcp/tooledit_widget.py", line 161, in reload
self.hash_code = self.md5sum(self.toolfile)
File "/usr/lib/pymodules/python2.7/gladevcp/tooledit_widget.py", line 306, in md5sum
f = open(filename, "rb")
TypeError: coercing to Unicode: need string or buffer, NoneType found
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
The thing is that I do have offsets and stuff in my tool file (which exists and is referenced correctly in my .ini file), not the zeros- which tells me (as if the error message didn't!) that it is apparently not being read.
Any suggestions?
tnx,
Patrick
Please Log in or Create an account to join the conversation.
- bbsr_5a
- Offline
- Platinum Member
Less
More
- Posts: 544
- Thank you received: 105
29 Apr 2020 18:46 #166125
by bbsr_5a
Replied by bbsr_5a on topic Trouble getting at the tool table via Python...
hi
first where do you start this image
this is a Postgui event
so it does not work from main HAL section
then what Gui in general is running Gmocappy or QTpyVCP as it refers to 2.7 python
did you change the name of the tooltable file from ini or tool.tbl still in use
first where do you start this image
this is a Postgui event
so it does not work from main HAL section
then what Gui in general is running Gmocappy or QTpyVCP as it refers to 2.7 python
did you change the name of the tooltable file from ini or tool.tbl still in use
Please Log in or Create an account to join the conversation.
- pferrick
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 89
- Thank you received: 3
29 Apr 2020 19:35 #166134
by pferrick
Replied by pferrick on topic Trouble getting at the tool table via Python...
Hello-
Here are some more details: I am running Axis with a GladeVCP side panel. When I load the side panel in my ini file there is python code attached to various buttons. This error message appears when I press a button in my 'Tools' panel, which has a file called tools.py containing a handler for the button press event.
My tool table is called pkf.tools (my initials) which is what is pointed to in my .ini file (TOOL_TABLE = /home/pferrick/pkf.tools or something like that)
Hope that helps a bit...!
Patrick
Here are some more details: I am running Axis with a GladeVCP side panel. When I load the side panel in my ini file there is python code attached to various buttons. This error message appears when I press a button in my 'Tools' panel, which has a file called tools.py containing a handler for the button press event.
My tool table is called pkf.tools (my initials) which is what is pointed to in my .ini file (TOOL_TABLE = /home/pferrick/pkf.tools or something like that)
Hope that helps a bit...!
Patrick
Please Log in or Create an account to join the conversation.
- pferrick
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 89
- Thank you received: 3
29 Apr 2020 19:53 #166135
by pferrick
Replied by pferrick on topic Trouble getting at the tool table via Python...
OK, here's another data point:
When I remove the ToolEditor widget from my GladeVCP panel, the Python error goes away. So that may be a version problem of some sort. Anyway, what I'd like to be able to do is keep track of the Z offsets only, which is why I'm trying to read the tool table in the first place.
I still get (0.0, 0.0, 0.0 etc) from my python code though...
Patrick
When I remove the ToolEditor widget from my GladeVCP panel, the Python error goes away. So that may be a version problem of some sort. Anyway, what I'd like to be able to do is keep track of the Z offsets only, which is why I'm trying to read the tool table in the first place.
I still get (0.0, 0.0, 0.0 etc) from my python code though...
Patrick
Please Log in or Create an account to join the conversation.
- pferrick
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 89
- Thank you received: 3
29 Apr 2020 20:38 #166142
by pferrick
Replied by pferrick on topic SOLVED: Trouble getting at the tool table via Python...
Turns out I was getting exactly what I was asking for: the offsets for the current tool. Which, when you don't have a tool loaded is zero!
Plus, I realized that the stat object returns the status of linuxcnc when you poll it. All I need is the contents of the tool table file whenever I read it, which I can get using a basic open() function in Python.
<sigh> If I had _another_ brain, it'd be lonely!!
thanks!
Patrick
Plus, I realized that the stat object returns the status of linuxcnc when you poll it. All I need is the contents of the tool table file whenever I read it, which I can get using a basic open() function in Python.
<sigh> If I had _another_ brain, it'd be lonely!!
thanks!
Patrick
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
Less
More
- Posts: 7780
- Thank you received: 2075
30 Apr 2020 05:56 #166189
by cmorley
Replied by cmorley on topic Trouble getting at the tool table via Python...
What version of linuxcnc are you using?
Please Log in or Create an account to join the conversation.
Time to create page: 0.056 seconds