SyntaxWarning is used prior to the global decleration

4 posts
by JMV1998 » Tue May 16, 2017 7:41 pm
Hi I have been programming for a short period of time and do not know all the features of python in which I have come stuck with this warning. 'New_Item_Window' is used prior to global decleration.
I am unsure on how to tackle the problem any help would be greatly appreciated
Posts: 2
Joined: Tue May 16, 2017 7:25 pm
by scotty101 » Tue May 16, 2017 8:44 pm
Posting your code would help.

but try something like
Code: Select all
New_Item_Window = None

right at the very start of your code.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter
Posts: 2172
Joined: Fri Jun 08, 2012 6:03 pm
by elParaguayo » Wed May 17, 2017 8:51 am
Agreed, we need your code but my guess is that you've got a variable called New_Item_Window in the main body of your script. You've then got function which tries to assign a value/manipulate to New_Item_Window. That will throw the error you're seeing unless your function includes the line "global New_Item_Window" before you try to manipulate the variable.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.
User avatar
Posts: 1811
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK
by JMV1998 » Thu May 18, 2017 1:24 pm
[quote="scotty101"]Posting your code would help.

Thank you, for your help i will look at this and get back to you
Thanks again,
Posts: 2
Joined: Tue May 16, 2017 7:25 pm