Jump to content

[Answered] Import Sqlite3 Not Working In Python Script


Zpic

Recommended Posts

Hi I'm sure this is a very basic question and trust me I have tried searching fo an answer but I can't find one

 

I have a Python script that is using a SQLite database - all works fine when running on my local web server but try as I might, it won' work on my Hellios account, I have done some basic de bugging and found that the problem starts with the import sqlite3 statement. I have even gone back to basics with a noddy page which works when I # out the import sattment

 

I recon I am missing something pretty silly here, but can anyone help

 

Thanks in advance

 

My domain is zpic

 

And one of my test pages is

 

http://zpic.heliohost.org/cgi-bin/filmsw.py

Link to comment
Share on other sites

Here is the email I sent you yesterday:

 


[zpic_941] Hi
[zpic_941] Me again
[zpic_941] I have been having errors
[zpic_941] And I think I have tracked it to
[zpic_941] import sqlite3
[zpic_941] For some reason it does not seem to like this in my Python script when uploaded
[zpic_941] It works fine on local server
[zpic_941] Am I missing something
[zpic_941] TIA
[zpic_169] Hi all, I've been having loads of problems uploading my Python based SQLite site, I think I've traced it down to the import SQLite
[zpic_169] Command
[zpic_169] import sqlite3
[zpic_169] For some reason it does not like it
[zpic_169] Have I done something.wrong
[zpic_169] I've searched for an answer but can't find one
[zpic_420] Hi
[zpic_420] My domain name is zpic
[zpic_420] I am having issues with a script using
[zpic_420] Import sqlite3
[zpic_420] For some reason my scripts are failing when I use this
[zpic_420] In Python
[zpic_420] Can anyone suggest why
[zpic_420] Thanks in advance
[zpic_154] Hi I'm using Stevie and my domain name is zpic
[zpic_154] I am having trouble uploading my first Python script
[zpic_154] Using SQLite
[zpic_154] import sqlite3
[zpic_154] I have posted several times here but my sessions keep timing out
[zpic_154] And thanks to BT Internet and issues with email
[zpic_154] I can't sign up to the forum
[zpic_154] Please help

It looks like some of our versions of python have sqlite3 and some don't.

/usr/bin/python = 2.4.3 = no sqlite3
/usr/local/bin/python = 2.4.6 = no sqlite3
/usr/local/bin/python2.7 = 2.7.1 = does have sqlite3
/usr/local/bin/python3.2 = 3.2rc3 = does have sqlite3

So it looks like the older versions don't have sqlite3, but the newer versions do. I'm guessing the older python versions on have like sqlite or sqlite2 maybe. Is there any particular reason why you need to use the older versions?

The forum accounts are separate from the hosting accounts. A lot of people think they can use the same login for both, but you have to actually create a forum account before you can post. You can also get support by emailing support@heliohost.org if that's easier for you.

Link to comment
Share on other sites

Thanks for getting back to me, I realise the older versions don't have SQLite as I had to upgrade my version of Python to get it to work , the key thing here is I missed the signicance of the shebang line which seems to select the version of Python

 

School boy error on my part not question what code does when I copy paste

 

I will give that a go altering that

 

Many thanks

 

Just tried 2.7 and it's working like a dream can thank you enough !

 

Need to swot up on this now

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...