In-Development TradeDangerous: power-user trade optimizer

wolverine2710

Tutorial & Guide Writer
Unless I'm missing something, you kind of will: It's a stream of updates.

When EDDN will be ready for production, its in Alpha now - and uses the same structure for JSON as the original EMDN - commanders will have the choice between maddavo's merge website and EDDN. In the past you had emdn-tap.py which supported EMDN. Are you planning to revive that and create an EDDN-tap.py for use with TD?

Wrt to maddavo's remark, yes I think he still has to check system names for validity - as in are they in TGC/TOR. Otherwise the merged .prices file can contain unwanted system names.
 

wolverine2710

Tutorial & Guide Writer
Now that EDDN is in Alpha we need to get that little snowball rolling. Are there perhaps commanders willing to create a TD_EDDN_exporter for EDDN. The details of the http POST and the current JSON format can be found here. The more data there is the greater the change EDDN will blossom ;-) Feel free to PM me or post in the EDDN thread. Looking forward to it.

Note: The authors of the other trading tools have said they are "in". I'm also writing them in the hope to get more and more data into EDDN. After that it is a matter of them implementing support EDDN - as in store received data in their tools.
 
Last edited:
I got exactly the same error when using that command, but when I download the System/Station/Prices file with Firefox and place them in the data folder of TD and run

Code:
trade.py buildcache -f

everything runs perfectly with no warnings or errors.


i tried what you did and i still get a error

Code:
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:133
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Apalai', 'Gubarev Base', '0']
 
all the other solutions you guys gave me did not work

I even tried to delete the repository + bookmark option in source tree + delete the folder and click "clone" on the website got the errors then i tried it again downloading all 3 files from Maddavos files and placed in the data directory, still did not work, and tried your solutions, still did not work.

so in the end i had to delete all the following stations from the station file

Code:
NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:133
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Apalai', 'Gubarev Base', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:140
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Arin', 'Kettle Landing', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:352
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['DX Cancri', 'Horowitz Landing', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:352
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Dyaushis', 'Helmholtz Station', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:375
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Feng Huang', 'Murdoch Plant', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:578
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Kassi Hua', 'Clauss Platform', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:578
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Katae', 'Coulomb Survey', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:583
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Keling', 'Lopez De Villalobos', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:600
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Kuikian Batji', 'ALI INSTALLATION', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:925
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Maitaokona', 'Gresley Gateway', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:933
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Markanomovoy', 'Compton Dock', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:988
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Nener', 'Popov Dock', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:1022
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Nuwang', 'Schade Outpost', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:1129
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['Shama', 'Clairaut Port', '0']


NOTE: Rebuilding cache file: this may take a moment
*** INTERNAL ERROR: NOT NULL constraint failed: Station.system_id
CSV File: tradedangerous\data\Station.csv:1329
SQL Query: INSERT INTO Station (system_id,name,ls_from_star) VALUES((SELECT System.system_id FROM System WHERE System.name = ?),?,?)
Params: ['WX Ursa Majoris', 'Teng-Hui Terminal', '0']



i had to delete all of them and then got errors so i had to move the stations and system file to my desktop and then hit "pull" on source tree and then i had to DELETE the station and system file in the folder completely AND THEN i moved the station and system file over from my desktop to the data folder then i get no more errors

seems the station file on both servers has stations that dont have systems for them in the systems file from the servers yes the updated 1's
 
Last edited:
i had to delete all of them and then got errors so i had to move the stations and system file to my desktop and then hit "pull" on source tree and then i had to DELETE the station and system file in the folder completely AND THEN i moved the station and system file over from my desktop to the data folder then i get no more errors

seems the station file on both servers has stations that dont have systems for them in the systems file from the servers yes the updated 1's

I had found that earlier and sent a PM to Maddavo about the first few of those stations. I went back to an earlier version of the Station.csv file i had and it works perfectly.

Not sure why there are stations now with no System in the System.csv file, but i'll leave that to Maddavo to fix :)
 
Hello, and thanks for sharing this tool!

I haven't read all the replies in this thread very extensively, but people seem to have various problems?
I went a little bit with my gut, got the 3 files from maddavo and just replaced the original ones and it worked.

Now I just update data for stations as I travel around the galaxy. It's kind of tedious, but I guess it's worth it!

I was wondering however, why would someone re-download Maddavo's files? I would maybe get newer versions, but wouldn't I risk to lose all the data I have filled in manually in the meantime?
Please explain it to me cause it seems I am missing something.

On a side note, I was filling in data for 72 Herculis/ Ring, and it seems that the Buy/Sell price difference for Algae was too large, so TD asked me to report it here with a screenshot.
So here you are:
72Herculis_WangRing_AlgaePrice.jpg

cheers!
 
I was wondering however, why would someone re-download Maddavo's files? I would maybe get newer versions, but wouldn't I risk to lose all the data I have filled in manually in the meantime?
Please explain it to me cause it seems I am missing something.

You can upload you updated .prices to maddavos website and your updates will get included in the downloadable file.
 
I was wondering however, why would someone re-download Maddavo's files? I would maybe get newer versions, but wouldn't I risk to lose all the data I have filled in manually in the meantime?

Please explain it to me cause it seems I am missing something.

Simply because these files are updated all the time. Basically I updated a lot of systems the last two days.
So once a day it's useful to download all three files again to be up to date.

Also do not forget to upload your prices files too. Best is for every station you updated ("updated.prices"), or data\TradeDangerous.prices if only once in a while.
Of course you first need to upload your prices files completely before downloading the new one or your changes will be overwritten!
On a side note, I was filling in data for 72 Herculis/ Ring, and it seems that the Buy/Sell price difference for Algae was too large, so TD asked me to report it here with a screenshot.
I had several of these with small prices especially. Seems TD still needs some fine tuning in this area.
 
I was filling in data for 72 Herculis/ Ring, and it seems that the Buy/Sell price difference for Algae was too large, so TD asked me to report it here with a screenshot.

just ignore that warning and press ok the prices you typed in are saved once u press the X
 
I just rt-click "save as.." all 3 files and dump them in my local "data" folder before each elite session. Not exactly elegant, but its early days I guess. When the trade data is up to date this tool is peerless.

You can do it all with one command now:

Code:
$ trade.py update --plug=maddavo --opt=syscsv --opt=stncsv
 
Hello, and thanks for sharing this tool!

I haven't read all the replies in this thread very extensively, but people seem to have various problems?
I went a little bit with my gut, got the 3 files from maddavo and just replaced the original ones and it worked.

Now I just update data for stations as I travel around the galaxy. It's kind of tedious, but I guess it's worth it!

I was wondering however, why would someone re-download Maddavo's files? I would maybe get newer versions, but wouldn't I risk to lose all the data I have filled in manually in the meantime?
Please explain it to me cause it seems I am missing something.

On a side note, I was filling in data for 72 Herculis/ Ring, and it seems that the Buy/Sell price difference for Algae was too large, so TD asked me to report it here with a screenshot.
So here you are:

cheers!

Hi Arc - thank you for posting the screenshot. I'll relax the rules. In the meantime, you can still enter your data. The warning dialog is just to help us get a feel for where to set the threshold. I want warning when I type total crap into the window, if possible, because I do it a lot :)


I was wondering however, why would someone re-download Maddavo's files? I would maybe get newer versions, but wouldn't I risk to lose all the data I have filled in manually in the meantime?

His site has an "upload" option.

Option 1: Upload your "data/TradeDangerous.prices" file and Maddavo's site will pick out the ones that are new and ignore the ones he has more recent data.

Then if you wait a minute and download again, you'll get the best of both worlds.


Option 2: When you "update" a station, TD generates a file, "updated.prices" with those changes. I always upload my "updated.prices" file - I want to add an option at making it upload automatically, but I kinda suck at web stuff, lol. I should probably bat my eyelids at Dave and plead for a different interface, probably json or something.

- - - - - Additional Content Posted / Auto Merge - - - - -

Latest Code:
- Building the cache is smegging fast again,
- "nav" shows you the station count for the system when you use "-v" (instead of --stations),
- Relaxed the criteria for the warning dialog when updating prices from 75% to 72%
 
Thanks! I've simply downloaded the tradingdangerous.prices file manually and put it in DATA twice so far?

Looking at the OP it mentions:-
trade.py import -i http://kfs.org/td/prices
or
trade.py import -i --maddavo​

Is that the prefered method?

"kfs.org/td" is where I put short-cuts to things TD related, e.g. "http://kfs.org/td/group" and "http://kfs.org/td/thread". the "prices" one just goes to maddavos site.

Also note: If you have the latest code, you can now do:

Code:
$ trade.py import --plug=maddavo --opt=syscsv --opt=stncsv

which will download the system.csv, station.csv and .prices file.

When you update a station,

Code:
$ trade.py update -GF whiteorbital

when you're done, it puts the changes into a file called "updated.prices" so you can easily upload just your changes back to maddavo's site.

I would suggest only using the "--opt=syscsv" once a day, as the file is quite big (1.5Mb).

- - - - - Additional Content Posted / Auto Merge - - - - -

I've tried using this a couple of times and found the results odd in two ways.
1) At one station it suggested I split my purchases? That surely doesn't make sense? One will give more profit than the other so get 100% of it?
2) Most times I've used it's resulted in no profit and indeed it told me once to buy a product that wasn't even available at a particular station.

Are these problems down to the prices file simply being out of date? Any suggestions on keeping it upto date? - I've re-downloaded it from the website. Is there a method to get better/more accurate prices etc.

Actually, the first one is probably a case of TD being smart :) From one of the early posts:

The problem that TD is trying to solve is officially described as an "NP Problem" [http://en.wikipedia.org/wiki/NP_(complexity)]. Most of the other profit calculators are approximating a result set by using a tweak of the rules.

For example: You have a Lakon Type 9, 228 capacity, 20,000 credits at StationA. The most profitable possible trade is ItemA StationA->StationB for 8000cr each profiting 1100cr/ton. The least profitable trade is ItemZ StationA->StationC for 85cr each profiting 55cr/ton.

Some calculators only bother to check highest profitability. ItemA wins, meaning you can make a maximum of 2200cr.

Others will try and fill up your hold with other trades you can make StationA->StationB, but after buying the gold you only have 4000cr left. The problem with this approach is that the individually most profitable items are usually the most expensive. So they perhaps boost you to 2800cr for a run.

You can comfortably afford a full load of ItemZ. 228 x 55cr profit = 12540kcr profit; that's 10k more than the obvious choices.

And from this post, an example:

Imagine you've got 8 cargo space and 1000 credits. There's an item, X, that costs 250cr that makes 100cr profit each, and an item, Y, that costs 50cr that makes 30 profit each.

A full load of X would make you 800cr but you can only afford 4 which would make you 100cr. You can afford a full load, 8, of Y which would make you 120cr.

Alternative load outs:

Code:
XYYYYYYY : costs 250 + 350 => 600cr, profit = 100 + 210 => 310cr
XXYYYYYY : costs 500 + 300 => 800cr, profit = 200 + 180 => 380cr
XXXYYYYY : costs 750 + 250 => 1000cr, profit = 300 + 150 => 450cr
XXXX---- : costs 1000 + 0 => 1000cr, profit = 400 + 0 => 400cr
YYYYYYYY : costs 0 + 400 => 400cr, profit = 0 + 120 => 120cr

Guess which TD will pick? (And we'll see this in my example run shortly)
 
Let me also add... You don't need to understand Python for this, it's just a "look, it's really there".

Open up the file "tradecalc.py" in sublime or notepad.

Do a search for "def fastFit". That's the function that tries combinations of cargo load between two stations until it finds the most profitable one.

The function is fairly fast, I was still new to Python when I wrote this so it's not as fast as it could be.

But if you scroll up a couple pages, you'll see "def bruteForceFit".

This is the same function without any smarts. It literally takes the list of things you can buy at Station A, and tries every possible combination of those in your cargo hold. It's very slow, but it's definitive.

It's there so that we can test any changes to the fast version and make sure that it's fast but also correct :)
 
On my ubuntu I installed python 3.4.2, downloaded latest TD, latest maddavo csv / prices files and then ran "python3 trade.py --help" and this is the error I get:
Code:
Traceback (most recent call last):
  File "trade.py", line 34, in <module>
    from commands import *
  File "/home/dir/commands/__init__.py", line 2, in <module>
    from commands.commandenv import CommandEnv
  File "/home/dir/commands/commandenv.py", line 4, in <module>
    from tradedb import AmbiguityError, System, Station
  File "/home/dir/tradedb.py", line 25, in <module>
    import cache
  File "/home/dir/cache.py", line 29, in <module>
    import prices
  File "/home/dir/prices.py", line 13, in <module>
    import sqlite3
  File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named '_sqlite3'
Any help would be appreciated.
 
On my ubuntu I installed python 3.4.2, downloaded latest TD, latest maddavo csv / prices files and then ran "python3 trade.py --help" and this is the error I get:
Code:
Traceback (most recent call last):
  File "trade.py", line 34, in <module>
    from commands import *
  File "/home/dir/commands/__init__.py", line 2, in <module>
    from commands.commandenv import CommandEnv
  File "/home/dir/commands/commandenv.py", line 4, in <module>
    from tradedb import AmbiguityError, System, Station
  File "/home/dir/tradedb.py", line 25, in <module>
    import cache
  File "/home/dir/cache.py", line 29, in <module>
    import prices
  File "/home/dir/prices.py", line 13, in <module>
    import sqlite3
  File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named '_sqlite3'
Any help would be appreciated.

That's pretty weird; I used SQLite 3 because it's part of the Python batteries-included. Any chance you had previously uninstalled it or sqlite3 specifically? (I don't have this problem on my Precise vm or my Mint 17 laptop).

Did you have to self-build py3.4.2 or install from binaries? If you self-built, this link might be helpful: http://stackoverflow.com/questions/1210664/no-module-named-sqlite3

In a nutshell,

Code:
sudo yum install libsqlite3-dev

and then rebuild your py3.4.2

-Oliver

- - - - - Additional Content Posted / Auto Merge - - - - -

I've just made a bunch of incremental changes (and fixed one nasty gotcha) to the maddavo plugin; it's now keeping a timestamp (data/maddavo.stamp) so it can tell when you last got data and tell whether there have been any new changes since then.

If you run it with "-v" it'll tell you a bit about what changed since your last pull. If you run it with "-q" it will shut up. I also added "--skipdl" for those times when the DL worked but something went wrong and you don't feel like downloading another 5Mb of data :)
 
On my ubuntu I installed python 3.4.2, downloaded latest TD, latest maddavo csv / prices files and then ran "python3 trade.py --help" and this is the error I get:
Code:
Traceback (most recent call last):
  File "trade.py", line 34, in <module>
    from commands import *
  File "/home/dir/commands/__init__.py", line 2, in <module>
    from commands.commandenv import CommandEnv
  File "/home/dir/commands/commandenv.py", line 4, in <module>
    from tradedb import AmbiguityError, System, Station
  File "/home/dir/tradedb.py", line 25, in <module>
    import cache
  File "/home/dir/cache.py", line 29, in <module>
    import prices
  File "/home/dir/prices.py", line 13, in <module>
    import sqlite3
  File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named '_sqlite3'
Any help would be appreciated.

Some distributions make many packages of python. Maybe you need to install the sqlite3 module separately. Check your python installation.
There is also another way to install python in your home folder. I did it because my Ubuntu python version is tool old for this tool and I have found no backport anywhere. It's called "pyenv".
 
Last edited:
You can do it all with one command now:

Code:
$ trade.py update --plug=maddavo --opt=syscsv --opt=stncsv

Does not work for me:

Code:
kfsone-tradedangerous-840833feda37>trade.py import --p
lug=maddavo --opt=syscsv --opt=stncsv
Connecting to server: http://www.davek.com.au/td/System.csv
data/System.csv: 1.393.426/1.393.426 bytes |  51.48KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/Station.csv
data/Station.csv: 42.684/42.684 bytes |  44.82KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/prices.asp
import.prices: 3.603.796/3.603.796 bytes |  34.33KB/s | 100.00%
Traceback (most recent call last):
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\trade.py",
line 72, in <module>
    main(sys.argv)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\trade.py",
line 47, in main
    results = cmdenv.run(tdb)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\commands\co
mmandenv.py", line 78, in run
    return self._cmd.run(results, self, tdb)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\commands\im
port_cmd.py", line 101, in run
    if not plugin.run():
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\plugins\mad
davo_plug.py", line 51, in run
    pathlib.Path(self.filename),
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 886, in importDataFromFile
    pricesPath=path,
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 572, in processPricesFile
    items, buys, sells = processPrices(tdenv, pricesFile, db, defaultZero)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 293, in processPrices
    systemByName = getSystemByNameIndex(cur)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 264, in getSystemByNameIndex
    """)
sqlite3.OperationalError: no such table: System

I downloaded clean archive and did only call help files before executing above.

Can be workaround by "buildcache" with the prices files and "-i" (One star/station unknown at the moment).
 
Last edited:
Does not work for me:

Code:
kfsone-tradedangerous-840833feda37>trade.py import --p
lug=maddavo --opt=syscsv --opt=stncsv
Connecting to server: http://www.davek.com.au/td/System.csv
data/System.csv: 1.393.426/1.393.426 bytes |  51.48KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/Station.csv
data/Station.csv: 42.684/42.684 bytes |  44.82KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/prices.asp
import.prices: 3.603.796/3.603.796 bytes |  34.33KB/s | 100.00%
Traceback (most recent call last):
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\trade.py",
line 72, in <module>
    main(sys.argv)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\trade.py",
line 47, in main
    results = cmdenv.run(tdb)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\commands\co
mmandenv.py", line 78, in run
    return self._cmd.run(results, self, tdb)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\commands\im
port_cmd.py", line 101, in run
    if not plugin.run():
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\plugins\mad
davo_plug.py", line 51, in run
    pathlib.Path(self.filename),
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 886, in importDataFromFile
    pricesPath=path,
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 572, in processPricesFile
    items, buys, sells = processPrices(tdenv, pricesFile, db, defaultZero)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 293, in processPrices
    systemByName = getSystemByNameIndex(cur)
  File "C:\Users\suamor\Downloads\kfsone-tradedangerous-840833feda37\cache.py",
line 264, in getSystemByNameIndex
    """)
sqlite3.OperationalError: no such table: System

I downloaded clean archive and did only call help files before executing above.

Can be workaround by "buildcache" with the prices files and "-i" (One star/station unknown at the moment).

The latest code also has a fix for it.
 
The latest code also has a fix for it.

Import works now, but the first run command fails (note that there were very many unknown star systems):

Code:
kfsone-tradedangerous-94576a2c9be9>trade.py import --plug=maddavo --opt=syscsv --opt=stncsv
NOTE: Rebuilding cache file: this may take a moment
NOTE: Missing "kfsone-tradedangerous-94576a2c9be9\data\TradeDangerous.prices" file - no price data
Connecting to server: http://www.davek.com.au/td/System.csv
data/System.csv: 1.393.426/1.393.426 bytes |  45.40KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/Station.csv
data/Station.csv: 42.684/42.684 bytes |  20.56KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/prices.asp
import.prices: 3.603.361/3.603.361 bytes |  42.90KB/s | 100.00%
882 stations updated:
SUSAMA/Mullane Beacon, ZETA TRIANGULI AUSTRALIS/Guest City, Hip 74243/Bean City, MURACING/Herzfeld Gateway, LP 69-457/Liska Platform, Hip 21280/Shepard Terminal
, CHECHEHET/Desargues Works, HR 7451/Gillekens Station, La Rochelle/Shaver Dock, Shili/Al-Haytham's Claim, ...
import.prices:1625 Unrecognized STAR/Station, '36 URSAE MAJORIS/ARISTOTLE PLATFORM'.
import.prices:13625 Unrecognized STAR/Station, 'BLATA/GURRAGCHAA HOLDINGS'.
import.prices:13771 Unrecognized STAR/Station, 'BLATA/NOWAK LANDING'.
import.prices:17497 Unrecognized STAR/Station, 'CHECHEHET/DESARGUES WORKS'.
import.prices:21297 Unrecognized STAR/Station, 'CROWFOR/SZEBEHELY PORT'.
import.prices:23663 Unrecognized STAR/Station, 'DJEDET/LINNAEUS HANGER'.
import.prices:23809 Unrecognized STAR/Station, 'DJEDET/THOREAU PLATFORM'.
import.prices:27399 Unrecognized STAR/Station, 'FN VIRGINIS/JACOBI LANDING'.
import.prices:30823 Unrecognized STAR/Station, 'GCRV 13292/WALHEIM DOCK'.
import.prices:33233 Unrecognized STAR/Station, 'HAOKAH/REVIN HORIZONS'.
import.prices:33527 Unrecognized STAR/Station, 'HARED/POISSON SETTLEMENT'.
import.prices:39001 Unrecognized STAR/Station, 'HSIEN BAJI/STIRLING PLATFORM'.
import.prices:39145 Unrecognized STAR/Station, 'HSIEN BAJI/STREKALOV HANGER'.
import.prices:39575 Unrecognized STAR/Station, 'HUOKANG/STEINER CITY'.
import.prices:40565 Unrecognized STAR/Station, 'K CAMELOPARDALIS/FODA ORBITAL'.
import.prices:40719 Unrecognized STAR/Station, 'K CAMELOPARDALIS/PAYETTE HUB'.
import.prices:40875 Unrecognized STAR/Station, 'KABA/ROBINSON STATION'.
import.prices:41523 Unrecognized STAR/Station, 'KAURAWISH/KOOI HUB'.
import.prices:41801 Unrecognized STAR/Station, 'KHANCI/BLOOMFIELD COLONY'.
import.prices:41941 Unrecognized STAR/Station, 'KHANCI/TANI COLONY'.
import.prices:43941 Unrecognized STAR/Station, 'KURU/CARSTENSZ DOCK'.
import.prices:44103 Unrecognized STAR/Station, 'KURU/WEISS GATEWAY'.
import.prices:45907 Unrecognized STAR/Station, 'LEMASTSHI/LONCHAKOV DOCK'.
import.prices:46133 Unrecognized STAR/Station, 'LFT 1073/COOK LANDING'.
import.prices:46287 Unrecognized STAR/Station, 'LFT 1073/GALOIS INSTALLATION'.
import.prices:46441 Unrecognized STAR/Station, 'LFT 140/FORD ORBITAL'.
import.prices:48251 Unrecognized STAR/Station, 'LHS 140/MONDEH STATION'.
import.prices:48397 Unrecognized STAR/Station, 'LHS 1663/BULYCHEV HOLDINGS'.
import.prices:48561 Unrecognized STAR/Station, 'LHS 1663/FROBISHER CITY'.
import.prices:50563 Unrecognized STAR/Station, 'LHS 214/LAIRD VISION'.
import.prices:50669 Unrecognized STAR/Station, 'LHS 220/CULPEPER COLONY'.
import.prices:51187 Unrecognized STAR/Station, 'LHS 277/ROWLEY PORT'.
import.prices:56395 Unrecognized STAR/Station, 'LP 254-40/JACOBI DOCK'.
import.prices:58159 Unrecognized STAR/Station, 'LP 48-567/NOAKES HANGER'.
import.prices:58361 Unrecognized STAR/Station, 'LP 5-88/HIRASE HOLDINGS'.
import.prices:58505 Unrecognized STAR/Station, 'LP 5-88/SONG DOCK'.
import.prices:59197 Unrecognized STAR/Station, 'LP 90-39/GUERRERO TERMINAL'.
import.prices:59345 Unrecognized STAR/Station, 'LP 90-39/HERMITE HANGER'.
import.prices:59493 Unrecognized STAR/Station, 'LP 90-39/ROBSON TERMINAL'.
import.prices:60023 Unrecognized STAR/Station, 'LTT 14436/EGAN PLANT'.
import.prices:60165 Unrecognized STAR/Station, 'LTT 14436/GALIANO CITY'.
import.prices:66791 Unrecognized STAR/Station, 'MAFDETELA/VINGE BEACON'.
import.prices:66935 Unrecognized STAR/Station, 'MAFDETELA/WALLIN SETTLEMENT'.
import.prices:67221 Unrecognized STAR/Station, 'MANATHAJERI/BENNETT STOP'.
import.prices:67367 Unrecognized STAR/Station, 'MANATHAJERI/LYSENKO MINE'.
import.prices:67851 Unrecognized STAR/Station, 'MAUJAVANT/CAMPBELL SETTLEMENT'.
import.prices:68005 Unrecognized STAR/Station, 'MAUJAVANT/JORDAN SETTLEMENT'.
import.prices:68857 Unrecognized STAR/Station, 'MEDUSA/KOPRA CITY'.
import.prices:71783 Unrecognized STAR/Station, 'NEGANHOT/HE LANDING'.
import.prices:77931 Unrecognized STAR/Station, 'PPM 41187/BURNET PORT'.
import.prices:80629 Unrecognized STAR/Station, 'ROSS 211/OTIMAN STATION'.
import.prices:85877 Unrecognized STAR/Station, 'SUSAMA/KAKU DOCK'.
import.prices:86023 Unrecognized STAR/Station, 'SUSAMA/MULLANE BEACON'.
import.prices:89001 Unrecognized STAR/Station, 'TIGUAI/PIPPIN PORT'.
import.prices:91085 Unrecognized STAR/Station, 'UNDADJA/MCARTHUR HANGER'.
import.prices:91229 Unrecognized STAR/Station, 'UNDADJA/RUTHERFORD DEPOT'.
import.prices:93235 Unrecognized STAR/Station, 'V816 HERCULIS/HOBAUGH HANGER'.
import.prices:93379 Unrecognized STAR/Station, 'V816 HERCULIS/WILLIS INSTALLATION'.
import.prices:93835 Unrecognized STAR/Station, 'V989 CASSIOPEIAE/TARELKIN REFINERY'.
import.prices:94865 Unrecognized STAR/Station, 'WANGGU/QURESHI COLONY'.
import.prices:95149 Unrecognized STAR/Station, 'WEN KUANEI/HUTCHINSON LANDING'.
import.prices:95301 Unrecognized STAR/Station, 'WEN KUANEI/NIVEN RELAY'.
import.prices:97179 Unrecognized STAR/Station, 'WOLF 46/FRANKLIN DOCK'.
import.prices:97359 Unrecognized STAR/Station, 'WOLF 517/COMPTON INSTALLATION'.
import.prices:99175 Unrecognized STAR/Station, 'YAKAWANA/BOOLE ESTATE'.
import.prices:99329 Unrecognized STAR/Station, 'YAKAWANA/THURSTON DOCK'.
import.prices:99483 Unrecognized STAR/Station, 'YAKAWANA/YOURKEVITCH PLATFORM'.
import.prices:99637 Unrecognized STAR/Station, 'YAN YI/BURNHAM PROSPECT'.

kfsone-tradedangerous-94576a2c9be9>trade.py import -i --plug=maddavo --opt=syscsv --opt=stncsv
Connecting to server: http://www.davek.com.au/td/System.csv
data/System.csv: 1.393.426/1.393.426 bytes |  74.30KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/Station.csv
data/Station.csv: 42.684/42.684 bytes |  43.60KB/s | 100.00%
Connecting to server: http://www.davek.com.au/td/prices.asp
import.prices: 3.603.361/3.603.361 bytes |  78.75KB/s | 100.00%
No new data - nothing to do - doing nothing.

kfsone-tradedangerous-94576a2c9be9>..\trade-run.cmd "Back Enterprise"

kfsone-tradedangerous-94576a2c9be9>REM trade-run.cmd

kfsone-tradedangerous-94576a2c9be9>REM trade.py with spezialized run options (start is option)

kfsone-tradedangerous-94576a2c9be9>trade.py run --capacity 34 --credits 800000 --ly-per 14.14 --max-days-old=3 --empty-ly 16.10 --from
 "Back Enterprise" --hops 3 --jumps-per 2 --routes 2 -vv
NOTE: Rebuilding cache file: this may take a moment
Traceback (most recent call last):
  File "kfsone-tradedangerous-94576a2c9be9\trade.py", line 75, in <module>
    main(sys.argv)
  File "kfsone-tradedangerous-94576a2c9be9\trade.py", line 48, in main
    tdb = tradedb.TradeDB(cmdenv, load=cmdenv.wantsTradeDB)
  File "kfsone-tradedangerous-94576a2c9be9\tradedb.py", line 335, in __init__
    self.reloadCache()
  File "kfsone-tradedangerous-94576a2c9be9\tradedb.py", line 409, in reloadCache
    cache.buildCache(self, self.tdenv)
  File "kfsone-tradedangerous-94576a2c9be9\cache.py", line 824, in buildCache
    processImportFile(tdenv, tempDB, Path(importName), importTable)
  File "kfsone-tradedangerous-94576a2c9be9\cache.py", line 721, in processImportFile
    for linein in csvin:
  File "C:\Python34\lib\codecs.py", line 313, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 253: invalid continuation byte
 
Last edited:
Back
Top Bottom