Mount and Run an application programmatically in my Application - c++

Is there any one who knows how may I run an application package programmatically by giving file location path. Like if I want to install a software that needs Java for OS X. Then I might download the dmg file in background from url, save it and mount it. Then launch the .app or .pkg inside that DMG. I 'm looking any solution either in objective C or simple C/C++.

Related

Should I move windows project folder into WSL?

I'm trying to set up a work environment on a new machine and I am a bit confused how best to procede.
I've set up a new windows machine and have WSL2 set-up; I plan on using that with VS Code for my development environment.
I have a previous django project that I want to continue working on stored in a folder in a thumb drive.
Do I move the [windows] project folder into the linux folder system and everything is magically ready to go?
Will my previous virtual environment in the existing folder still work or do I need to start a new one?
Is it better to just start a new folder via linux terminal and pull the project from github?
I haven't installed pip, python, or django on the windows OR linux side just yet either.
Any other things to look out for while setting this up would be really appreciated. I'm trying to avoid headaches later by getting it all set-up correctly now!
I would pull it from github, and make sure you have the correct settings for line endings, since they are different between windows and linux. Just let git manage these though:
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
Some other suggestions:
Use a version manager in linux to manage your python versions - something like pyenv or asdf. It will make life easier.
Make sure to always create a virtual environment for everything and don't pip install anything in your main python. (I use direnv for virtual env management)
The single exception to the previous suggestion is pipx, which I do install in the main python and then use to install things like cli tools, black, isort, pip-tools etc.
Configure VScode to use the pipx installed versions of black, flake8 etc. for linting purposes.
If you're using Docker, enable the WSL integration for your WSL flavour (probably Ubuntu). Note that docker desktop needs starting before your WSL session.

how to run Django locally as a windows executable app

I'm considering building app with Django for only one user that would run application locally on windows. I read about containerizing Django apps, but it's new for me.
My goal is to run Django server on one click like a standard windows app and connect to it on localhost and interact with web browser. It is even possible?
It is possible, but this may not be the best solution. If you want to release a Django app that can be installed on your client computer, you usually need to ensure all the dependencies are shipped with the app.
Containerising your application means it will depends on Docker runtime (or any container system you use). You will have to setup Docker with your app, or ensure your client has Docker on his machine to run it. If the destination machine runs Windows or macOS, you will need to setup docker-desktop which may be more complicated than standard Docker runtime (linux only).
But if you decide to ship your app without containerising it, it will only depends on a Python interpreter and some dependencies (Django, dateutil, etc.). In such case, using python tools like virtualenv, you may prepare a ready-to-run application by creating the venv and installing dependencies at "build time". Then, with a proper setup (MSI for Windows or DMG for macOS), you may be able to distribute the final application so the client can install and run it without any additional step (you do all the hard job yourself).
Django app can be convert into .exe but it wont work as local server while click .exe because runserver command and some of django service wont support on this way as per my experiment.

pass zip file from unc to python code running inside docker

I have a python script running inside a docker container. This app does the loading of builds on to external hardware which is connected on the network. The builds are in zip format and are available in the local network share \\path\to\zip.zip. I am running a python script inside the docker container to trigger this loading zip file.
The python script is simple. All it takes is >python load.py IP path_to_zip
The script then unzips the contents and makes an ftp connection to the hardware and erases the existing contents, then loads the contents of the zip file.
At the moment, I see that the docker container is not able to access the unc path. The script runs fine on a normal environment (without docker)
I've tried it in different ways to resolve the issue
1.When I try giving the unc path from inside docker (attaching shell), I see that it cannot find the unc path
I tried building the Docker container with the zip file in it so that it is available. But I do not see the contents getting uploaded
to the hardware. I am not sure why.
can someone suggest what is the best way to perform point 1? which is my preferred option...

File upload Selenium Web driver python in linux machine calling a remote machine

Hi I have scenario that needs to upload a file in a webpage. Actually I know that selenium will not support file upload scenario. But this can be done in python with external libraries such as AUTOIT, PYWINAUTO. But the challenge is i have to run my code in a linux server that is going to call a windows remote machine.
When i tried installing pywinauto in linux server i got an error in importing winreg library. Hence i dont know how to proceed further. Please help me out to solve this scenario.
Both AutoIt and pywinauto are Windows-only libraries (at least for now). If you need to automate file upload on Linux, consider using AT-SPI accessibility (say pyatspi2 package).
If it's a server without X and DBus, I think the question is about remote code execution from Linux to Windows. Good option for the SSH remote execution is Fabric (very pythonic & nice), but using Cygwin or OpenSSH might be an additional challenge for you. There are many other tools like Ansible etc.

How apps installed at pip really works?

I'm new at django and i was looking for a wysiwyg and i fuond tinymce.
I installed at pip command line and i expect that create a folder at my folder project like a new app. It dont created no one folder but i did the next steps and for my surprise the app works fine at my project.
I want to know how this app really works at my project, in case im gonne deploy this project and how to deploy the app installed at pip or something like that.
My englhish is not good but i hope that was clear.
The applications, or libraries rather are copied directly inside one of the folders inside your python directory called Lib/site-packages. This exact location depends on your operating system you can find usually find your newly installed packages under
For Windows
C:/PythonXX/Lib/site-packages/
For Linux
/usr/local/lib/pythonX.Y/site-packages
When you run a python script, Python will automatically include these folders as available resources, and when you add for example import X to your code, it will check to see if X is listed.
You have more information on the topic available here.