Skip to content

Saving to Local starts giving error - #198

Closed
hsemwal wants to merge 183 commits into
mainfrom
MSUS_onboard_12_to8bit
Closed

Saving to Local starts giving error#198
hsemwal wants to merge 183 commits into
mainfrom
MSUS_onboard_12_to8bit

Conversation

@hsemwal

@hsemwal hsemwal commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Hi @sneakers-the-rat - I am getting the following terminal text repeated when I attempt to record video with MIO for long (>10 minutes)

--- Logging error ---
Traceback (most recent call last):
File "\Programs\Python\Python313\Lib\logging\handlers.py", line 80, in emit
self.doRollover()
~~~~~~~~~~~~~~~^^
File "
\Lib\logging\handlers.py", line 185, in doRollover
self.rotate(self.baseFilename, dfn)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File \Lib\logging\handlers.py", line 121, in rotate
os.rename(source, dest)
~~~~~~~~~^^^^^^^^^^^^^^
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '
\logs\mio.log' -> '\mio\mio\logs\mio.log.1'
Call stack:
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\hsemwal\Documents\Github\mio.venv\Scripts\mio.exe_main
.py", line 6, in
sys.exit(cli())
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Users\hsemwal\Documents\Github\mio\mio\cli\stream.py", line 106, in capture
daq_inst.capture(
File "C:\Users\hsemwal\Documents\Github\mio\mio\stream_daq.py", line 616, in capture
self._handle_frame(
File "C:\Users\hsemwal\Documents\Github\mio\mio\devices\gs\daq.py", line 110, in _handle_frame
self.logger.debug("Saving header metadata")
Message: 'Saving header metadata'
Arguments: ()
WARNING [mio.streamDaq.buffer] Frame 17010; Buffer 136083 (#2 in frame) stream_daq.py:182
Expected buffer data length: 13120, got data with shape 13120.
Padding to expected length
DEBUG [mio.GSStreamDaq] Saving header metadata daq.py:110
DEBUG [mio.streamDaq.buffer] ----buffer #2 stored stream_daq.py:389
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 80, in emit
self.doRollover()
~~~~~~~~~~~~~~~^^
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 185, in doRollover
self.rotate(self.baseFilename, dfn)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 121, in rotate
os.rename(source, dest)
~~~~~~~~~^^^^^^^^^^^^^^
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\hsemwal\AppData\Local\mio\mio\logs\mio.log' -> 'C:\Users\hsemwal\AppData\Local\mio\mio\logs\mio.log.1'
Call stack:
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\hsemwal\Documents\Github\mio.venv\Scripts\mio.exe_main
.py", line 6, in
sys.exit(cli())
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Users\hsemwal\Documents\Github\mio\mio\cli\stream.py", line 106, in capture
daq_inst.capture(
File "C:\Users\hsemwal\Documents\Github\mio\mio\stream_daq.py", line 616, in capture
self._handle_frame(
File "C:\Users\hsemwal\Documents\Github\mio\mio\devices\gs\daq.py", line 110, in _handle_frame
self.logger.debug("Saving header metadata")
Message: 'Saving header metadata'
Arguments: ()
DEBUG [mio.GSStreamDaq] Saving header metadata daq.py:110
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 80, in emit
self.doRollover()
~~~~~~~~~~~~~~~^^
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 185, in doRollover
self.rotate(self.baseFilename, dfn)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 121, in rotate
os.rename(source, dest)
~~~~~~~~~^^^^^^^^^^^^^^
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\hsemwal\AppData\Local\mio\mio\logs\mio.log' -> 'C:\Users\hsemwal\AppData\Local\mio\mio\logs\mio.log.1'
Call stack:
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\hsemwal\Documents\Github\mio.venv\Scripts\mio.exe_main
.py", line 6, in
sys.exit(cli())
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\hsemwal\Documents\Github\mio.venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Users\hsemwal\Documents\Github\mio\mio\cli\stream.py", line 106, in capture
daq_inst.capture(
File "C:\Users\hsemwal\Documents\Github\mio\mio\stream_daq.py", line 616, in capture
self._handle_frame(
File "C:\Users\hsemwal\Documents\Github\mio\mio\devices\gs\daq.py", line 110, in _handle_frame
self.logger.debug("Saving header metadata")
Message: 'Saving header metadata'
Arguments: ()
WARNING [mio.streamDaq.buffer] Frame 17010; Buffer 136084 (#3 in frame) stream_daq.py:182
Expected buffer data length: 13120, got data with shape 13120.
Padding to expected length
DEBUG [mio.GSStreamDaq] Saving header metadata daq.py:110
DEBUG [mio.streamDaq.buffer] ----buffer #3 stored stream_daq.py:389
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 80, in emit
self.doRollover()
~~~~~~~~~~~~~~~^^
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 185, in doRollover
self.rotate(self.baseFilename, dfn)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hsemwal\AppData\Local\Programs\Python\Python313\Lib\logging\handlers.py", line 121, in rotate
os.rename(source, dest)
~~~~~~~~~^^^^^^^^^^^^^^
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C
mio\logs\mio.log' -> 'C~\mio\logs\mio.log.1'

[26-07-22T17:01:35] DEBUG [mio.streamDaq.iter_buffers] Got end of recording exception, breaking


📚 Documentation preview 📚: https://miniscope-io--198.org.readthedocs.build/en/198/

hsemwal and others added 30 commits December 3, 2024 14:04
- trying to change the config file to match the firmware
- generalize the config file and stream_daq.py
- Investigating where buffer per frame value is getting set at 3, likely self._buffer_npix is getting its values
- adjusting the StreamBit header file and the config file according to
- implemented on VS code
- modified pixel value depth to 8 bits instead of 10
- csv not outputting correct frame (frame number increasing on oscilloscope, but not on the csv counter through MIO)
- changing yml file
- added MSUS config file
and changed baud rate to 5 MHz for FPGA
…number of buffers and dummy words to better match the firmware)
- changing the settings on the config and stream.py files, still not getting any images
- only 3 data buffers, possibly error is coming from here
- added MSUS config file
and changed baud rate to 5 MHz for FPGA
…number of buffers and dummy words to better match the firmware)
- changing the settings on the config and stream.py files, still not getting any images
- only 3 data buffers, possibly error is coming from here
Copied last function in types.py and copied to my code (maybe accidentally changed)
Changed yml MSUS file bitstream pointer to 5 MHz
Changed blocksize back to 4000, which should include the data+header
For some reason MSUS config had an incorrectly tabbed if statement, hopefully fixed in this commit
Output data that the FPGA receives (so far, just \x00\x8f\xff)
right now the data is not properly being read by MIO and the output text file gives some 0x00....0x8f....0xff which is not what is being sent out from the dev board
sneakers-the-rat and others added 22 commits August 1, 2025 20:55
msus - test frame processing values with bright/dark sample
Converting datastream to 8bit value. Will need to modularize this a bit better, currently inside of buffer_to_array
Increased time for debug and comments
Increased time for debug and comments
Just modified some comments and added a test as a proof of concept
We now have video recording capabilities on MIO
minor update to mio before starting branch to fix 12 MHz version
Implemented ROI row by row flexibility
Implementing ROI based MSUS/MIO interface (changed to 8 MHz)
Branch for 12 to 8 bit conversion that is already processed on board the MSUS
Corrected yaml file for new data block sizes
Created an MSUS ROI Yaml file for testing
testing for ROI from MSUS
changes to MSUS ROI for the smaller region of interest MSUS ROI (8 MHz output, 120x120x8 pixel)
Modifeid some of the settings for ROI on GSM (12 to 8 bit processing) full frame
@hsemwal
hsemwal requested a review from sneakers-the-rat July 23, 2026 00:20
@sneakers-the-rat

Copy link
Copy Markdown
Collaborator

this would be an issue, not a pull request, but let me see

@sneakers-the-rat

Copy link
Copy Markdown
Collaborator

note the error message:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\hsemwal\AppData\Local\mio\mio\logs\mio.log' -> 'C:\Users\hsemwal\AppData\Local\mio\mio\logs\mio.log.1'

is either of those files open in another program?

@hsemwal

hsemwal commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

Noted! No there is no other process that should be using those log files, I also noticed a ".log.1" file being created, maybe the log file is getting too large so it creates a new log.# file and that is where the errors start to show?

@sneakers-the-rat

Copy link
Copy Markdown
Collaborator

right, yeah, that's what's happening, it is trying to roll over the log files, but it can't because something is holding a reference to it. this could be just a windows thing, but we probably need to split out the loggers by process anyway. i'm going to close this and convert to an issue

@sneakers-the-rat

Copy link
Copy Markdown
Collaborator

an example of raising an issue - #199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants