Error when building Haxe project from Sublime Text 3 - python

I'm getting the error:
Traceback (most recent call last):
File "/Volumes/Sublime Text/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
return self.run(edit)
File "HaxeComplete in /Users/graphic/Library/Application Support/Sublime Text 3/Installed Packages/Haxe.sublime-package", line 338, in run
File "HaxeComplete in /Users/graphic/Library/Application Support/Sublime Text 3/Installed Packages/Haxe.sublime-package", line 925, in run_build
TypeError: 'NoneType' object is not iterable
In the console when I try to build my project. Is this a permissions issue or something? I'm unable to find much about it online when I search. I've tried different build targets to no avail, and I got the same error in Sublime Text 2.
As an important side note, the Build option in the menu is greyed out, and when I try to run it via keyboard shortcut I get "No Build System".

This problem appeared to boil down to a combination of two things:
I made sure to get the latest version of Haxe and Haxelib.
When I tried to trigger a build from Sublime Text 3, I had to make sure to have the project's build XML file open and active. Once it was the active file, I'd then choose a build target and start the build. After it had built successfully, I could change the active file and still complete a build, but sometimes it would appear to "forget" and I'd have to go back to the XML file, choose a build target, and trigger the build once again from the build XML file.

Related

Activating Conan run environment and running CuraEngine from command line

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?

Setup file cannot be installed on other computers

I created an installer file using nsis. After running the programme on my system, it worked flawlessly but when installed on third party system, it complained on launching the app.
Traceback (most recent call last):
File "Classify.py", line 20, in <module>
File "tkinter\_init_.py", line 2109, in wm_iconbitmap
_tkinter.TclError: bitmap "D:\Users\Engr M2J\Documents\GitHub\HAM1000-Image-Classifier\logo.ico" not defined
I know this is where the error is coming from;
root.title("HAM10000 Image Classifier by Engr. Sule Muhammed Abba- BookNowNow Code version 1.1.0")
root.iconbitmap(r'D:\Users\Engr M2J\Documents\GitHub\HAM1000-Image-Classifier\logo.ico')
it is actually referencing my computer path instead of it to be relative. This is the only way I could get the icon to load by using it direct path. whenever I use the below code, I get the error that follows;
root.iconbitmap('logo.ico')
I get this error
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "logo.ico" not defined
Please assist
Here are the steps taken to solve the problem.
I printed the working directory.
print(getcwd())
I then copied all code files to this directory
By doing this, I was able to load the icon using
root.iconbitmap(r'logo.ico')
My new software now runs seamlessly on different systems without any complain.
Any better solution is welcome but this will work perfectly.

Is it possible and feasible to compile the entire Python standard library to byte code?

Is there an easy way to pre-"compile" the entire Python standard library to byte code? If so, would this also guarantee that Python never re-"compiles" a file if a corresponding .pyc file already exists (as long as the standard library is not updated or modified)?
Background: On an application server, Python sometimes spontaneously goes into a broken state that manifests itself like this:
C:\> python
Traceback (most recent call last):
File "C:\Python27\lib\site.py", line 563, in <module>
main()
File "C:\Python27\lib\site.py", line 552, in main
aliasmbcs()
File "C:\Python27\lib\site.py", line 478, in aliasmbcs
enc = locale.getdefaultlocale()[1]
AttributeError: 'module' object has no attribute 'getdefaultlocale'
and that can be resolved by re-installing Python. Someone else told me that he has seen corrupted (0-byte) .pyc files and that deleting those solved the problem. However, I cannot reproduce the issue by deliberately creating 0-byte .pyc files.
I don't like the fact that files belonging to the standard library are "compiled" to byte code on demand, as this happens within a process running both Python and native code that can crash unexpectedly. I would prefer to have all Python code pre-compiled, whether or not it helps to resolve the above situation.
Make the system .pyc files read-only, even for administrator. This should prevent Python from modyfing them unnecessarily.
If You're on Windows go to properties → security → edit, and deny all privileges for all groups.

Find a program directory from within after turning to .exe using py2exe

I am writing a code which I want to have details to its own directory. e.g. C:\Users\User\Desktop\helloworld.py
Is there a way to find it from within the program using pywin32 or any other module?
If so, once I turn it into .exe using py2exe will it still be able to find it's own directory(C:\Users\User\Desktop\dist\helloworld.exe)
I tried the following code:
print os.path.dirname(os.path.realpath(sys.argv[0]))
This works but once I turn it into a .exe file it doesn't manage to run.... What other solutions can there be?
The error I get in the log file is the following error:
Traceback (most recent call last): File "finddirectory.py", line 4, in EOFError: EOF when reading a line
You can find that information on the py2exe wiki:
http://www.py2exe.org/index.cgi/WhereAmI

Opening PyGTK Python Module Error in py2exe

I have a project written in Python 2.7 and PyGTK, with py2exe for compiling. I have two modules, "Launchpad.py" and "RegistrationScreen.py". I need to open RegistrationScreen.py from Launchpad.py.
I am using the following code currently:
def open_registration(event, data=None):
subprocess.Popen(["python", "RegistrationScreen.py"])
This works fine when I test - the window is opened without the shell window opening.
However, when I compile using py2exe, I get the following log error on executing the created application.
Traceback (most recent call last): File "Launchpad.py", line 26, in
open_registration File "subprocess.pyc", line 672, in init
File "subprocess.pyc", line 882, in _execute_child WindowsError:
[Error 2] The system cannot find the file specified
How do I fix my code so py2exe will compile it correctly? Is there another way I can open the RegistrationScreen.py module's window from Launchpad.py, that won't throw errors in the final .exe file?
The problem is the path. RegistrationScreen.py is (probably) compressed inside dist/library.zip, but your code that calls it is looking for it in dist/RegestrationScreen.py.
I don't know what the best solution to this is... py2exe is kind of a pain for accessing files.
Also, you probably don't want to be doing subprocess.Popen(["python", "RegistrationScreen.py"]) because you can't guarantee your users will have python installed and accessible systemwide. If you really need a separate process, then maybe you should run py2exe on RegistrationScreen.py individually to create a separate .exe, and then include that in the dist folder of your main .exe?
I know that's somewhat convoluted, but it would probably work. And as I said, there might be a better way.

Categories

Resources