python application that queries a database [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need to develop a GUI desktop application that takes input from the user, does some calculations, and then runs a bunch of queries which should be exported into a csv, xls or txt file. I want to create an installation package which the user can install without installing any other applications (used for front end) and other database (other than MS Access). My questions are
If I use python for my front-end/GUI, can I create an installation package? I understand that we can create and .exe file from the .py file. I want the dB to be get copied in the right folder (path referenced in my program) on the end-user's computer when the user installs the package.
MS Access (2010) on my computer (Windos 7 OS) is 32-bit and I'm having trouble using it with 64-bit python (version 3.5.1) and pyodbc(version 3.0.10). Can I use any alternate dB (sqlite?) that the user doesn't have to install to run the application and I don't have to worry about getting the dB in the right folder on the end-users computer. My dB is very small (few tables with about 1000 rows each).
Thanks much!

Looks like you can do both - pyinstaller seems to support sqlite3, the python library for working with sqlite which seems like a great fit for your use case:
https://docs.python.org/3/library/sqlite3.html
https://pypi.python.org/pypi/PyInstaller/3.0
About exporting - you can write code for that using python, depends on the exact output you are looking for.
Here's an example of using sqlite tools for basic export:
Export from sqlite to csv using shell script
Hope this helps :)

Related

Can Python create a self contained package that can be deployed where python and pip is not installed? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Some programming languages provide capability t create a self contained packages that can run on any machine.
For example, dotnet core can self-contained apps per below:
https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained
The C# self-contained apps can be single large file, or a directory of all files required to run the application. The package can target Linux, mac or Windows.
In Python, what is the closest feature to self-contained app packages described above?
PyInstaller seems to be the current go to, and it works well in my experience. However, some people have reported that it has very large file sizes, but I've personally never found that to be a major issue.
If you use that, you would also probably need some kind of UI, but that's a separate issue in itself.

How can I pack python into my project? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am making a program that will call python. I would like to add python in my project so users don't have to download python in order to use it, also it will be better to use the python that my program has so users don't have to download any dependency.
My program it's going to be writing in C++ (but can be any language) and I guess I have to call the python that is in the same path of my project?
Let's say that the system where the user is running already has python and he/she calls 'pip' i want the program to call pip provided by the python give it by my program and install it in the program directory instead of the system's python?
It's that possible? If it is how can I do it?
Real examples:
There are programs that offer a terminal where you can execute python to do things in the program like:
Maya by Autodesk
Nuke by The foundry
Houdini by Side Effects
Note: It has to be Cross-platform solution
There are programs that "freeze" your python program including Python itself, for example Pyinstaller (http://www.pyinstaller.org/)
It won't help with the requirement in the third paragraph though, for that you'd have to include Python itself as part of the complete download, which seems unnecessary.
In order to run python code, the runtime is sufficient. Under Windows, you can use py2exe to pack your program code together with the python runtime and all recessary dependencies. But pip cannot be used and it makes no sense, as you don't want to develop, but only use the python part.
To distribute the complete python installation, like Panda3D does, you'll have to include it in the chosen installer software.
You can use py2exe to turn you python program into an executable. You do not need to keep python in the executable.

making a .exe from python including .txt files? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a python script that relies on over 400 .txt files (with HUGE dictionaries, so much so it needs to choose each one by itself and only load one at a time). How could I make an exe file from the python script that will come with the .txt files? I've looked at both pyInstaller and py2exe but nothing I see I understand/works for me?
Thank you in advance
EDIT: The text files have sensitive data in them, would it be possible for them to be only accessible by the python script itself?
You could also use the cx_freeze module to accomplish this. Similar to Moe's suggestion it also takes a --onefile flag I believe.
Here is a link to another stack question that is similar. The answer in there not only shows how to construct the setup.py file for cx but also error handling when it inevitably misses some dependencies.
EDIT**
Here is a link to an article about securing your data. I don't think that you can do it in any straight forward way so here are some suggestions.
first you could store your data in a non usual format. Such as bytes.
second there are programs to obfuscate the data. The link provided above discusses some.
Third you could host the data online and use some sort of encrypted key pair connection to securely acquire necessary data.
You can create the .exe file with pyInstaller or py2exe then use any installer like Inno Setup to package the created .exe file with the .txt files into a single installer package.
If you are using pyInstaller, you can use --onefile to make a single executable file for the code to use it for the above example.

Python for Android [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I had a look at Kivy,but the problem is it needs a virtual machine to run apps. Isn't there a way where python codes are directly converted to java bytecode which can be run by android without any virtual machine? What are the merits/demerits in terms of performance?
May be something in jython which would help?
Try SL4A for running Python code directly on your device. It requires no compiling, conversion to bytecode or virtual machines.
More information Here
Also, you can download an IDE (I've used Eclipse, like in the tutorial you will find on the site), installed a plug-in, created my source files there and then uploaded them to my phone, if you're uncomfortable with writing code on your device.
This page has full instructions on how to package a Kivy app into an APK: http://kivy.org/docs/guide/packaging-android.html
I think some one mislead you a lot or you are confused about how things work with kivy.
I'll take this opportunity to try and make things a bit more clear.
Kivy can be used to build stand alone apk, only if you had searched kivy in google play. This link shows a list of apps that mention kivy, there are a lot more apps there that use kivy and just don't mention that. There is also a partial user maintained list you can look at. You can install the apps from google play and you'd see that they are self contained and don't require you to download anything extra.
There are very easy instructions available on how to build a apk in the link mentioned by #Marcins.
Every python code passes through the python interpreter usually pre-compiled to pyc, that's how python works even Java uses a virtual machine JVM, Android's implementation uses Dalvik VM. You can learn more about the VirtualMachines used in the languages like java/python here. The python interpreter/vm consumes the code and executes it natively, it doesn't convert it to java byte code.
if you need to make something that needs more performance then you can even use cython with kivy to get more speed.

Export Python script [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm using Blender and Python and want to give the .py file to other users to use my script... My script uses external modules (like NumPy) which will rise the errors (like can't find module xxxx).
Not all people can install NumPy (or even Python :D) as many Blender users are just artists.
Another note is that NumPy doesn't work with Blender (I install it in the system's Python, then delete Blender Python so it relies on the system Python).
If you want to distribute your code with external dependencies then you should build a Python egg. The .egg format was created to solve the issue you are dealing with. It is a self-contained release of your code with dependencies and meta-data. Here is some information on how create Python eggs.

Categories

Resources