Another plasma component...

More
09 Jun 2019 02:46 #136341 by phillc54

I changed line #73 of configurator.py to
self.copyPath = os.path.dirname(os.path.abspath(__file__))

in order to get the links to use full path names and it seems to have worked. My new config loads just fine.

Thanks, I will give that a shot later.

Cheers, Phill.

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 02:52 #136342 by phillc54
OK, a bit of research says that I should use:
os.path.abspath(os.path.dirname(sys.argv[0]))


Cheers, Phill.
The following user(s) said Thank You: AgentWD40

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 03:09 #136343 by islander261
Guys

I know this will not be a great help here in getting all the configurator links worked out.

Given the rapid pace of Plasmac branch evolution some time ago I decided to just have my configuration be my systems .ini and .hal files plus links to all the required files to make the branch work. I had to manually build this, the configuration program took a different tack at that point in time. The plus side of spending the hour building this is that any time the branch is updated I don't need to mess with my configuration. I strongly encourage everyone to really try and make the configurator work. Especially if you cannot build a working .ini and .hal files from the examples. Please this is a last ditch effort and I am not sure others will support this.

This is about what I did:

1. I built a working machine.hal file for my hardware.
2. I added all the Plasmac connections to my machine .hal file. Not the recommended solution!
3. A major side track that I recommend you avoid until you have a working configuration is I integrated the files and .ini stanzas to support my pendant. This also required modifying the pendant .tcl file and adding a postgui.hal file.
4. Then I created a directory under my ~/plasmac/configs/ most likely if you have followed all the tuts yours is ~/linuxcnc-plasmac/configs/ directory to hold you working configuration.
5. I then copied the entire contents of the ~/linuxcnc-plasmac/configs/by_machine/plasmac/gmoccapy to my configuration directory ( if you are using axis it will be the axis directory).
6. Since I only work in one set of units I deleted all of the ones I don't use from my configuration directory.
7. Now I have a configuration directory full of broken links. The shortest term fix is just copy all the files from your ~/linuxcnc-plasma/configs/by_machine/plasmac directory and delete all links. This is VERY short sighted because all will be broken the next update.
8. The best way is to now make a new link to each file in your ~/linuxcnc-plasmac/configs/by_machine/plasmac/ directory and cut and paste it into your configuration directory.
9. Then delete each original link and rename the ones you just pasted in to the old names.
10. Now barring any cockups you should be good to go.

It should be pretty obvious now why you really want to try hard to make the configurator work.

John
The following user(s) said Thank You: phillc54

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 03:55 #136344 by phillc54
On my Stretch machine for this bit of code:
        self.copyPath = os.path.dirname(sys.argv[0])
        print self.copyPath
        self.copyPath = os.path.abspath(os.path.dirname(sys.argv[0]))
        print self.copyPath
        self.copyPath = os.path.dirname(os.path.abspath(__file__))
        print self.copyPath
I get exactly the same result which is an absolute path...

AgentWD40, what linux distribution are you running?

[code]

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 04:20 - 09 Jun 2019 04:38 #136345 by AgentWD40
I'm using debian stretch and python 2.7.13. It is a relative path issue. The last two methods you've shown will work, the first will only work sometimes.

Here is a test script saved in my home directory and me running it from different directories to illustrate what's going
import sys
import os

a = os.path.dirname(sys.argv[0])
b = os.path.abspath(os.path.dirname(sys.argv[0]))
c = os.path.dirname(os.path.abspath(__file__))

print a
print b
print c



[EDIT]
So it looks as though if you call the configurator from the terminal like you told me to earlier like this
~/linuxcnc-plasmac/configs/by_machine/plasmac/configurator.py
the ~ will get expanded to an absolute path before executing the script. My problem is I was cd'ing into ~ and then running
./linuxcnc-plasmac/configs/by_machine/plasmac/configurator.py
which is a relative path and so it wasn't working as expected... That's my guess anyway. But I imagine either of the last two methods would be more idiot proof for guys like me that can't follow instructions, and I wouldn't think you would need to check the working directory any longer.
Last edit: 09 Jun 2019 04:38 by AgentWD40.

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 04:44 #136346 by phillc54
Well, that explains why I haven't seen the problem before.

I have only ever run the configurator from a GUI file manager...

I think after a bit more research that I will use:
        self.copyPath =  os.path.realpath(os.path.dirname(sys.argv[0]))
as that will also eliminate any symbolic links if they exist.

Thanks for the report.

Cheers, Phill.

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 15:13 - 09 Jun 2019 15:30 #136378 by bevins
Replied by bevins on topic Another plasma component...
You need to install glade? IT complains of no glade.

Also it pulled 2.9. this normal?
Machine configuration file is 'imperial_plasmac.ini'
Starting LinuxCNC...
twopass:invoked with <> options
twopass:found /home/denis/linuxcnc-plasmac/lib/hallib/basic_sim.tcl
twopass:found ./plasmac.hal
setup_kins: cmd=loadrt trivkins coordinates=xyyz
twopass:pass0: loadusr -W hal_manualtoolchange
Note: Using POSIX realtime
setup_kins: cmd=loadrt trivkins coordinates=xyyz
APP: ./test/plasmac_test.py found: </home/denis/linuxcnc-plasmac/configs/by_machine/plasmac/gmoccapy/./test/plasmac_test.py>
Traceback (most recent call last):
  File "/home/denis/linuxcnc-plasmac/bin/gmoccapy", line 36, in <module>
    import gladevcp.makepins   # needed for the dialog"s calculator widget
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/__init__.py", line 1, in <module>
    from hal_pythonplugin import *
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/hal_pythonplugin.py", line 20, in <module>
    from led import HAL_LED
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/led.py", line 6, in <module>
    import gtk.glade
ImportError: No module named glade
Shutting down and cleaning up LinuxCNC...
task: 13 cycles, min=0.000009, max=0.010076, avg=0.007050, 0 latency excursions (> 10x expected cycle time of 0.010000s)
Note: Using POSIX realtime
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/denis/linuxcnc_debug.txt
and
    /home/denis/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
denis@plasma01:~/linuxcnc-plasmac/src$ Traceback (most recent call last):
  File "/home/denis/linuxcnc-plasmac/configs/by_machine/plasmac/gmoccapy/./test/plasmac_test.py", line 28, in <module>
    import gladevcp.makepins
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/__init__.py", line 1, in <module>
    from hal_pythonplugin import *
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/hal_pythonplugin.py", line 20, in <module>
    from led import HAL_LED
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/led.py", line 6, in <module>
    import gtk.glade
ImportError: No module named glade
Last edit: 09 Jun 2019 15:30 by bevins.

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 15:28 #136380 by AgentWD40

You need to install glade? IT complains of no glade.

I think we've worked it out. The issue was in the way the configurator was creating shortcuts to the config files. If it wasn't executed correctly it would create shortcuts that didn't point to the right place and understandably confuse LinuxCNC.

Also it pulled 2.9. this normal?

Yup! As of a few days ago were working on 2.9 instead of 2.8.

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 15:31 - 09 Jun 2019 15:37 #136381 by bevins
Replied by bevins on topic Another plasma component...

You need to install glade? IT complains of no glade.

I think we've worked it out. The issue was in the way the configurator was creating shortcuts to the config files. If it wasn't executed correctly it would create shortcuts that didn't point to the right place and understandably confuse LinuxCNC.

Also it pulled 2.9. this normal?

Yup! As of a few days ago were working on 2.9 instead of 2.8.


Still no go. Glade installed and I can start it fine.
Machine configuration file is 'imperial_plasmac.ini'
Starting LinuxCNC...
twopass:invoked with <> options
twopass:found /home/denis/linuxcnc-plasmac/lib/hallib/basic_sim.tcl
twopass:found ./plasmac.hal
setup_kins: cmd=loadrt trivkins coordinates=xyyz
twopass:pass0: loadusr -W hal_manualtoolchange
Note: Using POSIX realtime
setup_kins: cmd=loadrt trivkins coordinates=xyyz
APP: ./test/plasmac_test.py found: </home/denis/linuxcnc-plasmac/configs/by_machine/plasmac/gmoccapy/./test/plasmac_test.py>
Traceback (most recent call last):
  File "/home/denis/linuxcnc-plasmac/bin/gmoccapy", line 36, in <module>
    import gladevcp.makepins   # needed for the dialog"s calculator widget
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/__init__.py", line 1, in <module>
    from hal_pythonplugin import *
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/hal_pythonplugin.py", line 20, in <module>
    from led import HAL_LED
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/led.py", line 6, in <module>
    import gtk.glade
ImportError: No module named glade
Shutting down and cleaning up LinuxCNC...
task: 12 cycles, min=0.000010, max=0.010071, avg=0.007441, 0 latency excursions (> 10x expected cycle time of 0.010000s)
Note: Using POSIX realtime
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/denis/linuxcnc_debug.txt
and
    /home/denis/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
denis@plasma01:~/linuxcnc-plasmac/src$ Traceback (most recent call last):
  File "/home/denis/linuxcnc-plasmac/configs/by_machine/plasmac/gmoccapy/./test/plasmac_test.py", line 28, in <module>
    import gladevcp.makepins
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/__init__.py", line 1, in <module>
    from hal_pythonplugin import *
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/hal_pythonplugin.py", line 20, in <module>
    from led import HAL_LED
  File "/home/denis/linuxcnc-plasmac/lib/python/gladevcp/led.py", line 6, in <module>
    import gtk.glade
ImportError: No module named glade
denis@plasma01:~/linuxcnc-plasmac/src$ 
Last edit: 09 Jun 2019 15:37 by bevins.

Please Log in or Create an account to join the conversation.

More
09 Jun 2019 15:43 - 09 Jun 2019 15:50 #136383 by AgentWD40

Still no go. Glade installed and I can start it fine.


Oh, sorry. Disregard my previous reply. I thought you were replying to yesterday's issue. For some reason when I was looking at your post on mobile it didn't show your code block.

[edit]
It looks like it's complaining that the gtk.glade module for python is missing.

Maybe try
sudo apt-get install python-gtk2 python-glade2
to install it ?
Last edit: 09 Jun 2019 15:50 by AgentWD40.

Please Log in or Create an account to join the conversation.

Moderators: snowgoer540
Time to create page: 0.240 seconds
Powered by Kunena Forum