Jump to content

how to create new EN notes in production account when running python3 code?


Recommended Posts

I am stuck trying to fix a code problem to write new EN notes to my own paid EN 'production' account, the notes being created while running a .py file on my PC.  The .py program extracts data from various sources including Excel, 'does processing', creates python dataframe objects and creates a new EN  note - this works when writing to my EN sandbox environment, BUT  I want to write to my EN production account .  It is possible I am missing some key step in my logic, hopefully someone here can assist, as I am failing to solve any other way though I don't see too much python related support Q&A.    The detail:  I have a set of 4 EN dev API values - dev token, consumer key, consumer secret and expiry date, obtained from EN about 6 months ago. I can run my python code on my PC, utilising only the dev token to create new notes when referring to the sandbox as True.  Important code line is;  EvernoteClient(token=en_token, sandbox=sbox, china=False) .   I have tried various combinations of dev token, consumer secret, consumer key with sandbox=False, in order to write to my production EN - but lots of different errors depending on the different code being used.   Common error is 'make sure API codes not expired' (they are not, else I would not be able to write to sandbox) - but in any case I asked EN last week for new EN API codes.  To my surprise I only received 2 values (not 4 as before) - consumer key and consumer secret - but using them makes no difference, still nothing works when trying to write to production.  Various sources say use oauthlib needed, but I don't believe this is the case as I only want myself to write to my own EN.   THE usual suggestion made is to use code:   EvernoteClient( consumer_key=consumer_key,  consumer_secret=consumer_secret,   sandbox=False), which seems logical, but this does not work for either True or False.   EN support says make sure you have latest EN - I prefer to use EN legacy as v10 function is nowhere near what I use in legacy, but I do have the web v10 for testing, but my code does not complete so I do not think this is relevant at this point, and as a lot of this 'Client' code predates v10.  I have also referred to the Git link and used the pip install as specified, though python2 seems to be mentioned more often than python3.  My question: Can anyone advise what EN API values they have used to feed into a .py file, and what python packages were used, and what versions EN used/necessary.   Hopefully this wordy text also provides the key information to allow someone to offer guidance for the right direction .  Hopefully I just missing something basic?  

Link to comment
  • Level 5

Contact support - I don‘t think this sort of questions will be answered in a user forum. I know that EN links this forum for devs, but I doubt it’s the right place.

Hint: Support is sort of inundated - reaction time will likely be several days.

Link to comment
2 hours ago, agsteele said:

Indeed, what are you trying to say?

The initial post is a stream of text with no structure… how can any one be expected to take this seriously if the OP can not take 3 minutes to add some structure..

Link to comment

Thankyou everyone who took the trouble to respond.  The replies are useful, I understand more about my unintentional misuse of the forum. 

  1. To PinkElephant: yup I actually tried Evernote Dev Support first and they responded with 'we cant help you try the user forums and or StackOverflow'.  I usually prefer to try and work stuff out myself but I been going around in circles on this for a while so thought I should try to find expertise on this forum.  Your point noted for future, thanks.
  2. To Mike P: your approach seems to reinforce that the direct approach I am after is not possible, I will look if practical for me to use R.  In the past, I had created output files, and  launched batch files with these files and Evernote.exe, it works, but had hoped I could use something more 'modern' and direct ahead of any potential retirement by Evernote company of legacy utilities. 
  3. To Grant837: I thought I had provided structure and had spend many minutes trying to balance my question with some background on what I had tried, but I clearly failed in this attempt.  Bullet points etc could have helped, but as PinkElephant suggests  maybe this is not the forum.  Maybe I should have just asked "Hey everyone, has anyone been able to write code in python3 to directly create new notes in Evernote production?" which is really all I am trying to find out.   There seems lots of conflicting information on this - eg packages that work only on python2, uncertainty on what works on Evernote legacy vs v10, retiring sandbox etc.  If you think there is still value in me rewriting my original post in this forum with more structure I will do this, though it does seem the wrong forum?
  4. agsteele: thanks for getting clarity.

If these comments should be provided as individual replies let me know. I am writing this way to provide all comments in one place. Makes sense to me, due to cross references, but maybe that does not suit the forum.

Link to comment
11 minutes ago, A-longtime-simple-user said:

To Mike P: your approach seems to reinforce that the direct approach I am after is not possible, I will look if practical for me to use R.

I've never tried the "direct approach", I just developed a way, that works for me, of getting reports I produce in html (using R) into EN. You don't need to use R. I'm sure you could create a html file (or a pdf file) from your content using Python. In fact you say:

On 10/23/2023 at 6:44 AM, A-longtime-simple-user said:

The .py program extracts data from various sources including Excel, 'does processing', creates python dataframe objects and creates a new EN  note

If this "new EN note" is an enex file you can add it directly to the import folder, although this may not behave as you expect. You will get a new note with the enex file attached. Double clicking the enex file basically imports the enex file to make another new note.

A better approach might be to save the enex file and simply run it using EN, in which case it gets imported. At least double clicking an enex file in Windows imports it so I'm sure you could script that in Python.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...