Python module problem

So I load the module

import MySQLdb

Right? Done.

When I load my Blender file and run it for the first time the module works fine. Then when I run it again, it says it cant find the module. It doesnt work again until I close and restart Blender. Any ideas or am I just a dummy? Im thinking a path problem.

Did you close the database connection?

Yes. But Im not even connecting because I havent had a chance to play with it yet. It does it even if i all do is import. No other commands. Just import. It will import it the first time, and then every time (unless I restart Blender) it wont.

Are you showing any kind of error message? Also, it might be a good idea to see if it even works the first time, or experiment with it in python without blender to make sure everything is working properly. I don’t think it would be the path because that shouldn’t change. Sometimes if a file is in use, it can’t be reopened, so maybe there is some reason it isn’t letting go of it like an error. Odd problem.

The only error message is that the module “MySQLdb” cannot be found. I can import and connect with MySQLdb in the Python console as many times as I want, and yes the first time I run my Blender program the module imports and attempts a connection. The only other error message I get it that it cant connect to my MySQL server and I think thats something else entirely. At least I know that the module is working, it just only works once. :-?

Thanks for your help fireside! :smiley:

The only other error message I get it that it cant connect to my MySQL server and I think thats something else entirely

I think I’d work on that if it was me. It might not be related, but it’s possible that it is. Anyway, your going to have to get it to connect. It could be you don’t have a path to the server.

By the way, have you ever checked out sqlite? That is the most amazing program to me. It doesn’t need a server and it’s tiny.

Yeah I played with SQLite and it is very interesting. Simple and powerful. It came with my XAMPP dist. But my server is already on and its a remote server. Could that have anything to do with it? (Now this is becoming a MySQL question). I will look into it. Thanks again for your help Fireside! :smiley:

No problem. Wish I could have been more help. Good luck with it.