New to python and need assistance

Hello my name is Scott I live in Vegas. I have been in cyber security for 15+ years, and have used python on and off. I am by no means a pro with it honestly I am barley a newbie with it. I have used .net for years though which helps me understand.

The issue I am having It is a twitter listener. In the project the developer coded the search terms directly in the main class. I want to create the list in a separate file. I am using VS code and I added a new file called tagList.py to the work space. Again I am very new to Python and I am having a hard time trying to do so. In the project he has a separate auth file named twitter_credentials.py where he is storing the api keys as variables. Those are importing and being referenced fine. When I attempt to create a keywords file in the same manner which I am calling tagList.py I get an error “module ‘tagList’ has no attribute ‘TICK_LIST’”.

In the file I have a single line ( TICK_LIST = “search terms here, comma separated if” )

Any help would be appreciated.

This is the GIT project I am referencing.

Please recategorize your post as ‘Users’ and subcategory ‘help’, you’ll be much more likely to get responses that way (the ‘Core Development’ category is for discussion of the Python language and interpreter).

Done. (plus some more text to meet 10 character minimum.) (Really?)

Hi Scott and welcome!

Without seeing your code, the error message is as mysterious to us as it
is to you. We need to see the context to understand it. But what we
don’t want to have to do is troll through your entire program :slight_smile:

(We’re volunteers giving support for free, not being paid for it, so
there are limits on how much you can expect us to do before we get bored
or stop caring.)

But here is some general advice you can use to debug this problem. Start
by ensuring that you are importing the correct file:

import tagList
print(tagList.__file__)

and ensure that the right module is being imported. If you have two or
more “tagList.py” modules it may be that you are getting the wrong one.

Next, see just what is in the tagList module:

print(dir(tagList))

Make sure that you can see the correctly spelled TICK_LIST. Did you
misspell it? Is it missing altogether?

Double-check and triple-check that you are using the exact same spelling
in both the tagList module and the module you are calling it from:

# tagList.py
TICKLIST = ...

# Caller:
tagList.TICK_LIST

A classic mistake we have all done a thousand times :slight_smile:

Next, make sure that Python is picking up the latest version of the
file. The interpreter caches modules, for speed, but sometimes during
active development you can easily end up with an older version of the
file from the cache:

  1. Double check that you have actually saved your changes to the file.
    It is easy to forget to hit Save and then wonder why Python isn’t
    seeing the new version of the file.

  2. To be absolutely sure that the cached version is not being used,
    completely exit the IDE or interpreter you are using to run Python
    and start it up again.

Does that solve the problem?

If not, to help us to help you, it may be helpful if you can reduce the
code down to a minimal reproducible example:

http://www.sscce.org/