Python Forum
global name 'completion_name_regex' is not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
global name 'completion_name_regex' is not defined
#8
I promise the error messages are trying to help you :)

Quote:There's an error in your program: *** can't assign to literal (C:/WOGCC_Well_Completions_Scraper_Lil_Scraper_12b.py, line 34)

Here's your line 34:
Quote:
        completion_file = "" = re.findall(completion_name_pattern, str(soup)) 

You've got two equal signs there, which means you're trying to do double-assignment. Which is sometimes useful, but normally more confusing that it's worth. For example, you could use it like so:
>>> x = y = 5
>>> x
5
>>> y
5
But one of the things you're assigning to is an empty string.
>>> "" = 4
  File "<stdin>", line 1
SyntaxError: can't assign to literal
That's a strict no-no. I'm not sure what your intention is, probably that was just old code that got left over.
Reply


Messages In This Thread
RE: global name 'completion_name_regex' is not defined - by nilamo - Feb-21-2018, 09:38 PM

Forum Jump:

User Panel Messages

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