1
  • I installed IronPython on Windows 7 64b
  • I ran IronPython Console from the start menu.
  • I typed in the following which works fine on a Linux box

(I'm not sure if sys is necessary but included just in case)

import sys
import sqlite3
conn=sqlite3.connect('test.s3db')

and got the error:

_sqlite3.OperationalError: unable to open database file

I then of course tried loads of other ways but got the exact same error every time. Of course test.s3db doesn't exist. Creating it if it doesn't exist is part of what connect does.

Other ways I tried (all of which would have worked on linux):

conn=sqlite3.connect('\\test.s3db')
conn=sqlite3.connect('//test.s3db')
conn=sqlite3.connect('C://test.s3db')
conn=sqlite3.connect('C:\\test.s3db')
conn=sqlite3.connect("test.s3db")
conn=sqlite3.connect("\\test.s3db")
conn=sqlite3.connect("//test.s3db")
conn=sqlite3.connect("C://test.s3db")
conn=sqlite3.connect("C:\\test.s3db")

See screenshot, yes it works on Linux. (btw, the screenshot is from my iPhone using iSSH ssh'd in to a mint 15 box)

Yes, there are loads of similarly titled questions all much more complicated and involving things like django or other addons. This is much more basic and as far as I can find, not a duplicate.

2
  • 1
    The code you gave works...provided you have write permissions to the directory you are creating the database in. Are you sure you have these? Commented Oct 25, 2013 at 16:00
  • @iCodez It's just Windows 7... shouldn't be any directory permissions, right? Commented Oct 25, 2013 at 17:12

1 Answer 1

1

You need to run IronPython as administrator on Win 7.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 - Yup, that is exactly what I thought. He didn't have the right permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.