Forums

FileNotFoundException when trying out script

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

FileNotFoundException when trying out script

Postby Gameday » Mon May 03, 2010 11:11 am

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.
Gameday
 
Posts: 27

Re: FileNotFoundException when trying out script

Postby Charles » Mon May 03, 2010 12:06 pm

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\).
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: FileNotFoundException when trying out script

Postby Gameday » Mon May 03, 2010 12:14 pm

That did the trick. Thank you very much!
Gameday
 
Posts: 27

Re: FileNotFoundException when trying out script

Postby Charles » Mon May 03, 2010 2:55 pm

You're welcome.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: FileNotFoundException when trying out script

Postby Gameday » Wed May 05, 2010 4:49 am

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?
Gameday
 
Posts: 27

Re: FileNotFoundException when trying out script

Postby Charles » Wed May 05, 2010 5:24 am

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
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: FileNotFoundException when trying out script

Postby Gameday » Wed May 05, 2010 6:03 am

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 :)
Gameday
 
Posts: 27

Re: FileNotFoundException when trying out script

Postby Charles » Wed May 05, 2010 7:54 am

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
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: FileNotFoundException when trying out script

Postby Gameday » Wed May 05, 2010 8:02 am

Do you get to work with Cobra?
Gameday
 
Posts: 27

Re: FileNotFoundException when trying out script

Postby Charles » Wed May 05, 2010 10:04 am

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.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 30 guests