1

I am running 2.7 and i am using pyinstaller. My goal is to output a exe and also have it run my other class file. I am also using https://code.google.com/p/dragonfly/ as a framework for voice recognition. I have created another file in the examples direction under dragonfly->examples->text.py . If i run https://code.google.com/p/dragonfly/source/browse/trunk/dragonfly/examples/dragonfly-main.py?spec=svn79&r=79 with my IDE i can say voice commands and it will understand the below file i have created and the other example files that are in the dragonfly examples.

    from dragonfly.all import Grammar, CompoundRule, Text, Dictation
import sys
sys.path.append('action.py')
import action

# Voice command rule combining spoken form and recognition processing.
class ExampleRule(CompoundRule):
    print "This works"
    spec = "do something computer"                  # Spoken form of command.
    def _process_recognition(self, node, extras):   # Callback when command is spoken.
        print "Voice command spoken."

class AnotherRule(CompoundRule):
    spec = "Hi there"                  # Spoken form of command.
    def _process_recognition(self, node, extras):   # Callback when command is spoken.
        print "Well, hello"




# Create a grammar which contains and loads the command rule.
grammar = Grammar("example grammar")                # Create a grammar to contain the command rule.
grammar.add_rule(ExampleRule())                     # Add the command rule to the grammar.
grammar.add_rule(AnotherRule())                     # Add the command rule to the grammar.
grammar.load()           

                       # Load the grammar.

I noticed in console that it will output

UNKNOWN: valid paths: ['C:\\Users\\user\\workspace\\dragonfly\\dragonfly-0.6.5\\dragonfly\\examples\\action.py',etc..etc...

After i have used pyinstaller the output for that line is

UNKNOWN: valid paths: []

So its not loading the examples because it cannot find them. How can i tell pyinstaller to also load the example files when it is creating an exe? And If it does load the files how can i make sure my exe knows where the files are?

The command i am running for pyinstaller

C:\Python27\pyinstaller-2.0>python pyinstaller.py -p-paths="C:\Users\user\worksp
ace\dragonfly\dragonfly-0.6.5\dragonfly\examples\test.py" "C:\Users\user\workspa
ce\dragonfly\dragonfly-0.6.5\dragonfly\examples\dragonfly-main.py"
rubio
  • 936
  • 5
  • 16
  • 36

1 Answers1

0

If I understand clearly. You have your script and some examples scripts which call your script to show that it is working?

You are missing the point. Your script supposes to be an end product.

If you want to test functionality do it in development version.
If you want to test exe file do it by another(separated) test script.

Other thing:
Scripts and modules are totally different things.
You are trying to import your script as module and use it in example script.

I suggest you to build main entry point to script (with parameters if you need) as it is meant to be done. And make other example script which run your script.

Or make a module and build script which uses this module. Then build this example script to exe file which uses that module and shows it works

PyInstaller can compile one script at once. Forcing it to do unusual things is not needed.

Bartosz Dabrowski
  • 1,850
  • 2
  • 15
  • 21
  • My main script dragonfly-main.py is loading each of the example files in the directory as modules. It can do that just fine with the IDE but when using pyinstaller it doesn't get my examples files for whatever reason. S the dragonfly-main doesn't know what the other modules are. – rubio Mar 23 '13 at 02:58
  • Example files are example files not modules. Create your separated project, import dragonfly to it. If you need code from example files - copy and past it to your project, how much you need. – Bartosz Dabrowski Mar 23 '13 at 09:57
  • You were right i was trying to do everything backwards haha. I am new to python. thanks for your help. – rubio Mar 24 '13 at 16:20