Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9249947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:19:33+00:00 2026-06-18T10:19:33+00:00

I looked at many of the exisiting nameErrors and undefined variable posts and unfortunately

  • 0

I looked at many of the exisiting nameErrors and undefined variable posts and unfortunately was unable to resolve my issue. I am relatively new to programming and especially Python.

I have a dictionary of dictionaries defined in informcast_data.py:

allLinks = {'Send or Edit Messages': {'link':'/InformaCast/admin?cmd=listMessages',   'page_title': 'Messages: Send or Edit Messages'}

I am importing informacast_data.py to users.py:

from informacast.informacast_data import ICData

I then have a function, verify_links which has the following for statement:

for href_link in hrefs:
    if href_link.find(ICData.allLinks['page_title']['link'])!=-1:
        self.logger.debug("verify_links found=True for " + str(href_link))
        found=True

If I leave quotes around page_title I get a keyError and I was told to remove the quotes as it is a variable not a string, I get the nameError when I remove the quotes and I am not sure how to proceed.

below is the full traceback:

Traceback (most recent call last):
  File "C:\Users\jesse.sole\Jesse_Workspace\trunk\src\informacast\tests\users.py", line 17, in test_appadmin_role
    self.verify_role("appAdmin")
  File "C:\Users\jesse.sole\Jesse_Workspace\trunk\src\informacast\tests\users.py", line 78, in verify_role
    self.verify_links(sel, roleName)
  File "C:\Users\jesse.sole\Jesse_Workspace\trunk\src\informacast\tests\users.py", line 104, in verify_links
    if href_link.find(ICData.allLinks[page_title]['link'])!=-1:
NameError: global name 'page_title' is not defined

Thank you in advance for any assistance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:19:35+00:00Added an answer on June 18, 2026 at 10:19 am

    allLinks is a nested dictionary. The top level has no page_title key, so that’s why you get a key error:

    >>> allLinks = {'Send or Edit Messages': {'link':'/InformaCast/admin?cmd=listMessages',   'page_title': 'Messages: Send or Edit Messages'}}
    >>> allLinks['page_title']                                                                                                      
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    KeyError: 'page_title'
    

    There is such a key in the nested dictionary though:

    >>> allLinks['Send or Edit Messages']['page_title']
    'Messages: Send or Edit Messages'
    

    I think you want to define a variable page_title that has the value 'Send or Edit Messages':

    >>> page_title = 'Send or Edit Messages'
    >>> allLinks[page_title]['link']
    '/InformaCast/admin?cmd=listMessages'
    

    If you loop over the keys in allLinks that would work:

    for href_link in hrefs:
        for page_title in ICData.allLinks:
            if href_link.find(ICData.allLinks[page_title]['link'])!=-1:
                self.logger.debug("verify_links found=True for " + str(href_link))
                found=True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked at many posts but unable to find an answer to my
I've looked through many posts and still not sure how to resolve this. Hope
I've looked at so many posts on what inflation is for android and I
I've looked at many posts on stackoverflow about this error, and it looks like
I've looked at many questions and resources which deal with the Self variable in
have looked through many posts here on SO, and haven't found any that address
I've looked through many of the existing threads about this error, but still no
I have looked at many other threads that show how to use accelerometer values,
I have looked at many different peoples answers to this problem but they only
I've looked through many similar threads which seem to range from changing settings to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.