Forums

Hello World error

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

Hello World error

Postby cobra2010 » Sun Aug 14, 2011 9:39 pm

Trying to run
class Hello 
def main
print 'Hello, world.'

and get this error:

c:\Cobra\bin\cobra.bat c:/code/cobra/hello_world.cobra

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e' or one of its dependencies. The system cannot find the file specified.
File name: 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e'
at Hello.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].
cobra2010
 
Posts: 5

Re: Hello World error

Postby hopscc » Mon Aug 15, 2011 12:05 am

Your built (HelloWorld) .exe file cant find the Cobra runtime Library either because you did not install Cobra ( so the Cobra Runtime is in the GAC where .Net looks for libraries by default) or a copy of Cobra.Lang.dll is not in the same working directory as the built .exe

See wiki:Troubleshooting - fourth item down
'System.IO.FileNotFoundException: Could not load file or assembly 'Cobra.Lang'
There's also a couple of Forum postings on the same topic
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Hello World error

Postby Charles » Mon Aug 15, 2011 2:02 am

If you still need help after Hopscc hints and looking at Troubleshooting, let us know and include more information.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Hello World error

Postby cobra2010 » Mon Aug 15, 2011 1:47 pm

Thanks for the replies.

C:\Interpreters\Cobra-2010-10-18>\cobra\bin\cobra.bat --version
0.8.0 post-release

hopscc wrote:Your built (HelloWorld) .exe file cant find the Cobra runtime Library either because you did not install Cobra ( so the Cobra Runtime is in the GAC where .Net looks for libraries by default) or a copy of Cobra.Lang.dll is not in the same working directory as the built .exe

See wiki:Troubleshooting - fourth item down
'System.IO.FileNotFoundException: Could not load file or assembly 'Cobra.Lang'
There's also a couple of Forum postings on the same topic


What I did was download a Cobra zip file and extract the files to a directory.
Looking at the ReadMe.text file I was told to:
On Windows you will need Microsoft .NET 2.0 or higher.

From the command line:
cd Source
install-from-workspace


Which came back and had some message with Success and an exclamation point in it.

From those terse instructions followed by a success message, followed by simple instructions on how to run the Cobra program, it would seem that the Cobra installation process and/or run process has glitches. It doesn't seem right that I would have - not installed Cobra - and yet be given a success message with respect to the installation process. Also, in relooking at the ReadMe.text file I don't see any instructions to place the file Cobra.Lang.dll in the same directory as the .exe file or vice versa - if that is the case - it needs to be added to the ReadMe.text file.
cobra2010
 
Posts: 5

Re: Hello World error

Postby Charles » Mon Aug 15, 2011 2:15 pm

You don't generally need to put the Cobra.Lang.dll file anywhere because it gets installed.

I agree that there should be no glitches and that is what we strive for.

Can you install again, post all the output from the installation here, and try to run your program again?

Also, I still need to know the version of Windows and whether it is 32-bit or 64-bit.

We rely on feedback like this to improve the installer.

Finally, you may be interested to install from the latest source to see how that goes.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Hello World error

Postby cobra2010 » Mon Aug 15, 2011 2:49 pm

I am using 64-bit Windows 7 Home Premium with Service Pack 1, with the full .NET Framework 4.0.

What do I need to do to uninstall the current installation?
cobra2010
 
Posts: 5

Re: Hello World error

Postby Charles » Mon Aug 15, 2011 4:19 pm

We don't have an uninstaller at this point. You can just run the current installer again.

If afterwards you see an extra, older directory in C:\Cobra, you can remove it.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Hello World error

Postby cobra2010 » Tue Aug 16, 2011 10:05 am

Charles wrote:We don't have an uninstaller at this point. You can just run the current installer again.

If afterwards you see an extra, older directory in C:\Cobra, you can remove it.


I redownloaded, reextracted, and reinstalled.


In looking at C:\Cobra

I now see:
Directory of C:\Cobra

08/16/2011 09:04 AM <DIR> .
08/16/2011 09:04 AM <DIR> ..
08/14/2011 08:44 PM <DIR> bin
08/16/2011 09:04 AM <DIR> Cobra-0.8.0-post
0 File(s) 0 bytes
4 Dir(s) 198,332,940,288 bytes free

I am getting the same error trying to run Hello World.

It won't let me upload an attachment - says the extensions .txt, .rtf. .doc, and .pdf are not allowed.
Will try and post the install output in a reply to this post.
cobra2010
 
Posts: 5

Re: Hello World error

Postby cobra2010 » Tue Aug 16, 2011 10:09 am

If you are on Windows Vista and you get an error message then
you may need to run with elevated privileges, such as with an
admin account or power user account.

Compiling installation program...

The Cobra Programming Language
Install From Workspace

Working...

==== Verify installation directory

found dir: C:\Cobra

==== Verify running in workspace

Verified.

==== Locate and test Cobra Snapshot compiler

run: Snapshot\cobra.exe -about
: The Cobra Programming Language 0.8.0 post-release
: Copyright (C) 2003-2011 by Cobra Language LLC. All Rights Reserved.
:
: On the web: http://Cobra-Language.com/
: License: http://www.opensource.org/licenses/mit-license.php
: Source: http://cobra-language.com/source/
: Support: http://cobra-language.com/trac/cobra/wiki/UserSupport
:
: Usage: cobra -h

==== Build new Cobra compiler

run: Snapshot\cobra.exe -compile -turbo -ert:yes cobra.cobra -files:files-to-compile.text
: Compilation succeeded

==== Retrieve Cobra base version number

run: cobra.exe -version
: 0.8.0 post-release

base version: 0.8.0-post

==== Build Cobra standard library

run: cobra.exe -bsl -turbo Cobra.Lang\AssemblyAttrs.cobra -key-file:Cobra.Lang\Cobra.Lang.snk
: Compilation succeeded

==== Verify newly built Cobra compiler

run: cobra.exe -about
: The Cobra Programming Language 0.8.0 post-release
: Copyright (C) 2003-2011 by Cobra Language LLC. All Rights Reserved.
:
: On the web: http://Cobra-Language.com/
: License: http://www.opensource.org/licenses/mit-license.php
: Source: http://cobra-language.com/source/
: Support: http://cobra-language.com/trac/cobra/wiki/UserSupport
:
: Usage: cobra -h

run: cobra.exe -ert:no hello
: Hello, world.

run: cobra.exe -ert:yes hello
: Hello, world.

run: cobra.exe hello
: Hello, world.

==== Install Cobra standard library to the GAC

Invoking Publish.GacInstall...
Done.

==== Copy files to install directory

found dir: C:\Cobra
del dir : C:\Cobra\Cobra-0.8.0-post
make dir : C:\Cobra\Cobra-0.8.0-post
run: svn info

"svn info" failed. Check your svn installation.
svn: '.' is not a working copy

** WARING: Cannot find version information, svn command line version not installed or failed.
writing : C:\Cobra\Cobra-0.8.0-post\Version.text

copy from: C:\Interpreters\Cobra\Cobra-2010-10-18\HowTo
to: C:\Cobra\Cobra-0.8.0-post\HowTo
copy from: C:\Interpreters\Cobra\Cobra-2010-10-18\Reusables
to: C:\Cobra\Cobra-0.8.0-post\Reusables
copy from: C:\Interpreters\Cobra\Cobra-2010-10-18\Samples
to: C:\Cobra\Cobra-0.8.0-post\Samples
copy from: C:\Interpreters\Cobra\Cobra-2010-10-18\Supplements
to: C:\Cobra\Cobra-0.8.0-post\Supplements
make dir : C:\Cobra\Cobra-0.8.0-post\bin
copy bin: C:\Cobra\Cobra-0.8.0-post\bin
copy from: Cobra.Lang
to: C:\Cobra\Cobra-0.8.0-post\bin\Cobra.Lang
found dir: C:\Cobra\bin
writing : C:\Cobra\bin\cobra.bat

==== Verify newly installed Cobra compiler

run: C:\Cobra\bin\cobra.bat -about
: The Cobra Programming Language 0.8.0 post-release
: Copyright (C) 2003-2011 by Cobra Language LLC. All Rights Reserved.
:
: On the web: http://Cobra-Language.com/
: License: http://www.opensource.org/licenses/mit-license.php
: Source: http://cobra-language.com/source/
: Support: http://cobra-language.com/trac/cobra/wiki/UserSupport
:
: Usage: cobra -h

run: C:\Cobra\bin\cobra.bat -ert:yes hello
: Hello, world.

==== Clean up workspace

run: Snapshot\cobra.exe -compile -debug -ert:yes cobra.cobra -files:files-to-compile.text
: Compilation succeeded

run: cobra.exe -bsl -debug
: Compilation succeeded

==== Install "cobra" into a system path directory


The Cobra compiler is not in your PATH. To remedy you can:
1. Add C:\Cobra\bin to your PATH
2. Copy C:\Cobra\bin\cobra.bat to any directory in your PATH

Success!
cobra2010
 
Posts: 5

Re: Hello World error

Postby Charles » Tue Aug 16, 2011 3:39 pm

Thanks. I don't see anything wrong here. Can you try the latest from Source and see if it behaves any differently?

http://cobra-language.com/trac/cobra/wiki/HowToInstallFromSource
Charles
 
Posts: 2515
Location: Los Angeles, CA

Next

Return to Discussion

Who is online

Users browsing this forum: No registered users and 9 guests

cron