Python Forum
Variable being erased inside of if statement
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variable being erased inside of if statement
#7
(Jun-09-2024, 11:50 PM)Skaperen Wrote: what error message do you get? does it say your variable (name) has disappeared? reappeared? is undefined? is transparent? can't be found? is hidden?

or do you get no error and just have wrong answers?

I finally figured it out. What was happening was when I ran the data through the if statement print statements kept putting out zero. As it turns out, there was an issue with how the files that didn't pass my filter were being saved downstream of the if statement. It cause my program to only save zeros to the file which were then passed back through the filter on subsequent iterations. The variable kept being printed fine because that was the variable I was comparing my saved files against. Sorry if that sounds a little confusing. This program is already 600 lines, so tracking down bugs gets a little weird.
Reply


Messages In This Thread
RE: Variable being erased inside of if statement - by deusablutum - Jun-10-2024, 02:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable definitions inside loop / could be better? gugarciap 2 602 Jan-09-2024, 11:11 PM
Last Post: deanhystad
  How to create a variable only for use inside the scope of a while loop? Radical 10 2,481 Nov-07-2023, 09:49 AM
Last Post: buran
  Cursor Variable inside Another Cursor . CX_ORacle paulo79 1 1,651 Apr-09-2022, 10:24 AM
Last Post: ibreeden
  An IF statement with a List variable dedesssse 3 8,991 Jul-08-2021, 05:58 PM
Last Post: perfringo
  define a variable using an if statement Margaridalopes 2 2,299 Oct-24-2020, 05:47 PM
Last Post: jefsummers
  Correct syntax for a variable inside a quotes: MP4Box command JonnyDriller 2 2,899 Feb-02-2020, 01:22 AM
Last Post: JonnyDriller
  How to store the value from variable into list & run a statement then put in variable searching1 1 2,574 May-29-2019, 06:36 AM
Last Post: heiner55
  Get variable from class inside another class hcne 3 2,973 Mar-30-2019, 03:02 PM
Last Post: ichabod801
  SELECT statement query question using a variable DT2000 2 3,176 Feb-23-2019, 07:35 AM
Last Post: DT2000
  Invalid syntax in two variable if statement? 00712411 1 2,377 Oct-10-2018, 12:36 AM
Last Post: stullis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020