#πŸ”’ Im creating my own Database module in python but when i read a file it comes back as None

22 messages Β· Page 1 of 1 (latest)

peak wyvern
#

Hello im creating a easy to use Local host database where the database builds itself on your pc so it can be accessed with or without internet and in the reading side of it i send through the varibles to the Module code from my test code but after reading it im not sure how to send the contence back to the reader. Any ideas?

pallid badgerBOT
#

@peak wyvern

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

peak wyvern
#

This is the read module

#

This is the test code

dreamy crane
#

whats the output

peak wyvern
dreamy crane
#

well of course

#

you're not returning anything

#

from your read function

#

so it'll return None

peak wyvern
#

How can i update the variable "Content" to send back over to the user?

dreamy crane
#

so you want the variable Test to have the values of Content?

peak wyvern
#

Ye so what it is is you send over the key which is connected to a file and when you send that DB.Read(Key = "testKey"), the Module looks for that key in its data folder and reads what is connected in that key (Which should output as "Test") but im not sure how to send what the Content of that key is back to the test.py

dreamy crane
#

in your read function change the last line from return to return Content

peak wyvern
#

Damm that worked Thank you so much man ive been trying to work that out for a while and all it was was that 1 word lol I apprecite it

dreamy crane
#

πŸ‘

#

you can close the thread if you dont have anymore questions

#

!close

peak wyvern
#

Cheers

#

!close

pallid badgerBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.