Python linuxcnc.stat() showing no result.

More
04 May 2018 07:25 #110172 by kpj10
Short:
The other day i was making a python script to see currently opend ngc file, in case if I'm running a global LinuxCNC installation i can read the current file, but for a local installation of LinuxCNC I'm getting an empty string. What could be the problem.


Long:
On my laptop i have a simulation package of LinuxCNC installed. The installation was done pulling the LinuxCNC from GitHub and making a deb package, as i wanted to make a system wide installation.

Often there are other branches of LinuxCNC that solves my problem, hence I download them and make a local installation on my laptop.

To start a global installed file i directly type linuxcnc in my shell script.
Whereas for a local installation i have to cd to the location and then to script folder then i type ./linuxcnc. Everytime things work fine.

The other day i was making a python script to see currently opend ngc file, in case if I'm running a global LinuxCNC installation i can read the current file, but for a local installation of LinuxCNC I'm getting an empty string. What could be the problem.

Any help will be appreciated.

Thanks,
Kunal.
More
09 May 2018 12:37 #110431 by andypugh
Can you explain what you mean by "global" and "local"?
More
09 May 2018 13:01 #110433 by Todd Zuercher
Just a guess from the context, "global"=standard full installation of Linuxcnc, "local"=RIP (run in place).
Is that what you mean Kunal?
More
09 May 2018 13:35 #110436 by kpj10
Yep. Global is standard installation, and local is RIP.
More
15 May 2018 12:24 #110757 by andypugh
Are you starting your Python code from the same environment (ie command line terminal) as LinuxCNC?
More
15 May 2018 12:48 #110762 by kpj10
I start LinuxCNC from a terminal window, then again i open a new terminal window type python there i import the linuxcnc python module and do what I want to do.

For the timing i have made a glade app which i start with my LinuxCNC configuration.

In that app when I try to check current position just after homing, i'm getting 3.58... for x and y though its x and y are at 0. But when i make a move i get correct position.
More
15 May 2018 13:26 #110765 by andypugh
I think you need to run the rip-environment script in the second window prior to opening python.
Or use linuxcnc& in the first window to get back to the command line after launching linuxcnc (probably better)
The following user(s) said Thank You: kpj10
More
15 May 2018 13:38 #110767 by kpj10
I'll try out your second suggestion, because the first suggested solution is the approach i follow.
Time to create page: 0.074 seconds
Powered by Kunena Forum