Glad you got it working, and thanks for sharing! Peter
> -----Original Message----- > From: [email protected] [mailto:mnemosyne- > [email protected]] On Behalf Of Benjamin Frazier > Sent: 18 November 2014 16:40 > To: [email protected] > Subject: Re: [mnemosyne-proj-users] Automate inserting cards in the > Mnemosyne database > > Peter, > > I got it working on my mac by using virtual box . I downloaded an ubuntu > 14.04 LTS iso file from ubuntu > <http://www.ubuntu.com/download/desktop> and created a ubuntu > virtual box virtual machine. I followed the instructions for building > mnemosyne using the following link: hacking-mnemosyne > <http://mnemosyne-proj.org/hacking-mnemosyne> . I thought I would go > ahead and post the procedure I used to help anyone else out that may have > the same problem I did. > > 1. I installed the following packages on the ubuntu virtual box image using > the following command from the terminal: > > sudo apt-get install python-cherrypy3 python-apsw python-virtualenv > mnemosyne python-qt4-dev pyqt4-dev-tools qt4-designer python-qt4-sql > libqt4-sql-sqlite python-matplotlib python-qt4-phonon python-sphinx > python-webob -y > > > 2. I checked out the mnemosyne-proj project using the following commands > in the terminal: > > > a. mkdir ~/bz > b. cd ~/bz > c. bzr branch lp:mnemosyne-proj > > > 3. I then built the mnemosyne-pro project using the following commands in > the terminal: > > > a. cd ~/bz/mnemosyne-pro/mnemosyne > b. sudo make setup > c. sudo make > > > 4. After building the project I could go use the add_card.py python script to > automate inserting cards into the mnemosyne database using the following > commands in the terminal: > > a. cd ~/bz/mnemosyne-pro/mnemosyne/mnemosyne/example_scripts/ > b. python add_cards.py > > The script uses the whatever is current the default mnemosyne database. > On Linux machines, this is usually located at > ~/.local/share/mnemosyne/default.db. Once you run the script you will get > no feed back in the terminal about whether your cards were added or not. > You will just have to open mnemosyne to see if there is a card titled, "front" > and a card titled, "back" that was inserted into your database. > > You can then use a python "for statement" in front of the fact_data = {"f": > "front", "b": "back"} that is in the add_cards.py script to automate the > process of inserting cards into your mnemosyne database. For example, I > created a file (in the same directory as the add_cards.py script) that > contained a bunch of data. I then used python to open the file, read the > lines in the file, and automatically insert the data into the mnemosyne > database programmatically. You can then sync mnemosyne with other > clients, it works great... > > > Thanks, > > > On Monday, November 17, 2014 3:41:44 AM UTC-5, Peter Bienstman wrote: > > Hi, > > On Windows and Mac, the installer is a self-contained copy of Python > and Mnemosyne which contains everything you need to run it. > > In order to get access to the scripting capabilities on that platform, > you need to install the linux tarball in such a way that the libraries are > installed in your system's Python installation. You also need to take care of > all > the dependencies. > > Since I don't have access to a Mac, I cannot give concrete > instructions, but hopefully this is enough to get you started. > > Cheers, > > Peter > > > -----Original Message----- > > From: [email protected] <javascript:> > [mailto:mnemosyne- <javascript:> > > [email protected] <javascript:> ] On Behalf Of Benjamin > Frazier > > Sent: 16 November 2014 21:57 > > To: [email protected] <javascript:> > > Subject: [mnemosyne-proj-users] Automate inserting cards in the > > Mnemosyne database > > > > I would really like to automate the process of inserting cards into > the > > Mnemosyne database on my Mac. I found the following code from > the > > example_scripts folder after downloading Mnemosyne for Linux: > > > > ---- code --- > > from mnemosyne.script import Mnemosyne > > > > # 'data_dir = None' will use the default system location, edit as > appropriate. > > data_dir = None > > mnemosyne = Mnemosyne(data_dir) > > > > for format in > self.mnemosyne.component_manager.all("file_format"): > > if format.__class__.__name__ == "Mnemosyne2Cards": > > format.do_import(filename) > > > > mnemosyne.finalise() > > --- end code --- > > > > What I would like to know is how I could use this python script to > > automatically insert cards in my Mnemosyne database with an > answer and > > question (I really just need one example). I realize that I could > just > use > > python add_card.py to add run the python script but I get the > following error > > when I do this: > > > > --- error ------- > > Traceback (most recent call last): > > File "add_card_copy.py", line 5, in <module> > > from mnemosyne.script import Mnemosyne > > ImportError: No module named mnemosyne.script ---end error ---- > > > > My question is, How can I add the mnemosyne.script file in the > same folder > > that I have the add_cards.py file in order to automatically insert > cards into my > > Mnemosyne database? > > > > Thanks, > > > > -- > > You received this message because you are subscribed to the > Google Groups > > "mnemosyne-proj-users" group. > > To unsubscribe from this group and stop receiving emails from it, > send an > > email to [email protected] > <javascript:> . > > To post to this group, send email to mnemosyne-proj- > > [email protected] <javascript:> . > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/mnemosyne-proj- > users/7067e59b- <https://groups.google.com/d/msgid/mnemosyne-proj- > users/7067e59b-> > > c39d-47e0-99b4-87eb3545a6ab%40googlegroups.com > <http://40googlegroups.com> . > > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout> . > > > > -- > You received this message because you are subscribed to the Google Groups > "mnemosyne-proj-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to mnemosyne-proj- > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mnemosyne-proj-users/eb0091de- > f534-4410-987f-dfb4908e7c52%40googlegroups.com > <https://groups.google.com/d/msgid/mnemosyne-proj-users/eb0091de- > f534-4410-987f- > dfb4908e7c52%40googlegroups.com?utm_medium=email&utm_source=foo > ter> . > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "mnemosyne-proj-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mnemosyne-proj-users/006f01d003d0%2455766dd0%2400634970%24%40UGent.be. For more options, visit https://groups.google.com/d/optout.
