#๐Ÿ”’ How can I fix this?

39 messages ยท Page 1 of 1 (latest)

unkempt steppe
#

...

thick geyserBOT
#

@unkempt steppe

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.

unkempt steppe
#

!code ๐Ÿ™‚

thick geyserBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

unkempt steppe
#
self.plot_canvas.get_tk_widget().destroy()
            if self.toolbar:
                self.toolbar.destroy()
            self.plot_canvas = FigureCanvasTkAgg(fig, master=self.plot_frame)
            self.plot_canvas.draw()
            self.plot_canvas.get_tk_widget().pack(fill=tk.BOTH, expand=True)

            # Add toolbar for zoom, pan, and save
        self.toolbar = NavigationToolbar2Tk(self.plot_canvas, self.plot_frame)
        self.toolbar.update()
        except Exception as e:(
            messagebox.showerror("Error", f"Failed to plot equation: {e}"))
upbeat moon
#

Can you show the whole code?

unkempt steppe
#

sure

short comet
arctic rampart
#

Would also be useful to know exactly what the problem is

unkempt steppe
short comet
#

The line before an except should be at a different indentation level

unkempt steppe
short comet
#

Yup, that's the problem

short comet
#

Your indentation is messed up

unkempt steppe
#

oh

upbeat moon
unkempt steppe
#

and whenever i update my code on Pycharm, it wont update when i run it... why is this so?

unkempt steppe
arctic rampart
unkempt steppe
#

ohh

arctic rampart
#

Your problem is as Meltz stated, your except needs to be on the same indentation level as your try

short comet
unkempt steppe
#

ahh gotcha

upbeat moon
short comet
unkempt steppe
#

whats the issue here... Ive been trying to fix for millenia

unkempt steppe
short comet
unkempt steppe
#

indent?

short comet
#

yes

short comet
unkempt steppe
short comet
thick geyserBOT
#
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.