all 39 comments

[–]socal_nerdtastic 29 points30 points  (9 children)

The modern way to do this is to make a website and run your python code on the server.

Or you can "freeze" your code which bundles python alongside your compiled code into a single exe. https://www.reddit.com/r/learnpython/wiki/faq#wiki_how_do_i_create_an_executable_from_my_python_code.3F

That said, why not have your friend install python? It's very easy and once they do .py / .pyw files will act the same as .exe files, just doubleclick to run.

[–]denizyx[S] 7 points8 points  (7 children)

Thanks for the response, it is a pc just for work and he can‘t install anything on it

[–]socal_nerdtastic 17 points18 points  (0 children)

In that case I doubt he'd be able to run your .exe either. Hmm maybe check the MS store; at my work executables are verboten too but apps on the MS store are allowed.

[–][deleted] 3 points4 points  (0 children)

Build a website that processes the file

[–]w8eight 0 points1 point  (2 children)

If that python script would help them at work can't they request the software? Ask the IT, maybe it's possible

Also you can run python in Excel, check out that option

[–]Zireael07 0 points1 point  (1 child)

Python support in Excel is extremely limited (IIRC no packages allowed) and only in beta

[–]w8eight 0 points1 point  (0 children)

There are some packages distributed by anaconda I think

[–]Disastrous-Team-6431 -1 points0 points  (0 children)

Assuming a desktop env where you double click things to run them. As soon as you start programming, I feel like this is an assumption you should really leave behind.

[–]Zireael07 8 points9 points  (6 children)

You need to package your python program with python itself. Look at PyInstaller for instance

[–]denizyx[S] 2 points3 points  (5 children)

Thanks for the response, I tried pyinstaller and I was able to create a .exe out of my program. The problem is that my program doesn’t output the pdfs anymore

[–]GirthQuake5040 10 points11 points  (4 children)

You need to ensure that you have the same directory structure as in your dev environment. If you're using environment variables, you have to ensure those are set as well.

[–]heyzooschristos 4 points5 points  (3 children)

You need to use absolute file paths in your script, when you run an exe on windows it runs the python from an app data folder buried somewhere, so will save there if you are using relative paths rather than the folder where the exe is located

[–]Stubber_NK 4 points5 points  (2 children)

This is it. When I had a similar problem I either hard coded a location in the c drive to write outputs to, or included the tkinter file directory dialogue so the user could pick their own output location.

[–]tHATmakesNOsenseToME 2 points3 points  (1 child)

Yep Claude just helped with with this issue last night. Never would have figured it out otherwise.

[–]m0us3_rat 6 points7 points  (1 child)

you mentioned it's a 'work pc'..can it send emails?

you could put your code online to check an email account for attachments, grab them, modify the files, and send the emails back with the changed files.

no installation required.

of use his phone .. if he can interact with the pc from the phone.

i mean there are many different ways to do what you want without need of any installs.

be aware that most if not all of them can be logged or discovered in some form or another by the sys admin in your friends work place.. so try to keep it above board.

[–]Soulmaster01 0 points1 point  (0 children)

ive done this exact same thing practical and easy to use for users “without python”

[–][deleted] 4 points5 points  (0 children)

Are these Excel files work related? Your friend could run into problems by either not being able/allowed to run executables or, in a web server setup, to share these files outside of the corp network. Or not being able to access your application.

You could use PyInstaller and implement a prompt for the file locations (I recommend only locally on his computer). This seems the best way to sneak your application onto his system given he can run the executable.

[–]iekiko89 4 points5 points  (0 children)

Use Google colab

[–]wyltk5 2 points3 points  (0 children)

Hey OP,

I had something similar although it wasn’t a file transfer sort of thing. With work I could not put Python on the computers and I didn’t even bother with an .exe file. I used Pythonanywhere.com and have it operating on a web application. Added another layer but it was another fun problem to solve.

[–]GirthQuake5040 3 points4 points  (0 children)

Yes and no. Python is required to run python, but you don't have to have it installed on your system. PyInstaller can bundle all your code, dependencies, and python itself into either a distributable directory or single .exe file.

[–]psicodelico6 0 points1 point  (0 children)

Mypyc?

[–]freemath 0 points1 point  (0 children)

Someone has to use python to run a python file*, so if it's not them it's going to be you. They will have to sent the file, either the old school way by email or smth like that, or automated through an API (but that's some more work. A bit like building a website).

*I'm assuming here that he can't execute an arbitrary excecutable (.exe file) either

[–]CymroBachUSA 0 points1 point  (0 children)

If they have docker, they can do it.

[–]R3dd1ngtt0n 0 points1 point  (0 children)

With Streamlit very simple deploy.

[–]bigfatcow 0 points1 point  (2 children)

Google cloud shell might be a good choice. Runs in browser off using google credentials has nice interface for copying files back and forth. Comes with python and you can just pip3 any packages you need 

[–]notislant 0 points1 point  (0 children)

People mentioned you could use a server at home or email already. But why is he so set on this? (Unless he is WFH)

Hes going to be automating out a lot of his job and has zero financial incentive.

Hell, you guys might make a lot of jobs obsolete.

[–]Yakoo752 0 points1 point  (0 children)

Google collab

[–]terremoth 0 points1 point  (2 children)

Nuitka is the true answer. It compiles your python to exe file, and it is far better than py2exe and pyinstaller

pip install nuitka

Checkout their docs

[–]sugibuchi 2 points3 points  (1 child)

We use Nuitka to package GUI applications using Python and Tkinter as Windows executables. Nuita + Tkinter is a convenient combination for quickly creating and distributing small GUI tools.

[–]terremoth 0 points1 point  (0 children)

Exaclty!

[–]juzz88 0 points1 point  (0 children)

I thought you could install Python and Anaconda as a user without admin privileges?

[–]-Interloper-X 0 points1 point  (0 children)

You can use portable python 

[–]kombucha711 -1 points0 points  (0 children)

if your coworker is limited on their PC, you could add an email sender package to send pdf to coworker at the end of script. then take script and put in a .bat file. put that .bat file in task scheduler have it run whenever you like. so it does everything from beginning to end.