Exception when running script

Official forum for open source FreePIE discussion and development.
Post Reply
rscott6666
One Eyed Hopeful
Posts: 8
Joined: Sun Aug 21, 2016 6:06 pm

Exception when running script

Post by rscott6666 »

I am trying to create a voice control script for Star Citizen but it always crashes when i say a certain phrase. other phrases work fine.

This exception shows up in the log file...

Any ideas?

8/21/2016 8:01:12 PM - System.Reflection.TargetInvocationException - Exception has been thrown by the target of an invocation.:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Speech.Internal.AsyncSerializedWorker.WorkerProc(Object ignored)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
System.Collections.Generic.KeyNotFoundException - The given key was not present in the dictionary.:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at FreePIE.Core.Plugins.SpeechPlugin.<EnsureRecognizer>b__0(Object s, SpeechRecognizedEventArgs e)
at System.Speech.Recognition.SpeechRecognitionEngine.SpeechRecognizedProxy(Object sender, SpeechRecognizedEventArgs e)
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Exception when running script

Post by CyberVillain »

This is the line that fails.

https://github.com/AndersMalmgren/FreeP ... gin.cs#L90

Why it does that is strange, please provide script and which sentence that fails
rscott6666
One Eyed Hopeful
Posts: 8
Joined: Sun Aug 21, 2016 6:06 pm

Re: Exception when running script

Post by rscott6666 »

Thank you for your time. After reading your attempts at a VR game (which i appreciate because i have a vive), i didn't think I would get an answer.

Anyhow, the sentence is "computer, increase power to front shield". I'd be curious what the error is because it almost seems like a key collision sort of thing.
You do not have the required permissions to view the files attached to this post.
FrenchyKiel
One Eyed Hopeful
Posts: 47
Joined: Thu Oct 03, 2013 7:10 am

Re: Exception when running script

Post by FrenchyKiel »

impossible to read script without tab.. put the py script
rscott6666
One Eyed Hopeful
Posts: 8
Joined: Sun Aug 21, 2016 6:06 pm

Re: Exception when running script

Post by rscott6666 »

Not sure you mean. Convert spaces to tabs? Upload as a .py file?
FrenchyKiel
One Eyed Hopeful
Posts: 47
Joined: Thu Oct 03, 2013 7:10 am

Re: Exception when running script

Post by FrenchyKiel »

In python script tab is important to delimit if, def and so on... so the py file keep tab .. in the txt file..all tab are lost...
rscott6666
One Eyed Hopeful
Posts: 8
Joined: Sun Aug 21, 2016 6:06 pm

Re: Exception when running script

Post by rscott6666 »

Sorry, didn't realize people 7z'd the scripts before uploading them.
You do not have the required permissions to view the files attached to this post.
FrenchyKiel
One Eyed Hopeful
Posts: 47
Joined: Thu Oct 03, 2013 7:10 am

Re: Exception when running script

Post by FrenchyKiel »

no file inside?
rscott6666
One Eyed Hopeful
Posts: 8
Joined: Sun Aug 21, 2016 6:06 pm

Re: Exception when running script

Post by rscott6666 »

Strange. It seems like theres a file in there to me. Can anyone else confirm one way or the other?
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: Exception when running script

Post by MarijnS95 »

FrenchyKiel wrote:In python script tab is important to delimit if, def and so on... so the py file keep tab .. in the txt file..all tab are lost...
No and no.

In python, only the indentation level is important. You may even achieve this by mixing tabs and spaces, but you need to keep it consistent throughout the entire block (if you use " \t " in the entire block, that's fine). Sub-blocks (eg. an if statment in a def) may have a completely different indentation, as long as the beginning of the indentation matches that of the parent block:

Code: Select all

def foo():
 \t if True:
 \t \t\t    \tprint("bar")
 \t \t\t    \tbarFunc()
 \t print("yup")
This doesn't mean that it makes your code any more readable, so please refrain from using such weird structures :D

Anyway, a txt file doesn't just magically lose characters. All the indentation is still there. However, it's a bit messy; you're mixing 2-space indents and 4-space indents. Like I explained above that works completely fine, but it doesn't make the code readable or consistent.

The code doesn't crash on my side - that sentence is correctly registered. Tested in FreePIE 1.9.629.0 (latest version) and my own build from master. Perhaps check if you have the latest version?

(Yes, I know this is late. Still hope it helps you out though.)
Post Reply

Return to “FreePIE”