Activating Conan run environment and running CuraEngine from command line - python

I have written a program that is able to take a GCode file and convert it into an SBP file with a python script through a click of a button within a GUI. I have now been tasked with taking in an STL file and using a slicer (Cura) to convert that file into GCode.
I am currently trying to get the CuraEngine (without Cura) to work VIA command line in order to use the subprocess library within Python to do all of theses conversions within my personal GUI. However, the wiki on downloading CuraEngine isn't helping much.
I have been able to achieve installing and building the CuraEngine release, but cannot activate the Conan run environment through the walkthrough of the wiki (https://github.com/Ultimaker/CuraEngine/wiki/Building-CuraEngine-From-Source).
I am getting the error that the pathway (\build\generators\conanrun.sh) is not a recognized internal/external command, operable program, or batch file. When looking up the files within the generators folder, the conanrun file is actually an extension of .bat (conanrun.bat).
So a few questions I have:
What do I do to get the CuraEngine running on the command line at this point?
Would it be easier to just download/run the entire Cura application through the source? I've noticed a lot of others have done that, but I don't want the GUI that goes along with it.I've also had trouble downloading the Cura application from the command line, with ERROR: pynest2d/5.3.0-alpha+testing_0#ultimaker/testing: Error in generate() method showing up in the install.
As an extension of the above question, it seems the build instructions for CuraEngine has had a lot of complaints from others. As a result, is there a better way to get a slicer engine to work through a self-made GUI?

Related

QGIS - Cannot run executable .exe file or run matlab script through Python Console

i have matlab script which using few matlab libraries like Map ToolKit. I can run this script on MATLAB without any error. But i need to run this with QGIS and get output files.
Simply, script asks few question about Map Tools and get like .shp files and give output folder.
So to get these output files, i tried 3 ways:
I tried to run this code on Python Console. For that i installed matlab.engine and called script just like in documentation. But these matlab.engine doesn't let python to use matlab's own libraries so error on using shapeinfo function. It just let python to use few variables i think. So after failing on this i tried second way:
I created executable matlab file to run .exe file on python console. In here, there is a two way to get this exe file. First one is let you smaller file and doesn't include matlab runtime so you need to add matlab runtime on your path and i did it. Actually Matlab does that as default and i checked that it was okey. Executable file runs perfectly after clicking or on normal python scripts which is running on through CMD. But if i call Python Script in QGIS, it trying to open but returns Matlab runtime dll missing error. After i tried to compile with matlab runtime selection and results were same.
Lastly, i tried to run matlab.exe -r "try, run SCRPIT_PATH\script.m; end; quit on CMD and it works fine but if i call this on QGIS Python Console with os.system or subprocess.call functions, cmd appearing and closing immediately.
I guess QGIS doesn't let you to open some other applications somehow and i need to let it run. Or i just need to find import matlab libraries to python for work perfectly. I would be pleasure if you give any suggestion. Any solution for these ways or a different way would be great. Thanks.

How do you use pdflatex in Python?

I am trying to compile a .tex file in a Python script using pdflatex. The command pdflatex filename.tex works when I run it from the command line on Windows. However, attempting to run os.system("pdflatex filename.tex") just spits out 1 into the Python console and does not compile a pdf. I've also tried putting in the full file path similar to this person solved their problem but the same thing happens. Similarly, subprocess.call(['pdflatex', 'filename.tex']) just outputs a 1 and does not do anything.
It seems someone else has encountered the same problem in this thread, but on Mac instead of Windows. (But regardless of the operating system, they didn't find an answer.)
Why might this be happening?
EDIT: I've just discovered a solution. The script runs successfully (using the os.system approach) when I run the .py file using the command line. Previously I was attempting to run the script from RStudio, both using reticulate::source_python(filename) and also line-by-line via the reticulate REPL. Seems like the problem may actually be coming from R's reticulate package rather than anything to do with Python.
Fortunately RStudio has a terminal window so this doesn't end up being too inconvenient!

Trying to turn my python code into an app so it is easily shareable

I created a python code which creates a horse racing card betting game. I would like to share this game with my friends, who have macs, who do not have python or know anything about coding so they can play it. I have tried using pyinstaller to convert the file into a stand alone executable app. I used the command
pyinstaller --windowed Horse_Race.py
This works in that it creates a build and dist folder. The dist folder contains the app of the python code. When I run the app, however, it opens briefly (about 1s) then crashes without anything ever displaying on screen. The interesting part is that I can view the package contents of the app and run the code through my terminal by running the UNIX executable file which is within the package contents of the app.
In short the executable file works, however, the app will not run, and I cannot share the file with my friends who have macs because it just shows up as a text file. If anyone knows how to fix this issue or knows another creative way I can send my game to my friends please let me know.
Thanks for your help.
here is an easy souloution that saves time and does not require knowledge.
pip install auto-py-to-exe
and then just type
auto-py-to-exe
after typing the code above a window in your web browser will open with a ghraphical gui that looks like this
click here to go to image

Use a single iPython console to run files and parts of code in PyCharm

I started using Pycharm and managed to have the python prompt running after a file is run (link) and I found how to run pieces of code in the current iPython console (link).
For data science, however, it is very convenient to have a single iPython console/Python kernel where I can run files and code, just like Spyder does, and continue using the same started python kernel. For example to load a big amount of data with a script and write another script or pieces of code for plotting in different ways, exploring the data.
Is there a way in Pycharm to do it?
I think that it would imply generating automatically and running a line like:
runfile('C:/temp/my_project/src/console/load_data.py', wdir='C:/temp/my_project/src')
If the option does not exist, is it possible to make a macro or similar to do it?
The option "Single instance only" in Edit configurations doesn't help.

"Python runtime could not be located" for py2app standalone build

I'm attempting to turn a short Python program that I wrote into an easily-distributable application file for OS X, using py2app. I made it through the py2app tutorial, but when I click on my application file the following dialogue is shown:
A Python runtime not could be located. You may need to install a
framework build of Python, or edit the PyRuntimeLocations array in
this application's Info.plist file.
I'm not sure whether this is helpful, but clicking "Open Console" from that dialogue shows the following errors:
LaunchServices: Could not store lsd-identifiers file at /private/var/db/lsd/com.apple.lsdschemes.plist
launchservicesd[83]: SecTaskLoadEntitlements failed error=22
appleeventsd[53]: SecTaskLoadEntitlements failed error=22 11/27/16 7:29:19.787 PM
sharedfilelistd[307]: SecTaskLoadEntitlements failed error=22
I know that if py2app uses a "system" version of Python to produce an app, it won't include that Python in the distribution. However, entering $ which python in the terminal directs me to my anaconda installation, so that doesn't seem to be the issue.
This is my first time attempting to create a piece of software, so apologies in advance for any obvious missteps. Any help would be greatly appreciated, as I've been banging my head on this all day.

Categories

Resources