vMix Forums
	 » 
	General
	 » 
	General Discussion
	 » 
	Datasources error: process cannot access file
	 
	
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 8/5/2015(UTC) Posts: 49  Location: GermanyThanks: 11 timesWas thanked: 3 time(s) in 3 post(s)
 
 | 
            
		      
                I am using nodejs to write data into a text file which I want to use as a datasource. When trying to add the text file via the datasource manager I always get the error:
 "Error: process cannot access the file since it is in use by another process" (translated from German)
 
 As soon as the nodejs app stops vmix will access the file and refresh the data.
 
 Other programs (i.e. Atom, Texteditors) can access the file while it is being written. What am I doing wrong??
 
 Any insights much appreciated!!
 
 Thanks,
 
 Knut
 
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 11/11/2016(UTC) Posts: 378  Location: EuropeThanks: 23 timesWas thanked: 38 time(s) in 32 post(s)
 
 | 
            
		      
                nodejs should open the file, write into the file and close/unlock the file | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 8/5/2015(UTC) Posts: 49  Location: GermanyThanks: 11 timesWas thanked: 3 time(s) in 3 post(s)
 
 | 
            
		      
                But why can other applications load the file while it's in use by nodejs and vMix can not? I am simply using fs.writeFile(). | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 11/11/2016(UTC) Posts: 378  Location: EuropeThanks: 23 timesWas thanked: 38 time(s) in 32 post(s)
 
 | 
            
		      
                you are sure, you can write with other editors at the same time?
 if you open a file with excel, other programs can't write to the same file at the same time,
 but most editors can open it, but not save the changes you made in the editor
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 8/5/2015(UTC) Posts: 49  Location: GermanyThanks: 11 timesWas thanked: 3 time(s) in 3 post(s)
 
 | 
            
		      
                ah, so vmix needs write access? Isnt it possible, to have it only reading the source? Like an option: „Datasource open read-only“ | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 11/11/2016(UTC) Posts: 378  Location: EuropeThanks: 23 timesWas thanked: 38 time(s) in 32 post(s)
 
 | 
            
		      
                I'm not surenever tested it
 
 we have to ask Martin
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 8/5/2015(UTC) Posts: 49  Location: GermanyThanks: 11 timesWas thanked: 3 time(s) in 3 post(s)
 
 |  | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 12/27/2012(UTC) Posts: 5,446  Location: BelgiumThanks: 311 timesWas thanked: 1006 time(s) in 830 post(s)
 
 | 
            
		      
                Originally Posted by: dasmedienatelier  Well, Martin? :) Yes, Martin is checking this forum 24/7 (so timezone  doesn't matter) why not message support ? | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Administration
 Groups: Administrators
 Joined: 1/13/2010(UTC) Posts: 5,263  Location: Gold Coast, AustraliaWas thanked: 4610 time(s) in 1594 post(s)
 | 
            
		      
                I am everywhere!
 Reading a file while it is in use by another program is a very bad idea!
 Consider if the program only half finished writing to the file when vMix updated, you would end up with scrambled
 or incomplete text in your titles!
 
 Instead, all file data sources should save to file when updates are made and not keep the file open.
 (Excel and Notepad do this for example).
 Thus when vMix reads the file successfully it can always be sure the data is complete.
 
 Regards,
 
 Martin
 vMix
 
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 8/5/2015(UTC) Posts: 49  Location: GermanyThanks: 11 timesWas thanked: 3 time(s) in 3 post(s)
 
 | 
            
		      
                Thanks for replying, I really appreciate that.
 I am using google's speech API for transcribing and generating subtitles. Currently, I am writing the returned transcription into a textfile which I tried to use as a datasource. Since the results are coming in pretty fast I need to rewrite the file very often. Maybe too often, so it seems, that the file is always locked.
 
 I guess I have to find a different way of sending subtitles to vMix, then. Since I don't know if there is a way of sending subtitles as metadata along with a livestream?
 
 Thanks,
 
 Knut
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 8/5/2015(UTC) Posts: 49  Location: GermanyThanks: 11 timesWas thanked: 3 time(s) in 3 post(s)
 
 | 
            
		      
                Found a solution: I'm now using vMix's web API. I'm simply sending the subtitles via http/tcp instead of writing to a file.
 Furthermore, I have found a nodejs vmix module which makes it pretty easy to send commands to the vmix webinterface.
 
 Thanks again to all,
 
 Knut
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
                           
	vMix Forums
	 » 
	General
	 » 
	General Discussion
	 » 
	Datasources error: process cannot access file
	 
	
    
        Forum Jump
         
	
    
    You cannot post new topics in this forum.
	
	You cannot reply to topics in this forum.
	
	You cannot delete your posts in this forum.
	
	You cannot edit your posts in this forum.
	
	You cannot create polls in this forum.
	
	You cannot vote in polls in this forum.
	
	
    
    
        Important Information:
        The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
        
        
More Details
        Close