dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.1.0
FIQ has quit [Write error: Connection reset by peer]
Dwarf has quit [Read error: Connection reset by peer]
Zackio has quit [Read error: Connection reset by peer]
RedDwarf has joined #cinch
Guest56347 has joined #cinch
Dwarf has joined #cinch
lagweezle has joined #cinch
lagweezle has joined #cinch
lagweezle has quit [Changing host]
postmodern has joined #cinch
RedDwarf is now known as Zackio
postmodern has quit [Quit: Leaving]
frdmn has quit [Quit: ssssSSSSssss]
frdmn has joined #cinch
sarkyniin has joined #cinch
sarkyniin has quit [Ping timeout: 250 seconds]
sarkyniin has joined #cinch
Lirion has quit [*.net *.split]
kimoto_________ has quit [*.net *.split]
kimoto_________ has joined #cinch
Lirion has joined #cinch
TieSoul-AWAAAY is now known as TieSoul
apt-get_ has joined #cinch
sarkyniin has quit [Ping timeout: 245 seconds]
Guest56347 has quit [Changing host]
Guest56347 has joined #cinch
Guest56347 is now known as FIQ
postmodern has joined #cinch
<apt-get_> hey, I'm trying to interact with a database
<apt-get_> however, I'm getting this error
<apt-get_> /home/apt-get/ASBot/plugins/asblearn.rb:9:in `initialize': unable to open database file (SQLite3::CantOpenException)
<apt-get_> any reason why this is happening?
<onewheelskyward> It's probably a relative pathing or permissions problem.
<onewheelskyward> Or you haven't initialized that db file yet.
<apt-get_> nah it's there
<apt-get_> my permissions are correct, too :/
<onewheelskyward> hmm
<onewheelskyward> you're running the script as the user that owns the db file?
<apt-get_> ye
<apt-get_> actually, I think it might be relative pathing-related
<apt-get_> running the file in the same directory works
<onewheelskyward> yeah, that stuff can get weird.
<onewheelskyward> If you can, specify the full file path.
<apt-get_> meh
<apt-get_> I run it from heroku
<onewheelskyward> Ah.
<apt-get_> yeah, it's getting annoying
<apt-get_> onewheelskyward: doesn't work with the full path either :s
<apt-get_> @db = SQLite3::Database.new File.expand_path("../utils/pokedex.sqlite")
<apt-get_> same error
<leftylink> the reason I'm not surprised by that is that that still expands relative to CWD, whatever that may be. therefore I would attempt to make it relative to the file, not relative to CWD
<apt-get_> leftylink: cwd...?
<apt-get_> oh, current working directory
<apt-get_> so like
<apt-get_> move into the directory with the db?
<apt-get_> tbh the dirty method to do this
<apt-get_> would be to put a global variable containing the db
<apt-get_> in utils.rb in the utils folder
<apt-get_> but I'd rather not do that
<onewheelskyward> nah you need to figure out there Database.open's cwd is.
<onewheelskyward> s/there/where/
<apt-get_> the Database.open's directory
<apt-get_> is in the plugins folder
<apt-get_> at the root of my project
<apt-get_> I mean database.open's file
<onewheelskyward> Does it work locally ok?
<apt-get_> in the same folder as the database?
<apt-get_> yeah it works
apt-get_ has quit [Ping timeout: 245 seconds]
apt-get_ has joined #cinch
<apt-get_> is it safe to move into another directory
<apt-get_> while using cinch?
<apt-get_> in a plugin I mean
<apt-get_> or will that cause problems
<dominikh> Cinch doesn't care what the current working directory is
<dominikh> your code is probably funky if you need to change it, but Cinch won't care
<apt-get_> dominikh: it's more of sqlite being funky
<apt-get_> than my code
<dominikh> I don't see how sqlite is involved in this. File.expand_path is a) relative to cwd b) unnecessary – and relative paths are usually relative to the current working directory
<dominikh> that's why either you either have a configuration option with an absolute path to the db, or a wrapper that cd's, then starts the bot
<apt-get_> wait
<apt-get_> oh, dominikh
<apt-get_> I just got where the error is coming from
<apt-get_> the initialize method of a plugin is ran by the directory the main bot file is in
<apt-get_> not in the plugin's directory
<apt-get_> yeah that fixes the whole issue
<dominikh> it's run in the directory in which you were when you ran `ruby my_bot.rb`
<dominikh> if you are in / and do `ruby /foo/bar.rb`, then cwd will be /
<apt-get_> yeah
<apt-get_> then that was me being dumb
apt-get_ has quit [Quit: Quitte]