Category: Little Tips

Little TipsPythonWeb Development

Python, AttributeError: ‘module’ object has no attribute ‘config’

Four years ago, when I first started learning Python, I came across a problem that would later on become a “Famous Question” on StackOverflow. You may be reading this article because you encountered the same problem.

Traceback (most recent call last): File “C:\Users\myname\documents\visual studio 2010\Projects\PythonApplication 1\PythonApplication1\RunSikuliOnVM.py”, line 97, in logging.config.dictConfig(LOG_DICT_CONFIG_OnVM) AttributeError: ‘module’ object has no attribute ‘config’ Press any key to continue . . .

So, I will quickly suggest you check what turned out to be my problem.

I had imported a module into my code and later on made reference to that module by calling a specific attribute, but there was no such attribute in the module. Or at least so thought my Python interpreter. The quick fix for the error that I had gotten turned out to clear the cache of my interpreter. An example of how to do that with an interpreter is in the documentation for PyCharm.

This seems to be what is meant by the Python 3 documentation when it warns that “multiple evaluations of the same attribute reference may yield different objects.” I extrapolate and conclude that the error I am observing is somewhat of a “different” result I am getting.

Now for those interested in understanding the AttributeError for its own sake, another part of the Python documentation describes the exception in these terms:

exception AttributeError :Raised when an attribute reference (see Attribute references) or assignment fails. (When an object does not support attribute references or attribute assignments at all, TypeError is raised.)

 

The problem with the case at hand is that the config module does have a config attribute. This is why I posit that it is the caching issue that is the problem here since the interpreter may be referring to a totally different module than the logging module your code may be calling in this instance.

Note: This article is still in development even though it has been published to offer some beginning of a solution to those dealing with the AttributeError: ‘module’ object has no attribute ‘config’ exception.

Advertisements
Little TipsWindows 10 TipsWindows PC

How to Record and Capture Every Step You Take and Click in Windows – Problem Steps Recorder

Have you ever wondered how to record all the steps that you went through to get to an error in a program you are using on Windows? There is an app for that! Like, literally, though! Microsoft shares the following guide on their support page.

Pro-Tip: What is cool is that you can use this application to record the steps on how to use a new piece of software to your friend or family member who asks. And if you are in enterprise, this is a handy tool for designing a Standard Operating Procedure manual.

To record and save steps on your computer

  1. To open Steps Recorder, select the Startbutton, and then select Windows Accessories > Steps Recorder (in Windows 10), or Accessories > Problem Steps Recorder (in Windows 7 or Windows 8.1).
  2. Select Start Record.
  3. Go through the steps to reproduce the problem you’re trying to diagnose. You can pause and resume the recording at any time.
  4. (Optional) As you record, select Add Comment, use your mouse to select the part of the screen that you want to comment on, type your comment, and then select OK.
  5. When you’re done, select Stop Record.
  6. Review the record of the steps you followed to make sure it shows what you want it to show. Select Save, name the .zip file, choose where to save it, and then select Save. Now you can attach and send this .zip file to the person helping you troubleshoot the problem on your PC. It can be viewed in any web browser.

To adjust settings

  1. In Steps Recorder, select the down arrow next to the Help button, and then select Settings.
  2. You can change the following:
    • Output location.If you don’t want to be prompted for a location and file name every time you save a file, select Browse to set a default location and file name.
    • Enable screen capture.Select No if you don’t want to capture screen shots—for example, if the screen might reveal personal information that you don’t want to share. The app will still record a text description of your steps.
    • Number of recent screen captures to store.The default is 25 screens, so if you need to record more than that, increase this number.

Please note that this application will not record text that you type in fields, some programs will not work with this app if they fill up the screen, the settings you make for your new recording will not be permanent. When you close the Steps Recorder or Problem Steps Recorder app, the settings you made for the session will be lost.

If your Windows System does not have this app or if there are functionalities you need, the site alternative to suggests some options.

Little TipsmacbookWindows PC

How To Re-Open the Tab You Just Closed on Chrome, Firefox, or Internet Explorer

Did you just accidentally close the web browser tab you meant to keep open? You can get it back with a quick shortcut.

On Windows: Ctrl-Shift-T.

On Mac: Command-Shift-T

Bonus: Ctrl-T Opens a new tab that will just sit there waiting for you to do something with it.

That’s it for today! Unless you are interested in exploring more Mac or Windows Keyboard Shortcuts.

Apple TroubleshootingBackupLittle Tips

Macbook Won’t Boot Past Gray Screen With Apple Logo

You probably just want to jump straight to the solution. So, here it is:

  1. Unplug all peripheral devices from your computer.
  2. While holding Option + Command + R + P, Power Up the computer, listen for 1st chime, then 2nd chime, then immediately release all the keys you were holding and watch the computer come to life.*
  3. Proceed to backing up your data onto an external hard drive or other solution you have at hand for backup and remember to backup on a regular basis.
  4. You are good to go!

Now, What Does Command + Option + R + P Do?

Glad you asked! I did not know either. But I looked  That key combination helps reset the NVRAM, sometimes called PRAM, on your Mac. The PRAM is a type of Non-Volatile RAM on your computer that stores some important parameters about your computer’s peripheral devices. This is why you are to unplug all peripheral devices as a first step of this troubleshooting.

According to Apple, “If you experience issues with sleep, wake, power, charging your Mac notebook battery, or other power-related symptoms, you might need to reset the SMC (System Management Controller),” which involves a different set of keys.

Lessons Learned From This Case of Mac Troubleshooting

Lesson Numero Uno: Always backup your computers! It is an investment worth it considering that most external hard drives cost way less than the price of a brand new computer. So, get on the Internet and look up best ways to backup your type of computer and go ahead and do it. You can also just ask your trusted and proven tech-savvy rafiki (translate “friend”) how it is done.

Finally, I want to mention that, as you would quickly notice by glancing on the keyboard nearest to you, the key combination that brings your Mac back to life requires some dexterity you could get from some practice with a keyboard or piano. So, lesson learned, find a piano class and start the lessons as soon as you can.

References:

320px-Apple-Wireless-Keyboard-German from Wikipedia
———–
* The only time this would not work is if the problem is totally unrelated to the solution I am offering. Haha! Smart! I figured that one out by myself!

RafikiTechnology regular expression cheatsheet
Little TipsWeb Development

Regular Expression

This is more of a note-to-self type of post.

You know that series of symbols and characters in a chain following each other? Sometimes you will find them with a find, replace, or find and replace function.

Examples:

  • This processes a URL:
  • somefunction.replace(/^http[s]{0,1}:\/\/[^\/]*\/?/, '/')
  • From WordPress: The following example removes all HTML comments in the first pattern, and causes a favicon (with any filename extension) to be loaded from another domain in the second pattern:
    #<!--.*?-->#s =>
    #\bsrc="/(favicon\..*)"# => src="http://mycdn.somewhere.com/$1"

Well, they are called regular expressions and you can learn more about them at some of these sites:

Any comments, suggestions, or questions? Please drop a note.

Little TipsNetworkingPrinters and DevicesWindows 10 Tips

ControlCenter4 error CC4-202

How To Get Here

So, there you are with your brand new Brother (e.g. a Brother MFC-L58000DW Series) multifunction (all-in-one) printer, scanner, and fax trying to scan a file from the Device (the scanner itself) to a PC, e.g. a Windows 10 PC.(Jump to Solution Options)

You go the usual way and click Scan to PC, but after you select which PC to scan to, nothing major happens on the scanner. The paper is not drawn into the wide open mouth of your scanner. Instead you scanner’s little LCD sits there telling you to check your firewall settings to allow communication between this scanner and your PC. Maybe you even go and disable your firewall on the PC or do something just as useless and dangerous.

Eventually, you decide to Google this and find this note I wrote to myself (and now to you). Ok, enough rambling, the solution is simple. Well, if the first solution works. Because, otherwise there are 4 to 6 other possible solutions, some more difficult than others. I will list them here, but you can find more details from the source article on Brother’s official website*:

Possible solutions**

Option 1: This solution is for Network Users Only (Machines that have a built in network card only): if you are connected to two different networks at the same time (e.g. Wi-Fi and Ethernet), disable one of them to keep only the one on which the printer can also be found. Then try to scan from the Brother Device and watch for the error message. You may need to restart your computer and check your network to confirm you are still connected to only one correct network.***

Option 2: For Network Users with only one network connection. Hunt down the TWAIN file labeled Twain001.Mtx and delete it (I would first just move it to another location until I determine that this is the solution that works for my case) from your AppData\Local\Temp folder which itself can be found inside your current user folder. Please note that you might need to unhide the AppData folder first. Restart your computer and test the scanner. If you continue receiving the same error message. Check if Option 3 is you case.

Option 3Download and run the ControlCenter4 Update Tool. If you are not of any of the previous two options, you may need to update your Control Center. You should be able to find the ControlCenter4 update tool on Brother’s Downloads page. Install the update tool, run it, restart your computer when prompted and then try to scan again.

Option 4: Reinstall the Brother MFC Pro Printer Utilities program. You can do so using the Uninstall program that is furnished by Brother together with the Printer Utilities software. Restart your computer then reinstall the Brother MFC Software from the original CD. You can also download the Full Driver and Software Package ( please navigate to their downloads page) from their site and install it. Try your scanner after the new software product is installed.

If the problem persists. Try to get in touch with your network administrator or with Brother, the company that produces your printer. You could also just stick to start your scans from the PC until a solution is found.

Disclaimer: *Try at your own risk. **I wrote down these steps as I learned them from Brother’s official site and am not intending to appear as the author of the above troubleshooting steps. ***THIS SOLVED MY ISSUE

AntivirusLittle TipsSecuritySmartphones

What’s that text from v5d@urdoc.us?

If you are like me, you did not want to open an apparently random text from v5d@urdoc.us or whatever the username@urdoc.us that just came to your phone. So you did a quick search in your favorite search engine and this article came up.

So, nothing to worry about. It’s just your optometrist or your dentist (one of those medical professionals you recently visited) reminding you of an appointment or a prescription to pick up.

Alright, with that said, here is a little disclaimer: be careful! Some crazy dude could forge this and spoof that sender’s email address. So, do not download or open any attachment if you can help it. First call your doctor to confirm (or check your email) and see if they sent you any notification.

Great! I hope you have a some peace of mind now. I did once I was reassured and run the antivirus and all the good stuff any cautious person would wanna do.

And, oh, one more thing. If you have considered blogging on WordPress.com or Jetpack before, get it it now! They have a 30% Off promotion if you use coupon code HOLIDAY30 by December 31, 2017.

WooCommerce