Sorry in advance for my lack of proper programming lingo.
I currently have a Python 3.10 script in Jupyter Notebooks that I want to convert into some sort of packageable application for distribution to students as an educational tool. I was thinking to turn it into a container and run it through Docker Desktop, having students install Docker Desktop and distributing the container, but I am unsure of exactly how to do this, especially with specific libraries and environmental variables. Or, if there's another easier way to accomplish this, I am all ears. Thanks in advance!
Jupyter Notebooks says that it can export to HTML, which may be useful, but I'm unsure how to use this to get it to do what I want it to do.
I am a newbie at Python and I am starting my first tests. So, I have created the below script which has the following structure :
My question is, lets say that now I want to make this available for other users. the simplest way I can think of, is to create a folder in /bin/my_python_app and copy everything there.
The thing is, this looks a little brute.
What is the right way to do this?
Is there a way in which I can bundle all the script dependencies in one file and have that as the "binary" of my app so other people can run it?
I dont want people doing any other thing that simply run my app, without requiring them to install it or add any other kind of extra packages to their system.
I'm looking to be able to create an executable with py2exe or something similar that takes information from an excel sheet and returns a word file.
Since my coworkers are technically challenged, I need to create an executable that will take the work out of it for them.
Two questions here:
I have to be able to import something into the python script that represents DataNitro. What module represents DataNitro?
Is this legal? I won't be using a DataNitro license on every machine this exe will run on, besides my own, so if it's even possible, is this a bit shady?
Thank you.
P.S. If I'm not able to do this I will probably have to use xlrd,xlwt,etc.
The best way to give non-technical users access to DataNitro is to copy the VBA interface: hook the script up to an Excel button and have users press that button to run it. (There's no difference between running a Python script with DataNitro and running VBA code from the user's point of view.)
Each person using the script would need a DataNitro license.
There's no way to make DataNitro work with py2exe, unfortunately.
Source: I'm one of the DataNitro developers.
I'm a self-taught, amateur, purely recreational programmer. I don't understand all the fancy programming lingo, and I certainly don't have any good resources, apart from this website, where I can go for help. (i.e., Please dumb it down for me!) I would imagine my question here is somewhat common, but I honestly couldn't find any answers on Google or this website, probably because I don't know the proper terminology to search for.
~~~
Having said that, I feel I have a pretty solid grasp on the basics of Python. And now, I've created an application that I'd like to share with a friend. My application accesses JPEG image files on my computer using a directory path that I've written into the code itself. However, I'd like my friend to be able to store these image files anywhere on their computer, not necessarily in the file folder that I've been using.
I assume the best way to accomplish this is to allow my friend to choose the directory path for themselves and then to write their chosen directory path to a file at a predetermined location on their computer. My application would then have that file's location prewritten into its code. This way, it would be trivially easy to open the file at the predetermined location, and then that file would point my application to my friend's chosen directory path.
1.) Are any of my intuitions here misguided? Are there better ways of doing this?
2.) If you think my general approach is a reasonable one, then is there a good/common place on the computer where applications typically store their directory paths upon installation?
Any advice - or any recommended resources - would be very much appreciated! Thanks!
Well, the standard way to do this is a lot more complicated and platform-specific:
On traditional Unix, this is pretty simple; you create a text file in some simpler format (e.g., that used by ConfigParser, named, say, ~/.myprogram.cfg, and you write a line to it that looks like image_path=/path/to/images.
On most modern Linux systems, or any other FreeDesktop/XDG-based system, you should (at least for GUI apps) instead use a special directory looked up in the environment as XDG_CONFIG_HOME, falling back to ~/.config, instead of using ~.
On Windows, the standard place to store stuff like this is the Windows Registry (e.g., by using winreg), by creating a key for your program and storing a value with name image_path and value /path/to/images there.
On Mac, the standard place to store stuff like this is in the NSUserDefaults database (e.g., by using PyObjC, which isn't part of the stdlib but does come built-in with Apple's pre-installed Python) by opening the default domain for your program and adding a value with key image_path and value… well, you probably want a Cocoa bookmark (maybe even a security-scoped one), not a path.
That probably all sounds way, way too complicated.
One option is to use a library that wraps this all up for you. If you're already using a heavy-duty framework like, say, Qt, it probably has functionality built-in to do that. Otherwise, it may take a lot of searching to find something.
A simpler alternative is to just pretend everything is like traditional Unix. That will work on Windows and Mac. It will be slightly annoying on some Windows versions that your config file will be visible in their home directory, but not a huge deal. It means you won't get some of the bonus features that Mac provides, like being able to magically follow the directory if the user moves it somewhere else on his hard drive, or remembering the settings if he reinstalls OS X and migrates his old settings, but again, usually that's fine.
In between the extremes, you can pretend everything is like Linux, using a special, and unobtrusive, location for the files on Windows and Mac just as you do there. Both platforms have APIs to look up special directories, called "application data" on Windows and "application support" on Mac. Using PyWin32 or PyObjC, respectively, these are pretty easy to look up. (For example, see this answer.) Then you just create a subdirectory there named My App on Windows, or com.mydomain.myapp on Mac, and store the file there.
I've been looking for ways to make a GUI with a .py file, and have so far only found frameworks and modules like Tkinter. However, my ultimate goal is for this code to run on a lot of computers that don't necessarily have these modules installed. The machines are only guaranteed to have Python on them. Does anyone know a way to make a GUI under these restrictions?
The best way to do this would be to ship your application with those modules as a part of it; the user's computer doesn't need to have the GUI framework installed if you provide it.
What you're asking would essentially require you to write an entire GUI framework, which would give a result that would be similar or worse - with a LOT more work.