# Error code 6 when trying to convert LI file

**URL:** <https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712>\
**Category:** Moku:Go\
**Created:** [May 16, 2023, 1:27am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712 "2023-05-16T01:27:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gautam](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@gautam](https://forum.liquidinstruments.com/u/gautam)\
**Post date:** [May 16, 2023, 1:27am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712/1 "2023-05-16T01:27:37Z")

</div>

I’m trying to run [this example](https://apis.liquidinstruments.com/examples/python/#data-logger) to have a python script grab some data and save it to file. However, when I try and convert the saved .li file to any other format, using either the GUI converter or mokucli, I get “Error code 6” and the conversion fails. `moku. __version__ ` yields `3.0.0` and the last firmware update I did was for `fw_ver=576`. Is this user error on my part? The only line I changed in the example file is the IP address of my specific device.

---

<div class="post-metadata">

**Author:** ![NandiW](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.liquidinstruments.com/nandiw/32/238_2.png) [@NandiW](https://forum.liquidinstruments.com/u/NandiW)\
**Post date:** [May 17, 2023, 1:49am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712/2 "2023-05-17T01:49:47Z")

</div>

Hi @gautam, thank you for reporting this issue.

Can share the log file with us please to have a look at where the issue originated from. Can you please email the file to [support@liquidinstruments.com](mailto:support@liquidinstruments.com)

Thank you!  
Nandi

---

<div class="post-metadata">

**Author:** ![gautam](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@gautam](https://forum.liquidinstruments.com/u/gautam)\
**Post date:** [May 17, 2023, 4:08am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712/3 "2023-05-17T04:08:10Z")

</div>

Thanks Nandi for looking into this, I’ve emailed the file.

---

<div class="post-metadata">

**Author:** ![NandiW](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.liquidinstruments.com/nandiw/32/238_2.png) [@NandiW](https://forum.liquidinstruments.com/u/NandiW)\
**Post date:** [May 18, 2023, 6:56am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712/4 "2023-05-18T06:56:24Z")

</div>

Hi Gautam,

Thank you for sending through the file.

There is a bug in our Data Logger example, you will need to replace line 46, i.e. the file download command, with the following:

`i.download("persist", logFile['file_name'], os.path.join(os.getcwd(), logFile['file_name']))`

We are working on updating the example script on our documentation page now, thank you for pointing this out.

Kind regards,  
Nandi

---

<div class="post-metadata">

**Author:** ![gautam](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@gautam](https://forum.liquidinstruments.com/u/gautam)\
**Post date:** [May 19, 2023, 12:49am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712/5 "2023-05-19T00:49:13Z")

</div>

Great, thanks, this worked for me!

FWIW, I was able to workaround the original problem by using the [`start_streaming`](https://apis.liquidinstruments.com/reference/datalogger/start_streaming.html) followed by the [`stream_to_file`](https://apis.liquidinstruments.com/reference/datalogger/stream_to_file.html) function calls. This had the advantage that I could stream directly to a `.npy` file and bypass the conversion step. However, I found the need to include (somewhat arbitrarily chosen) `sleep` statements between `start_streaming` and `stop_streaming` calls and subsequent python function calls. Is `start_logging` preferred to `start_streaming` from a robustness point of view? I have an MWE script that I can’t seem to upload here, but asking in case this is a known issue?

---

<div class="post-metadata">

**Author:** ![dhwielens](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.liquidinstruments.com/dhwielens/32/248_2.png) [@dhwielens](https://forum.liquidinstruments.com/u/dhwielens)\
**Post date:** [August 22, 2023, 7:10am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712/6 "2023-08-22T07:10:13Z")

</div>

Hi @gautam,

Your latest post in this thread sounds like something that I’m also working on: we also would like to capture data with the logger and then post-process in Python immediately, so ideally we’d like to have it as .npy directly rather than .li.

Could you perhaps share (part of) your code where you implemented the `start_streaming`, `sleep` and `stop_streaming`?

Thanks in advance!

Daan

---

<div class="post-metadata">

**Author:** ![gautam](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@gautam](https://forum.liquidinstruments.com/u/gautam)\
**Post date:** [December 27, 2023, 6:13am UTC](https://forum.liquidinstruments.com/t/error-code-6-when-trying-to-convert-li-file/712/7 "2023-12-27T06:13:56Z")

</div>

Hi @dhwielens

Apologies for the incredibly delayed reply - i don’t think i got an email notification about your message and I am just now logging into the support forum again. In case it’s still useful, here is a snippet of code.

```auto
logger = Datalogger(mokuIP, force_connect=True)
logger.set_frontend(channel=1, impedance='1MOhm', coupling='DC', range="50Vpp")
logger.set_samplerate(100) # 100 Hz should be plenty fast, and yields a reasonable file size
logger.set_acquisition_mode(mode="Normal")
logger.start_streaming(duration=tScanMax)
sleep(1)
logger.stream_to_file(saveDir+f"z_{zPos}_{xPos}_{counter}_forwardScan.npy")
logger.stop_streaming()

```
