Open alexjj opened 10 years ago
I wonder the same for Mac OS X.
Just buy the real app on OS X @mrjcleaver :stuck_out_tongue:
I know you said you wanted something open at the front end.
I already did, of course!
But I want to be able to extend the front end to add custom actions... and the Bloom team said they'd put it on their backlog.
M.
On Wed, Feb 4, 2015 at 1:40 PM, Alex Johnstone notifications@github.com wrote:
Just buy the real app on OS X @mrjcleaver https://github.com/mrjcleaver [image: :stuck_out_tongue:]
— Reply to this email directly or view it on GitHub https://github.com/nitinthewiz/pyDayOne/issues/7#issuecomment-72912220.
What kind of custom actions are we talking about?
I tried to run the script with ubuntu 14.04 but it fails with the following error code:
$ python pyDayOne.py
73C4F61641034ABA8948B69F21DCB822.doentry
Traceback (most recent call last):
File "pyDayOne.py", line 283, in <module>
pyDayOneGTK()
File "pyDayOne.py", line 181, in __init__
tree = ET.parse(self.directory+file)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
tree.parse(source, parser)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 647, in parse
source = open(source, "rb")
IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/home/tristank/journal/tristank.dayone/entries73C4F61641034ABA8948B69F21DCB822.doentry'
@tristan-k clearly, the problem is that the file location is supposed to be "/home/tristank/journal/tristank.dayone/entries/73C4F61641034ABA8948B69F21DCB822.doentry" but is taken to be "/home/tristank/journal/tristank.dayone/entries73C4F61641034ABA8948B69F21DCB822.doentry".
I think this is because on Mac, where I tested this last, the self.directory variable includes a trailing / but in linux it probably does not.
So, here's the solution. Change the following line (line 181) - tree = ET.parse(self.directory+file) to - tree = ET.parse(self.directory+'/'+file)
Do tell if this works. Also, there is a cleaner way to do this, but I'm not going to pursue it at the moment.
Thanks. After I did your recommended canges, I could read the entries, but there was still the window saying that the folder was not found. I had to close it with the "X".
New entries are not saved inside the "entries" folder as supposed to, they are instead stored one folder up inside the journal.dayone folder.
Also the path is not saved, is there a way to write that into the file, so I dont have to search for the path everytime?
Ah yes, my mistake there. My lack of testing on Linux has led to this. What you can do here is as follows -
Mind you, this is totally customized for your system and will obviously not work on any other system. This is because we're hard-coding the directory.
Pinging @mrjcleaver to ask him about updates on OS X and clarification on his point about custom actions.
Hi @nitinthewiz - I haven't started using pyDayOne yet!
By custom actions, I mean, I want the ability to change the UI. E.g. to say "send to application X" where that might create a copy of the content in X, and alter the entry in DayOne to include a reference to the copy in that other app.
I changed the lines 157-172:
else:
# message = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
# message.set_markup("Day One entries folder not found. Please select the entries directory of Day One. It should be under Dropbox->Apps->Day One->Journal.dayone->entries")
# message.run()
# dialog = gtk.FileChooserDialog("Choose entries directory:",action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
# response = dialog.run()
# if response == gtk.RESPONSE_OK:
#print dialog.get_current_folder(), 'selected'
# self.directory = dialog.get_current_folder()
# elif response == gtk.RESPONSE_CANCEL:
#print 'Closed, no files selected'
# message = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
# message.set_markup("No folder was selected. I can't work like this!")
# response = message.run()
# message.destroy()
# gtk.main_quit()
# dialog.destroy()
dir = ET.Element('directory')
dir.text = self.directory
ET.ElementTree(dir).write(savefile)
But now Im getting an error:
$ python ~/Downloads/pyDayOne.py
File "/home/tristank/Downloads/pyDayOne.py", line 173
dir = ET.Element('directory')
^
What changes in this code would need to be made to get it to run in Linux?
I started to look myself and changed a few things but haven't had much luck. It tends to get hung up on not being able to find the journal entries even when I point it in the correct location.
I'm guessing it's something to do with path names and \ vs /.