Page 1 of 1

FileNotFoundException when trying out script

PostPosted: Mon May 03, 2010 11:11 am
by Gameday
I tried to familiarise myself with the language by running the sample scripts.
Any file I run throws a FileNotFoundException. This is the output I get, maybe it's helpful:

Code: Select all
F:\Documents and Settings\john\Desktop\Cobra-2010-04-02\Cobra-2010-04-02\Source\Snapshot>cobra "f:\Documents and Settings
\john\Desktop\c\a.cobra"

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Cobra.Lang, Version=0.8.0.1, Cult
ure=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=null'
   at John.Main()
   at MainWrapper.Main()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Here's the content of a.cobra:
Code: Select all
class John
   def main
      print "Hello"


I'm probably doing something wrong, but I can't spot what it is.

Re: FileNotFoundException when trying out script

PostPosted: Mon May 03, 2010 12:06 pm
by Charles
It looks like you have not installed Cobra. The Snapshot is only suitable for compiling the compiler and isn't otherwise directly used.

Technically, you could copy Cobra.Lang.dll around to various working directories to get around this, but the real solution is to run install-from-workspace.bat while in the Source\ directory. After that, you can be in any directory and typically will not be in the Cobra directories unless you are hacking on the compiler or in the HowTo\ or Samples\ (or maybe Tests\).

Re: FileNotFoundException when trying out script

PostPosted: Mon May 03, 2010 12:14 pm
by Gameday
That did the trick. Thank you very much!

Re: FileNotFoundException when trying out script

PostPosted: Mon May 03, 2010 2:55 pm
by Charles
You're welcome.

Re: FileNotFoundException when trying out script

PostPosted: Wed May 05, 2010 4:49 am
by Gameday
I have a suggestion related to InstallFromWorkspace.cobra.
Why not make it take an argument, CobraCore.commandLineArgs[1] and have that as the installation directory, and if that's missing default to C:\Cobra or /usr/local/cobra?

Re: FileNotFoundException when trying out script

PostPosted: Wed May 05, 2010 5:24 am
by Charles
Sounds fine to me. Patches welcome. I'm comfortable with the defaults so this is low priority for me. Plus it will be good practice for your first patch. :-D

Re: FileNotFoundException when trying out script

PostPosted: Wed May 05, 2010 6:03 am
by Gameday
Nice. Would it be allright if I'll make the patch in the weekend? I'm kinda swamped at work right now.
Maybe we could also do a graphical installer based on this modification :)

Re: FileNotFoundException when trying out script

PostPosted: Wed May 05, 2010 7:54 am
by Charles
No problem on the timeline.

Someone did put together a bona fide installation package in WiX or something, but I haven't had a chance to look at it. You might find it if you search around the forums.

I have to work too. :-D

Re: FileNotFoundException when trying out script

PostPosted: Wed May 05, 2010 8:02 am
by Gameday
Do you get to work with Cobra?

Re: FileNotFoundException when trying out script

PostPosted: Wed May 05, 2010 10:04 am
by Charles
I'm a contractor and my contract work includes C#, Python and Cobra. Language use varies by client and even project. In terms of working directly on Cobra, that's in my free time.