I have a lot of troubles following the instructions form the Kivy website, many steps aren't explained like what should I answer to the warning.
WARNING: The output directory "..." and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)
Even if I choose y, the folder isn't removed.
Also should I always add these lines:
from kivy.deps import sdl2, glew
Tree('C:\\Users\\<username>\\Desktop\\MyApp\\'),
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)]
in the .spec file? Why are they necessary?
Not many info is available for Kivy.
Because I spent a lot of time understanding how I should package my app, here are some instructions that would have really helped me.
Some info are available at http://pythonhosted.org/PyInstaller/
Python 3.6 as of march 2017
Because packaging my app gave me the error IndexError: tuple index out of range, I had to install the developement version of PyInstaller:
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
Step 1:
I moved all the files of MyApp in a folder "C:\Users\<username>\Desktop\MyApp": the .py, the .kv and the images and I created an icon.ico.
I created another folder C:\Users\<username>\Desktop\MyPackagedApp. In this folder I press Shift+right click and select open command window here.
Then I pasted this:
python -m PyInstaller --name MyApp --icon "C:\Users\<username>\Desktop\MyApp\icon.ico" "C:\Users\<username>\Desktop\MyApp\myapp.py"
This creates two folders, build and dist, and a .spec file. In dist/MyApp, I can find a .exe. Apparently, if my app is really simple (just one label), the packaged app can works without the Step 2.
Step 2:
The second step involves editing the .spec file. Here is an exemple of mine.
(cf Step 3, for the explanations about my_hidden_modules)
I go back to the cmd, and enter
python -m MyApp myapp.spec
I then got this warning:
WARNING: The output directory "..." and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)
I enter y and then press enter.
Because I choosed y, I was surpised that the folder build was still there and that the dist/MyApp was still containing many files. But this is normal. PyInstaller can output a single file .exe or a single folder which contains all the script’s dependencies and an executable file. But the default output is a single folder with multiple files.
Step 3: adding hidden modules
When I click on the myapp.exe in dist/MyApp, the app crashed. In the log C:\Users\.kivy\logs\ I could find 2 errors: ModuleNotFoundError: No module named 'win32timezone' and SystemError: <class '_frozen_importlib._ModuleLockManager'>.
Because of this I had to edit the .spec file and add these lines:
my_hidden_modules = [
( 'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\site-packages\\win32\\lib\\win32timezone.py', '.' )
]
in a = Analysis I changed datas = [] to datas = my_hidden_modules,
Apparently this is because I used a FileChooser widget.
So, the line:
ALL ITS CONTENTS will be REMOVED!
yes, it will be removed AND replaced later with new files. Check the date. I think it prints permission denied if it can't do such a thin both for files and the whole folder, so you'd notice it. It's important though, because you need to add additional files into your folder.
Those additional files of two types:
kivy dependencies
application data
Dependencies are just binaries (+/- loaders, licenses, or so), you get them through the *[Tree(p) ...] piece of code, which is just a command for "get all files from that folder". Without them Kivy won't even start.
Similarly to that, the second Tree(<app folder>) does the same, but for your own files such as .py files, .kv files, images, music, databases, basically whatever you create.
Obviously if you remove the deps, app won't start and if you remove app data, you'll get some path errors and most likely crash. You don't want any of that :P
It also works if in the 'a = Analysis...' block in the spec file one substitutes
hiddenimports=[]
for
hiddenimports=['win32file', 'win32timezone']
for win32file, win32timezone or for whatever files are missing
Related
I am building a distribution package for xnec2c and I want .nec files to associate with xnec2c and also display the associated icon.
(This question is different than the many xdg-utils answers out there because it asks about packaging and whether xdg-* calls are actually necessary.)
I know I can register them with these:
xdg-mime install --mode system x-nec2c.xml
xdg-icon-resource install --mode system --context mimetypes --size 256 xnec2c.png application-x-nec2
xdg-mime default xnec2c.desktop # but `man` says not as root?
Should it be sufficient just to drop the .xml and .desktop and .png in the right place on the filesystem?
Does the post-install in the package need to run some or all of these commands?
I read here that the icon would be application-x-nec2 and not application/x-nec2. Is this correct?
I would like the files to work by placing them in the right spot without running the xdg-* tools if supported.
(The package is a .rpm, but type and distro shouldn't matter since xdg is a standard. I want the same basic process to work for .deb, too.)
Everything should associate as the mime type application/x-nec2 since "nec2" is the file format for ".nec" files. This is reflected in the .desktop and .xml definitions below unless I have an error. Please correct me if I have something out of place!
Here are the relevant files that deploy:
/usr/share/applications/xnec2c.desktop (see below)
/usr/share/mime/packages/x-nec2.xml (see below)
/usr/share/pixmaps/xnec2c.svg
/usr/share/icons/hicolor/256x256/apps/xnec2c.png
/usr/share/icons/hicolor/scalable/apps/xnec2c.svg
and here are is the content:
==> /usr/share/applications/xnec2c.desktop <==
[Desktop Entry]
Name=Xnec2c
GenericName=NEC2 Simulator
Comment=Numerical Electromagnetics Code software
Exec=xnec2c
Icon=xnec2c
Terminal=false
Type=Application
Categories=Science;
Keywords=nec2;em;simulator;
X-Desktop-File-Install-Version=0.22
MimeType=application/x-nec2;
==> /usr/share/mime/packages/x-nec2.xml <==
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-nec2">
<comment>NEC2 Antenna Simulation File</comment>
<icon name="application-x-nec2"/>
<glob-deleteall/>
<glob pattern="*.nec"/>
</mime-type>
</mime-info>
You don't need to run the mime-* tools, but you do need to update the desktop and icon associations for the freedesktop environment after install like so:
update-mime-database /usr/share/mime
update-desktop-database
gtk-update-icon-cache /usr/share/icons/hicolor
These should be run after uninstall, too, to cleanup after removal. In RPMs this is the %postun section.
Substitute /usr/share with whatever deployment variable you might use like %{_datadir} for RPM .spec's.
Also the icon name had an issue. It should have just been named 'xnec2c' not 'application-x-nec2' because the 'xnec2c' icon gets installed with the installer as follows:
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
I am trying to make a naoqi package with qipkg (I dont know if this problem is specific to aldebaran naoqi or if it is a general windows problem)
qipkg make-package Pepper-Demo.pml
but I get the folowing error:
NotInPath Could not find executable: lrelease
qipkg deploy-package is working as it should.
I solved it with the folowing steps:
Check if there is a .exe file called lrelease in the folder at:
C:\Program Files (x86)\Softbank Robotics\Choregraphe Suite 2.5\bin
If not, search for the file on your computer using search in file explorer.
The error message displayed in which folders it searched for.
Go to the first folder it searched in (or create it) and paste the lrelease file.
I'm trying to make a standalone .exe packaged Ruby Shoes app that uses images dynamically, meaning whichever images is found in the folder of the .exe file.
Shoes.app() {
background "bg.jpg"
}
This code works if the image is in the same folder when the .exe is packaged, and the image seems to be packaged into the .exe since it's not needed in the same folder as the .exe for it to display when running the exe. But when you want it to load the file in the same folder as the .exe, packaging the app without the image, it does not show. I've tried different ways at finding absolute path to the current directory where the .exe is launched from, but they all seem to point to some temporary directory under AppData and not where the .exe file is located.
Edit: my first answer was incomplete. Windows is a little odd in Shoes for packaged apps. Write a little test script.
Shoes.app do
stack do
para "DIR: #{DIR}"
para "LIB_DIR: #{LIB_DIR}"
cdir = Dir.getwd
para "CWD: #{cdir}"
end
end
Dir.getwd is probably what you want.
Calling pwd should get you what you want
Nope, Ok sorry get it now !:-)
Shoes is opening your exe/shy into AppData/temp so working directory and __FILE__ both point there !
Someone, some time ago proposed this : Trying to access the "current dir" in a packaged Shoes app
must be a better way !
EDIT:
you probably want custom packager (check "i want advanced install options")
check "Expand shy in users directory"
Do as you done for regular packaging.
Now when launching the exe, it will ask you( or the user) to choose where to install your app, proceed, note the directory.
Now before launching the installed app feed the noted directory with your resources and you should be ok
Some references : https://github.com/Shoes3/shoes3/wiki/Custom-Install-Scripts
(there's a lot more to it)
https://github.com/Shoes3/shoes3/issues/247#issuecomment-213919829
I cannot install the Three.js plugin for Blender. I have a Fedora with Blender 2.69, I created the directory io_mesh_threejs in /usr/share/Blender ... /addon and copied the 3 .py files into but the plugin doesn't appear in the user preference.
I also tried with a downloaded 2.65 version of Blender with no success.
I did it for another library (Babylon.js) and it worked fine so I guess it comes from the python files ?
Here is what I did to get it to work with Win 7 - may work for you also.
Make sure you copy the text from the Raw File format instead of just right clicking and downloading the python files. If you right click and download you might get some additional html code that will break it. Someone else here made that suggestion previously.
Put the import and export files in the io_mesh_threejs folder. Put the init file in the root of the addons directory.
That did the trick for me anyway.
hopefully this adds to the conversation stream ... I've spent two hours finding this answer myself for IFC file imports for Blender ... I've just now got there ... I'm on a Mac with OSX and my Blender 2.71 is positioned in /Users/username/Documents/Blender ... I tried the User Preferences to no avail ... even followed the PATH to /Users/username/Library/Application Support/Blender/2.71/scripts/addons and manually copied the files in using shell ... still nothing ... then I found that the actual place they should go is
/Users/username/Documents/Blender/blender.app/contents/MacOS/2.71/scripts/addons
In my case for IFCBlender I then made a directory called
bash$ mkdir io_scene_ifc
Then I copied in the all the downloaded files ... Hooray this now appeared in my User Preferences ...
After wasting some time to figure out what goes wrong, I finally have to ask for help. I want to use appledocs from Gentle Bytes. I followed every step of the quick install guide, but I´m not able to compile the project.
Here is what I´ve done:
1. cloned it from git://github.com/tomaz/appledoc.git
2. installed the templates to ~/Library/Application Support/appledoc
3. tried to compile the project
Everytime I try to compile, I get following error:
ERROR: AppledocException: At least one directory or file name path is required, use 'appledoc --help'
What do I have to do now?
Sounds like you've compiled it just fine and are now running the program. If it's a command-line program try command-option-R in Xcode to provide some arguments (i.e. names of files that you want to process).
The error means you didn't give it source paths: after all switches, you must give it at least one path to your source files. Can be either file or directory. In later case it will recursively scan the dir. Here's example
appledoc <options> ~/MyProject
Above example will use ~/MyProject directory as a source. You can also add multiple source paths. Note that you need to give the tool few options, see this page for minimum command line and other usage examples.
You either have to copy appledoc executable to one of directories in your path, as suggested by Caleb, or use full path to it when invoking (for example: /path/to/appledoc)