Where should I put the python files called by my application? [duplicate] - python

I am working on a C# application. Inside this program it looks through a directory and uses files in the same directory containing the exe files in the debug folder. I added a setup project, for deployment, to the solution for the application. I tend to be naive and figured I could just drop the files and folders into the installation folder after I install it on another computer. I know there is a way to add these files and folders to the projects and set it up to have the installer install these files at the time of installation.

I assume you are working with Visual Studio 2010, and using Visual Studio Installer Setup Project to create an MSI output file.
Right click on the Setup project, select View menu, and select File System.
In there you are able to define files and folders to be installed.

Related

After Windows reset lost my user folder where my Pycharm Projects folder was and can't recover files

I just did a reset on Windows and deleted all the files, but did not wipe my drive clean. When i realized that I didn't put my Pycharm Projects folder into onedrive I started try to recover this folder with all my code in it. I found the user folder that held my Pycharm projects folder in windows.old and when i went into the project folder it had all the logs from messing around with the code and the project foler .iml file, but did not have any of the actual .py files from my coding projects. Is there anyway to recover these files. I tried to look everywhere and have done everything I can to recover these files but nothing is doing the trick
It looks like your Windows just updated to a new verion or build, that's why moved your project to a folder called windows.old, you need to copy the files that you need outside, then reinstall pycharm. It's recommended to reinstall programs.
For new projects, remember to use git repositories, www.github.com or www.gitlab.com can host private projects to avoid those problems

Python files to an MSI Windows installer

So I can use PyInstaller to make a one-file executable and to make a standard executable among other files in a folder.
But how do I turn Python files into an MSI installer so that it's fool-proof where it makes a shortcut on the desktop? (For distribution so that it isn't required for the user to have Python installed)
(When I say Python files to an MSI installer I mean the regular PyInstaller to folder output but with a way of getting a shortcut to the executable onto the desktop very easily for a regular user)
(It doesn't have to be PyInstaller if there's an alternative).
Pyinstaller does not intergrate such a tool.
You could get a third party installer (some suggested here How to create a robust, minimal installer for Windows?) and add your output exe to it and install that way, if you choose the right tool you will be able to add to desktop (plus a lot of other actions such as adding to path ect).
Or you could use cx_Freeze which has it built in. When running the setup script just add the bdist_msi flag.
It can add to shortcut desktop but is fairly limited in other ways (or you may need to perform some hack).
To add to desktop with cx_Freeze see Use cx-freeze to create an msi that adds a shortcut to the desktop.
You can use Inno which creates a shortcut on the desktop and start menu. Also, it is located in the program directory of windows. it means that you can install/uninstall it like other programs or applications.
Inno website:
https://www.jrsoftware.org/isinfo.php
A tutorial on how to use it on youtube:
https://www.youtube.com/watch?v=DTQ-atboQiI

How can I create a workspace in Visual Studio Code?

I have this very beginner question that I happened to install Visual Studio Code on my Mac, and every time I tried to run a simple Python program on that, it said that I need a workspace to run, so how do I create the workspace?
I am not sure how you try to run this program, but you can just go to menu View → Terminal and type python your_program.py in TERMINAL from the folder where your program is located.
And please check if you have not accidentally installed Visual Studio instead of Visual Studio Code (those are two completely different programs).
VSCode workspaces are basically just folders. If you open an empty folder in VSCode it will get treated as a workspace, and you can add any scripts you want to it. VSCode will create a new hidden folder in the folder you chose that will hold settings for the workspace. For python, make sure you install the python extension (just grab the one with the most downloads) and follow the instructions there to make sure your python environment is properly configured. If you're using git, you might want to add that hidden folder to the gitignore.

Open the Django project on git in Visual Studio 2015

I have a Django project on git repository. I would like to open this project with Visual Studio 2015 and continue. There is no "Python" option list of project types in the Create Project from Existing Code Files Wizard window.
What should I do to have the python option listed?
Or
How to open this project?
You need the Python Tools for VS.
https://microsoft.github.io/PTVS/

File resources in Python

I got few images and one exe file which I would like to bundle inside of the python exe file?
I mean the same or similar way that it could be done in the visual studio:
Please tell me if its possible, if so , how could I access the resources then?
I am using pyinstaller if it does matter.
You can't bundle your resources inside .Net runtime. Visual Studio allows you to bundle your resources inside your project exe not inside .net executable.
Same way you cannot bundle resources like images and exe files inside python.exe but using Pyinstaller you can create your project exe which will include your resources.
To create a single file use --onefile flag while bundling your project. As per Pyinstaller documentation -
"In a --onefile distribution, data files are bundled within the executable and then at runtime extracted into the work directory."
Here is a link for how onefile mode works

Categories