Jump to content
  • Advertisement
Sign in to follow this  

Python prob

This topic is 5413 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello im attempting to learn python using the PythonWin IDE. I used it to type up this code from a tutorial.
def buildConnectionString(parmas):
    """ Build a connection string from a dictionary of parameters.

    Returns string."""
    return ";".join(["%s=%s" % (k, v) for k, v in params.items()])

if __name__ == "__main__":
    myParams = {"server":"mpilgrim",
    print buildConnectionString(myParams)

But when I try to run it I get these errors. I don't see why. The code looks the same as in the tutorial. Traceback (most recent call last): File "C:\Python23\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict__ File "C:\WINDOWS\Desktop\Script1.py", line 14, in ? print buildConnectionString(myParams) File "C:\WINDOWS\Desktop\Script1.py", line 6, in buildConnectionString return ";".join(["%s=%s" % (k, v) for k, v in params.items()]) NameError: global name 'params' is not defined

Share this post

Link to post
Share on other sites

Sorry. I couldn't resist. Gotta love spelling mistakes in programming. [flaming]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!