Re: Python script to extract Investment Transactions to CSV - Initial release v1b [Investments #5490]
From: sprimost --just a fellow user.
Hmm. This script does not seem to be working for me. See errorlog from MoneyBot below.
Using MD 2019.3 on LINUX Manjaro. By default, using LibreOffice Calc.
Any ideas, or should I look into modifying the script (I have a "basic"
working knowledge of Python having done a script similar to this. Maybe
this script will give me an idea how to fix some of the issues on am
having with the output.
/sprimost
Beginning file
/home/sprimost/Finance/Installed/extract_investment_transactions_csv.py at Sun Dec 20 13:32:20 EST 2020 StuWareSoftSystems... extract_investment_transactions_csv.py: Python Script
Initialising.......Version:1d
User Parameters...
Hiding Hidden Securities...
Hiding Inactive Accounts...
Hiding Hidden Accounts...
Selecting ALL Currencies...
Selecting ALL Securities...
Selecting ALL Accounts...
Including Opening Balances...
Script will adjust for Stock Splits...
user date format....: %Y/%m/%d
Non-ASCII characters will not be stripped from file: Using Delimiter: ,
WARNING: file exists,but assuming user said OK to overwrite..
Will extract investment transactions to file:
/home/sprimost/Downloads/extract_investment_transactions.csv ... Investment Transaction Records selected: 2101
Error running script: Traceback (most recent call last):
File "/home/sprimost/Finance/Installed/extract_investment_transactions_csv.py", line 1337, in ExportDataToFile() File "/home/sprimost/Finance/Installed/extract_investment_transactions_csv.py", line 1274, in ExportDataToFile writer = csv.writer(csvfile, dialect='excel', quoting=csv.QUOTE_MINIMAL, delimiter=csvDelimiter) File "/home/sprimost/Finance/Installed/extract_investment_transactions_csv.py", line 1274, in ExportDataToFile writer = csv.writer(csvfile, dialect='excel', quoting=csv.QUOTE_MINIMAL, delimiter=csvDelimiter) TypeError: "delimiter" must be an 1-character string
Traceback (most recent call last):
File "/home/sprimost/Finance/Installed/extract_investment_transactions_csv.py", line 1337, in ExportDataToFile() File "/home/sprimost/Finance/Installed/extract_investment_transactions_csv.py", line 1274, in ExportDataToFile writer = csv.writer(csvfile, dialect='excel', quoting=csv.QUOTE_MINIMAL, delimiter=csvDelimiter) File "/home/sprimost/Finance/Installed/extract_investment_transactions_csv.py", line 1274, in ExportDataToFile writer = csv.writer(csvfile, dialect='excel', quoting=csv.QUOTE_MINIMAL, delimiter=csvDelimiter) TypeError: "delimiter" must be an 1-character string
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Stuart Beesley ... on 20 Dec, 2020 10:37 PM
Hmm. That’s a very strange error?! Please can you download the latest version and try again... from here:
https://yogi1967.github.io/MoneydancePythonScripts/
Please let me know and I’ll debug if still a problem. If you get the same error, we need to print csvDelimiter prior to the error line to see why it’s gone wrong...
Separately, happy to help you on your own script issues is you email me?
2 Posted by Stuart Beesley ... on 20 Dec, 2020 11:16 PM
In addition, run my other extract scripts (from same download link) and see if same error occurs in the same place too?
3 Posted by sprimost on 21 Dec, 2020 01:37 AM
From: sprimost -- just a fellow user
The newest script is, I think, assuming MD 2020 or better, while I am
running 2019.3. Running the "py" (not the extension, since that does not
run at all) of the one you sent, it is looking for Txn...Sort routine. I
have the traceback so I can take a look at it tomorrow, unless you have
some suggestions, or want me to run some debug code.
I can take the other issue, and show you my code, if we can arrange
something off-line....ping me at sprimost at twc.com. I would rather
post "good" code here.
/sprimost
4 Posted by Stuart Beesley ... on 21 Dec, 2020 03:41 PM
Well that was a set of interesting problems.
1/ The script doesn't use TxnSortOrder and I had it as part of my common code set.. So I have now fixed this in all my scripts.
2/ 2019.3 uses Jython 2.7.1 and 2019.4 onwards uses 2.7.2 (I only tested back to 2019.4). It seems that the earlier Jython doesn't cope properly with unicode, whereas 2.7.2 does... Hence a crash. So I have fixed this (hopefully).
3/ Whilst my. extension and script versions are identical - The Python extension(s) will not work before version 2021 build 2012. Nothing can be done about this; this was when the MD functionality was implemented.
4/ Is there a reason you are using 2019.3? If not, I would suggest that you upgrade to at least the latest 2019 version.... Or later if you can... I see no real issues (other than perhaps online banking).....
So, all scripts updated and uploaded to:
https://yogi1967.github.io/MoneydancePythonScripts/
Investment script attached here too:
I've sent you an email, can you reply to that..?
5 Posted by sprimost on 21 Dec, 2020 05:44 PM
From: sprimmost -- Just a user
Works like a charm now. I am only interested in the jython script for a
number of operational reasons; this solved part of what I want.
I will respond....got it.
/sprimost
Melissa closed this discussion on 28 Jan, 2021 09:49 PM.