#πŸ”’ .py conversion

186 messages Β· Page 1 of 1 (latest)

jolly tangle
#

Hello. I made a Python script saved as .py
I need to make it a true .exe in an easy way, that doesnt involve things like installing pyinstaller. Anyone able to help?

wet impBOT
#

@jolly tangle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

jolly tangle
#

The code works fine, it draws images from a folder in its file group so as an exe it will need to be able to draw files or hidden files from attached folders

grizzled wigeon
jolly tangle
#

Okay, C# is a language I understand.

grizzled wigeon
#

What's with the aversion to pyinstaller though? It works pretty well for most cases

jolly tangle
#

But i still need it to have the core functionality of.

  1. Open random image on set interval from attached folder
  2. Repeat
jolly tangle
#

Honest to god id love just an online converter

#

Like i have the fully finished .py, I have a folder where images are stored, and its all grouped in a main folder

#

Keep in mind. I am new to python, this is the first python script ive ever written

#

I had to self teach myself how to code in python

grizzled wigeon
#

So what errors were you getting with pyinstaller?

jolly tangle
#

That python wasnt installed, paths weren't set up, unknown commands, pip doesnt exist

#

Like I swear every error in the book

#

I looked to online resources that offered solutions that didnt work

grizzled wigeon
#

Sounds like less of a pyinstaller issue then an environment issue

jolly tangle
#

Oh and I couldn't even install pyinstaller

#

That too

#

Like I said. I dont wanna go through the troubleshooting right now. I will at a later date. For now i just want the easy solution

#

I am just unsure if C# will be able to do what i need the code to do.

grizzled wigeon
#

There is no easy solution it sounds like. But there is an EASIER solution, which is to just setup your environment correctly and use pyinstaller. I could help, I've used it before to deliver an executable.

jolly tangle
#

Well itd have to wait till I got off work.

#

I'm sure this would be easier on my personal laptop

#

I have the code if you want it. Its like a 45 line .py that opens images

grizzled wigeon
#

Yeah you can post it if you want

jolly tangle
#

Let me just make sure it doesnt have any private/confidential paths!

wet impBOT
jolly tangle
#

There it is

#

And some parts dont even work

#

Such as the window recoloring

grizzled wigeon
#

Okay, I'll take a look

jolly tangle
#

It does work all n all tho

#

It opens images in rapid succession in random positions along the users screen

#

My code may be scuffed or rudimentary

#

As I kinda vibe codded and just used what i thought would work

#

So apologies in advance if its TERRIBLE

undone loom
#

Do you really need to have .exe though? It often brings more unnecessary work as python is not really made for that

jolly tangle
#

It needs to be able to be opened regardless of having python

undone loom
#

Would it be easier to have people install python? Because pyinstaller and tools as such just bundle the python to the exe, basically. Which results to the antivirus to flag them

jolly tangle
#

That would be fine because its automatic

#

I know from experience that installing python is ANNOYING

#

So it would be best if it either ran without it, or installed it with the file

grizzled wigeon
undone loom
#

You do have to note that the user downloading would have the exe flagged as a virus when they install it, so if it's just random stranger you will have hard time having someone install that

jolly tangle
#

Well its not going to random strangers

jolly tangle
#

I want it to just work wherever you run it, without installation of anything extra (or if it installs, atleast automatically with the file)

#

I need to open this on 100 computers. And I dont want to manually install python 100 times

undone loom
#

Do you need to avoid pyinstaller?

jolly tangle
#

As stated above, I struggle to install it currently and set it up

#

So unless any of you want to package the file with pyinstaller, that wont work for this

#

I want to do ANYTHING but trouble shoot pyinstaller rn

#

Also do I need to bake the images and assets into the exe? Or can those stay in a seperate folder?

undone loom
jolly tangle
#

But again. I dont want to troubleshoot pyinstaller rn

#

I want LITTERALLY ANY other solution

grizzled wigeon
jolly tangle
#

Sigh...

undone loom
jolly tangle
#

I can try pyinstaller on my personal in a bit and get back to you

jolly tangle
undone loom
#

There should be --add-data flag for that

jolly tangle
#

Let me give that a go

undone loom
#

Though it might require code changes to the path handling

jolly tangle
#

Immediately gave an error

#
At line:1 char:3
+ --add-data
+   ~~~~~~~
Unexpected token 'add-data' in expression or statement.
undone loom
sullen leaf
#

Nuitka is an option

#

and you ran the above in a repl, not in the shell

jolly tangle
#

Lets try that again then

sullen leaf
#

I mean, same basic idea.

python is an interpreted language, but fundamentally needs a runtime

jolly tangle
#

Ran it in shell, same thing

sullen leaf
#

show the whole window

#

you're in a repl

jolly tangle
#

I ran it in powershell terminal

#

Unless thats wrong too

sullen leaf
#

screenshot it

jolly tangle
#

I cannot at this time

#

We can come back to this later

#

Im gonna try this all on my personal

undone loom
#

I was able to compile to to exe by just copy pasting your code and running pyinstaller on it, the path handling requires some fixes there

#

I'm not sure where the errors you see happen?

grizzled wigeon
#

This script seems kinda...malicious. You're hiding the main window and spawning windows rapidly all over the screen infinitely. I'm reminded of old javascript malware which did the same thing

undone loom
#

Thought, it starts spam opening images

jolly tangle
undone loom
#

Why would you want to do that....?

jolly tangle
#

To spam open images on my computer

undone loom
#

You don't need exe for that...

jolly tangle
#

I want a code to do it

undone loom
#

Do the people you are trying to distribute this to know about it, I kinda doubt it

jolly tangle
#

Yes

grizzled wigeon
jolly tangle
#

I intend to not only verbally convey this

#

And also have a file in the folder say "hey, if you open this file, your computer will be image spammed"

undone loom
jolly tangle
#

Its for a convention im going to

#

It spams images of the charecter

#

Who is a computer head!

#

I intend to distribute this on floppy disks (a key charecter trait is they use floppy disks)

#

The program is also named after them!

#

Being "Scagtastic" their name is scag

#

Perhaps I could code a window that comes up first that says "are you sure you want to open this? It will ["warning"]"

#

I'm not sure how I'd do that, so if any of you know then thatd be great!

#

I could also put a limiter on how many images it loads as to not crash their pc!

#

-if I knew how to do that-

grizzled wigeon
#

I think a limiter makes much more sense for this

undone loom
#

!rule 5 I do wonder if this applies here

wet impBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

jolly tangle
undone loom
#

Spamming windows on someone else PC...?

jolly tangle
#

This is meant to be like a silly in charecter prank

#

I do not intend anything malicious

undone loom
#

The original code had no intent of limiting it

jolly tangle
undone loom
jolly tangle
#

I have no idea how to set these things up, so I wanted opinions from others

#

Well id appreciate help making the code ethical then!

grizzled wigeon
#

Code can be unintentionally malicious if not written properly. I'll give them the benefit of the doubt that it wasn't intentional

jolly tangle
#

If I was being malicious I wouldnt ask for help being ethical lmao

#

But i appreciate the education! It hadnt crossed my mind that it may be malicious

undone loom
jolly tangle
#

How would I go about adding a limiter?

#

Like, does so many, then it stops the program (allowing all windows to be closed)

grizzled wigeon
#

Well right now the code doesn't allow the program to ever end because you're hiding the main window in the background

jolly tangle
#

Here let me run it on my PC

#

I believe there is still the X

#

Let me test!

#

And- its broken

#

How the hell-

#

The image folder isnt linked anymore?

#

Wow... python is FUN /sarc

undone loom
#

You were talking of it showing images of X, and some convention. Why not just make a "slide show" out of it, no need to spam the images there, wouldn't the people there much more appreciate it

jolly tangle
#

Whats a slideshow?

undone loom
#

Just change the image within the single window

jolly tangle
#

Like Google slides kinda sideshow? Or is there a python meaning

jolly tangle
#

Like so

#

Id probably need to slow down the rate of spawning, and add a cap to it

#

Maybe I could add a sound too!

#

Do you get the general concept though?

#

I may be explaining it poorly and i apologize if so

grizzled wigeon
#

Possible less malicious idea: open a canvas the size of the screen, paste images in random parts of it

jolly tangle
#

Oooh intresting

#

Could i make the canvas transparent?

undone loom
#

You could probably rotate, zoom, fade them as well

grizzled wigeon
jolly tangle
#

My idea with using windows is you can close them out

jolly tangle
#

And each image counts as its own window so it has to be closed out

#

I don't wanna overload the other laptop oppening it, so id likely go for a cap of 10 (as theirs 8 images)

grizzled wigeon
#

There's still the problem of the main window being hidden. If the user can't close the main window the program will never end.

jolly tangle
#

I'm pretty sure its there!

#

Everytime i use the program theres only the x

#

I went to double check but my code broke on line 7

#

And i dont know how

#

So first i need to fix that

#

Then test it

#

Then add nessesary limiters, maybe a warning window before the program starts

#

Then it should be done!

#

I appreciate the help offered thus far!!

#

Let me try and troubleshoot, and if I hit any roadblocks ill ask here!

jolly tangle
#

Fixed it!!!

#

And i can confirm the window is still there

#

The minimize, fullscreen, and X

#

Now how would I add a warning before the program starts?

#

Im thinking a window with text, and buttons like "yes" and "no"

jolly tangle
#

And my code broke-

potent mural
#

Pyinstaller:

jolly tangle
#

What?

sleek shore
#

download claude code

#

and ask it to do what u want

#

this task specifically is very easy for it to handle because its like a fire and forget type thing

sullen leaf
#

no-one needs you to tell them that they can ask an AI

jolly tangle
#

Alright

#

I fixed the code

wet impBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.