Python Forum

Full Version: SyntaxError: EOL while scanning string literal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey Guys,

Im trying in look in the registry for an item based off what the user inputs. For some reason the last back slash is causing issues. I need this to look for the next entry, but how do I go forward with it?

usr_input = raw_input('What Program would you like to search for? ')
location = 'SYSTEM\ControlSet001\services\'
RegLocation = location + usr_input
Please show enough code so that it can be run as supplied
and Please show full traceback messages (all of them, verbatim)
import _winreg
from _winreg import *
usr_input = raw_input('What Program would you like to search for? ')
location = 'SYSTEM\ControlSet001\services\'
RegLocation = location + usr_input
def getMDACversion():
    hKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, RegLocation)
    result = _winreg.QueryValueEx(hKey, "ImagePath")
    return result[0]
print getMDACversion()
try:

location=r'SYSTEM\ControlSet001\services\'
No luck same thing.

If it matters im using code 2.7
That shouldn't matter. What is the full traceback?
Full Traceback? Im sorry I don't understand.
The Traceback is the error code.
location = r'SYSTEM\ControlSet001\services\'
^
SyntaxError: EOL while scanning string literal





The arrow is pointing to the ' mark instead of the beginning.

The backslash at the end and comma are also blue in Atom.
You're right the raw string (r'...') doesn't work right. Double all of the backslashes in the string and take away the r and it should work.
Pages: 1 2