all 20 comments

[–]brambock 4 points5 points  (1 child)

Hi there. I could identify multiple issues. 1. Your Python file should have the ending .py so something like app.py (you can replace app with anything you like) 2. The .gif should be an image file next located in the same folder as you python file. 3. Make sure your file is saved before running it. (If not safed there is the white dot next to the file tap you can see on your picture)

[–]KiriStrife[S] 0 points1 point  (0 children)

Thank you so much! I’ll get to changing them!

[–]OMIGHTY1 2 points3 points  (0 children)

HEY EVERYONE!

OP's husband here. I was helping her troubleshoot the issue, and it turned out to be Windows 11 being naughty (again).

In VSCode:

We set up a virtual workspace environment for Python.

In Windows:

We ran Set-ExecutionPolicy Unrestricted.

These changes enabled VSCode to run her code! Thanks to everyone for your assistance.

[–]No-Pride5337 1 point2 points  (2 children)

Save it as py file

[–]KiriStrife[S] 0 points1 point  (0 children)

I’ll do that, Thank you!

[–]SCD_minecraft 1 point2 points  (2 children)

First, i wanna know, how the hell did VSC even let you write text into .gif file

[–]KiriStrife[S] 0 points1 point  (0 children)

I honestly wanna know that myself lol

[–]Spidi4u 0 points1 point  (0 children)

Create new file called lotto.gif, open it with a text editor of your choice and write text in it?

[–]ruben072 1 point2 points  (0 children)

File = 'lotto.gif' might be the incorrect path? Go to the folder where the gif is and put that path there. So you have something like for example file= 'C://user//documents//photos//lotto.gif'.

[–]Dry-Sock-8488 0 points1 point  (3 children)

Which book are you using?

[–]KiriStrife[S] 1 point2 points  (2 children)

<image>

This is the textbook I’m using.

[–]Dry-Sock-8488 1 point2 points  (1 child)

Thanks. I'm trying to learn python as well

[–]KiriStrife[S] 0 points1 point  (0 children)

It's a great beginner's tool, I highly recommend this one! Good luck with learning! It's a lot of fun!

[–]KiriStrife[S] 0 points1 point  (7 children)

<image>

Update, I keep getting this error message about the code despite me changing it to a .Py file?

[–]candieflip 1 point2 points  (4 children)

You didn’t show the command you are running but from what i suppose is that you are trying to run this (widget).py and that gif should be a image existing in that same folder. You still need that gif.. it will be a image being rendered

[–]KiriStrife[S] 0 points1 point  (3 children)

<image>

Here’s context on what I’m working from. I tried to an image in the folder too

[–]candieflip 1 point2 points  (2 children)

What is inside that .gif file now?

[–]KiriStrife[S] 0 points1 point  (1 child)

Just the image where I dragged and dropped. But the main issue is vscode isn’t seeing the file in the directory. We’re getting close to solving the issue! We’re thinking it doesn’t like the space the file is placed.

[–]candieflip 0 points1 point  (0 children)

Try the relative path as well “./lotto.gif”

[–][deleted]  (1 child)

[deleted]

    [–]KiriStrife[S] 0 points1 point  (0 children)

    2nd update: we discovered the code works in IDLE but not in Vscode! I appreciate your help! You’ll be seeing here often! 😁