redruin1/factorio-draftsman

Problems with importing blueprint strings

nicholasgower opened this issue · 1 comments

`
from draftsman.blueprintable import Blueprint
bp_string="0eNqllGFvgjAQhv/LfaZGkQLyVxZjCp54WWlZW9yM8b/vQEdmxnRxn0jh7nnfu95xglJ32DoyAYoTUGWNh+LlBJ5qo3T/LhxbhAIoYAMRGNX0J+U9NqUmU4tGVXsyKJZwjoDMFj+gWJzXEaAJFAgvvOFw3JiuKdFxwH1SBK31nGxN74CBMo/lTEZwhEKk8/lMspbDigZrwSnjW+uCKFEHtvFDLh7ldsoHQcajC/zhro5c5awzQVuONB9U9Xofl9ziItgSG7/EJBPw5Dmr6V/Y8knj6XQf0hGnbU0+UCWqPbLpli+VDihaZw+0fWw+m+Znv/EdvnX8fGw8uw7KEL7Zkeacyzx+DeooQc4a0WoVkKGV7fqFyGTv6hoa34bWqJx43yPqm/j1RB35mNnglrpGoOZbclxOazVO1pA+bM7qHxskV8n9DeLtHfa9+PZ7iODAzRuAcb5IslWcSZkkMkvP5088WWSJ"

logistic_factory=Blueprint()
logistic_factory.load_from_string(bp_string)

`

`
runfile('I:/Other computers/My PC/Fall2021/2022-Q2/factorio draftsman scripts/untitled7.py', wdir='I:/Other computers/My PC/Fall2021/2022-Q2/factorio draftsman scripts')
Traceback (most recent call last):

File I:\Other computers\My PC\Fall2021\2022-Q2\factorio draftsman scripts\untitled7.py:12 in
logistic_factory.load_from_string(bp_string)

File ~\Anaconda3\lib\site-packages\draftsman\utils.py:339 in inner
result = func(*args, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\blueprint.py:97 in load_from_string
self.setup(**root["blueprint"])

File ~\Anaconda3\lib\site-packages\draftsman\utils.py:339 in inner
result = func(*args, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\blueprint.py:196 in setup
self.entities = EntityList(self, kwargs.pop("entities"))

File ~\Anaconda3\lib\site-packages\draftsman\utils.py:339 in inner
result = func(*args, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\entitylist.py:59 in init
self.append(name, **elem)

File ~\Anaconda3\lib\site-packages\draftsman\utils.py:339 in inner
result = func(*args, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\entitylist.py:123 in append
self.insert(len(self.data), entity, copy=copy, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\utils.py:339 in inner
result = func(*args, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\entitylist.py:187 in insert
entity = new_entity(six.text_type(entity), **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\entity.py:147 in new_entity
return LogisticRequestContainer(name, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\prototypes\logistic_request_container.py:39 in init
super(LogisticRequestContainer, self).init(

File ~\Anaconda3\lib\site-packages\draftsman\classes\mixins\inventory.py:23 in init
super(InventoryMixin, self).init(name, similar_entities, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\mixins\request_items.py:28 in init
super(RequestItemsMixin, self).init(name, similar_entities, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\mixins\control_behavior.py:42 in init
super(ControlBehaviorMixin, self).init(name, similar_entities, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\mixins\circuit_connectable.py:21 in init
super(CircuitConnectableMixin, self).init(name, similar_entities, **kwargs)

File ~\Anaconda3\lib\site-packages\draftsman\classes\mixins\request_filters.py:27 in init
self.set_request_filters(kwargs["request_filters"])

File ~\Anaconda3\lib\site-packages\draftsman\classes\mixins\request_filters.py:102 in set_request_filters
six.raise_from(DataFormatError(e), None)

File :3 in raise_from

DataFormatError: Or((Schema(And(Use(<function at 0x0000028F6AF9A8B0>), <class 'str'>)), <class 'int'>)) did not validate {'index': 1, 'name': 'iron-plate', 'count': 75}
{'index': 1, 'name': 'iron-plate', 'count': 75} should be instance of 'tuple'

`

Whoops. I forgot to keep both the shorthand format and the longhand format as valid inputs into the constructor. This will be fixed in 0.9.4.