I am looking for small bash or python script that will install a .dmg file.
We'll assume that the dmg contains one or more .app directories that have to be copied to /Applications, overriding any already existing directories.
Files or directories not matching the *.app pattern are to be ignored.
You can mount the disk image using
hdiutil attach -mountpoint <path-to-desired-mountpoint> <filename.dmg>
The disk image will be mounted at the selected path (the argument following -mountpoint). Then, search for an .app file and copy the file to /Applications.
Once you have finished installation unmount the disk image:
hdiutil detach <path-to-mountpoint>
Related
I created a Python project using PyCharm (2019.3.3) in folder F:\FolderA then I realized I meant to create it in F:\FolderB. So I copied my project from FolderA to FolderB. Now when I try to install a package, PyCharm says:
Cannot start process, the working directory 'F:\Projects\FolderA\MyProject\venv\Scripts' does not exist
I come from C# background, and everything project related is saved in .csproj file. Does Python have a similar file where it writes project/workspace information? So I can point to the correct path?
Inside /venv/scripts folder there are three "Activate" files. It holds the path to the old directory.
Replace the old paths with new paths
Restart PyCharm
Install package
Here's a screenshot of the path to the files:
Is it possible for pyinstaller to include multiple photos (.gif files). I use loads of photos in a Tkinter GUI, but I'm unsure whether or not this will work. My images are in different folders than the .py file, but I use the whole path when using the photos in my application.
I also use several .txt files in my program (kept in the same folder as the .py file), and a .wav file. Will my program still be able to access these?
Basically, is it possible to have an executable file that can access sound, image, and text files using pyinstaller.
I need to be able to distribute this as well. So, I need my exe to be able to access those photos, text files, and sound files when on another computer.
From my own experience, I guess you can move all the needed files into the folder where the executable is located (i.e. dist/) after building your application.
You can also do this in a single command: pyinstaller main.py --add-data <SRC;DEST or SRC:DEST> for adding additional non-binary files to the executable.
The path separator is platform specific, os.pathsep (which is ; on Windows and : on most unix systems) is used. This option can be used multiple times.
Alternatively, you can change the spec file generated by PyInstaller to add additional data files to your app.
Create a spec file using pyi-makespec main.py.
Change the spec file to include your data files:
a = Analysis(..., datas=[('path/to/your/file', '.'),], ...)
The first string specifies the file or files as they are in this system now.
The second specifies the name of the folder to contain the files at run-time.
After you have created a spec file and modified it as necessary, you build the application by passing the spec file to the pyinstaller command: pyinstaller main.spec.
Reference: https://pythonhosted.org/PyInstaller/spec-files.html
After my build is finished, I want to copy the file to another directory. It works fine for child directories, e.g.
Install("temp", "test_file.txt")
where temp is the name of the child directory and test_file.txt is file I want to copy. But I haven't been able to do so for parent directories. Here's my MnWE SConstruct file:
Install("..\\temp", "test_file.txt")
Note that I am using Windows 10 in case it matters.
I have found some information in the docs, but I am unable to translate it to a working example on my machine.
Write a Python UDF for Hadoop/Pig, and need to use some Python libraries like "request" which I installed locally by pip when doing local box UDF testing. Wondering how to deploy the pip package on Hadoop cluster so that no matter my Python UDF runs on which node, it automatically consumes?
Information about zip file format can be found at Zip (file format). Practically speaking it is a compressed archive format sort of like tar (an archive format) plus gzip (a file compression format). Java jar (Java ARchive) format is compatible with zip.
On Linux and Unix platforms a directory dir can be zipped with 'zip -r dir dir' to create a dir.zip file. On Windows 7-Zip is most useful for creating and unbundling zip files plus it can be used to unbundle and browse files having other compression and archive formats including tar and gzip.
Given a file dir.tar.gz it can be unbundled and zipped interactively using the 7-Zip GUI on Windows while on Linux and Unix systems the following commands can do the same thing:
tar zxf dir.tar.gz # creates directory dir by extraction and decompression
zip -r dir dir # creates dir.zip by bundling without removing dir
I want to copy a directory requests from current directory to *c:\Python27\Lib* (Python installed directory) using batch file.
Reason for using batch file is that user can double click this file and directory will get copied to destination.
But if different python version is installed then installed path will be different.
I found a link on stackoverflow How can I know python's path under windows? for this
but i can't write this in batch file because its a python code.
So what should i write in batch file so that i can copy the requests folder from current directory to the python path under windows ?
Code for batch file:
for %%P in (python.exe) do SET PYTHON_PATH=%%~$PATH:P
#%PYTHON_PATH% dcpp