Python SQLServer Connect

Trying to run one of the google samples from

#https://code.google.com/p/pymssql/wiki/PymssqlExamples

conn = pymssql.connect(host='localhost', user='sa', password='master', database='tempdb')
cur = conn.cursor()
cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))')
cur.executemany("INSERT INTO persons VALUES(%d, %s)", \
    [ (1, 'John Doe'), (2, 'Jane Doe') ])
conn.commit()  # you must call commit() to persist your data if you don't set autocommit to True

conn.close()

When I run python googlepy.py i get :
C:\Python34>python googlepy.py
Traceback (most recent call last):
  File "googlepy.py", line 1, in <module>
    import pymssql
  File "C:\Python34\pymssql.py", line 3, in <module>
    conn = pymssql.connect(server="A117078\SQLEXPRESS", user="sa", password="mas
ter", database="tempdb")
AttributeError: 'module' object has no attribute 'connect'

Is there something wrong with the very first line, the import pymssql?
Assuming, probably incorrectly the 'connect' that has no attribute ties back in to the line 1 error?
xoxomosAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZberteocCommented:
You have to install the module from here:

https://pypi.python.org/pypi/pymssql/2.0.1

Modules are often like plugins that are outside python and they have to be installed separately. I am using the more popular pyodbc module or for Python > 3.3 version pypyodbc to connect to SQL server but that one should work too.

https://code.google.com/p/pyodbc/

https://code.google.com/p/pypyodbc/
0
ZberteocCommented:
I think I misunderstood. What version of python do you use?
0
ZberteocCommented:
Ok, you are using version 3.4, you need to use pypyodbc instead. Some modules didn't keep up with python newest versions.

https://code.google.com/p/pypyodbc/

It can be used exactly as pyodbc where you can learn here:

https://code.google.com/p/pyodbc/wiki/GettingStarted
0
ZberteocCommented:
Ok, me again. I noticed there is a pymssql verson for 3.4 so make sure you have that one installed:

https://pypi.python.org/pypi/pymssql/2.0.1


Use this package:

pymssql-2.0.1.win32-py3.4.exe (md5)      MS Windows installer      3.4      2013-10-28      436KB
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xoxomosAuthor Commented:
Thanx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.