Shoes packager problem - ruby

I used packager to make an executable file for the following code:
Shoes.app do
stack :margin => 10 do
#edit = edit_box :width => 1.0 do
#para.text = #edit.text
end
#para = para ""
end
end
then I got error message:
Error in C:/Program Files/Common Files/Shoes/0.r1134/lib/shoes.rb line 394utf.rb: 10:
compiler error
utf.rb: 10: Invalid char '\377' in expression
utf.rb: 10: Invalid char '\337' in expression
utf.rb: 10: Invalid char '\337' in expression
utf.rb: 10: Invalid char '\331' in expression
utf.rb: 10: Invalid char '\377' in expression
utf.rb: 10: Invalid char '\270' in expression
utf.rb: 10: Invalid char '\304' in expression
Could someone give me a hand?
BR,
DorianG

Might be something here wherein saving the file in BOM-less UTF-8 is suggested.

I had similar problems, but saving in Unix format made it work for me.
Though, another problem seems to be that the packaged .exe somehow caches the code to execute. If I change the source code, run packager to recreate the exe, and then starts the exe again, nothing seems to have happened to it. Even deleting the .exe before, or moving the source to another folder doesn't seem to solve the problem.
The only solution seems to be to rename the source file. The packager then correctly creates a new .exe with the updated code.
Has anyone had problems like this, or know of a solution? Is there perhaps a temp folder where the packager stores files, which then can't be overwritten so that the "first version" is always used? I've looked into the source code of the packager, but couldn't find anything there...
Christian

I couldn't find a way to produce a working .exe too. Tried saving the source in all possible Unicode encoding variations but still nothing. Shoes r1134. I think I red somewhere this needs to be fixed in the already long awaited next Shoes release ...

I had the same issue when using vim on windows.
I found that it does work if you use notepad and save it as the default "ANSI"

I'm also getting "Invalid char '\377' in expression". I'm saving as UTF-8 (UNIX LF) so that's not the problem, it's because I'm using underscore ('_') in my app-names. Apparently you can't use the shoes-packager on files with underscore in the name which is annoying as underscore is the ruby-convention...

Related

ASCII incompatible encoding with normal run, not in debug mode

I'm really confused on this one, and maybe it's a bug in Ruby 2.6.2. I have files that were written as UTF-8 with BOM, so I'm using the following:
filelist = Dir.entries(#input_dirname).join(' ')
filelist = filelist.split(' ').grep(/xml/)
filelist.each do |indfile|
filecontents_tmp = File.read("#{#input_dirname}/#{indfile}", :encoding =>'bom|utf-8')
puts filecontents_tmp
end
If I put a debug breakpoint at the puts line, my file is read in properly. If I just run the simple script, I get the following error:
in `read': ASCII incompatible encoding needs binmode (ArgumentError)
I'm confused as to why this would work in debug, but not when run normally. Ideas?
Have you tried printing the default encoding when you run the file as opposed to when you debug the file? There are 3 ways to set / change the encoding in Ruby (that I'm aware of), so I wonder if it's different between running the file and debugging. You should be able to tell by printing the default encoding: puts Encoding.default_external.
As for actually fixing the issue, I ran into a similar problem and found this answer which said to add bin mode as an option to the File.open call and it worked for me.

How to debug `Error while processing function` in `vim` and `nvim`?

TL;DR
How to find where exactly vim or nvim error started (which file?) when I'm interested in fixing the actual issue and not just removing the bad plugin? Anything better than strace and guesswork to find the error origin?
Issue
I often add a plugin to my vim or nvim config and end up getting errors on hooks (buffer open, close, write):
"test.py" [New] 0L, 0C written
Error detected while processing function 343[12]..272:
line 8:
E716: Key not present in Dictionary: _exec
E116: Invalid arguments for function get(a:args, 'exec', a:1['_exec'])
E15: Invalid expression: get(a:args, 'exec', a:1['_exec'])
The problem is, I have no idea where those come from, only get some line number of unknown file and I know it's not my vim/nvim config file.
Somewhere, you have a plugin that has defined a dictionary with anonymous-functions (check the help related to this tag).
For the curious ones, it's done this way:
let d = {}
function! d.whatever() abort
throw "blah"
endfunction
When you execute this function, you'll get the kind of error you're currently observing. That's why I stopped working this way to prefer:
let d = {}
function s:whatever() abort
throw "blah"
endfunction
let d.whatever = function('s:whatever') " a workaround is required for older versions of vim
" At least this way I'll get a `<SNR>42_whatever` in the exception throwpoint, and thus a scriptname.
That's the why. Now, back to your problem, AFAIK, the only things you'll be able to know are the two functions that have been called:
in line 12 of :function {343}, you've called
:function {272} which contains an error at line 8.
Thanks to these two commands (may be prefixed with :verbose, I don't remember exactly), you'll get the source code of the two functions, which you should be able to use in order to grep your plugins to know where it appears.

IDL READFITS() syntax error

I'm trying to use the READFITS() function on IDL 8.3 on Mac 10.9.3
My input on the IDL promt:
readfits('image.fits',h, /EXTEN, /SILENT)
Result:
readfits('image.fits',h, /EXTEN, /SILENT)
^
% Syntax error.
*note: the '^' is below '/EXTEN'
Maybe it will help, so here is a link to the IDL help page on using READFITS() --> http://www.exelisvis.com/docs/readfits.html
I tried using the brackets like they show on that help page, but it still didn't work, so I'm stuck now. Didn't know if anyone here has experience reading .fits files in IDL.
ok, so it turns out the readfits procedure isn't included in IDL's original library, so I just had to download AstroLib (contains lots of useful astronomy procedures - including Readfits). The original syntax then worked.
I'm using IDL 8.2.2 on OS X 10.9.4.
Try keeping it simple first. Do these work?
readfits('image.fits')
readfits('image.fits', header)
Next try this:
readfits('image.fits', header, EXTEN_NO=0)
I suspect you really want extension number 0, not 1. See (e.g.) http://www.stsci.edu/documents/dhb/web/c02_datafiles.fm2.html.

Does clang allow preprocessor ==?

I am trying to compile PHP on my Mac OS X 10.8 and I am getting the following problem:
In file included from /Users/ryan/Downloads/php-5.4.5/ext/phar/util.c:23:
ext/phar/phar_internal.h:223:19: error: invalid token at start of a preprocessor
expression
# if SIZEOF_SHORT == 2
^
I'm not sure why this error is occurring as this looks fine to me. I have opened the header file and could make changes if not or remove the if all together as I know what my system should be, but I was wondering if this is the proper approach to this problem.
It looks like SIZEOF_SHORT expands to no tokens. You should investigate where SIZEOF_SHORT is being #defined (this may be on the command line via -DSIZEOF_SHORT=) and fix that to provide the right value.
Alternatively, you could use this:
#include "limits.h"
/* ... */
#if SHRT_BIT == CHAR_BIT * 2
I didn't really find a solution to this problem, but I removed the if's and left behind the line that would be processed anyway and the program compiled just fine. I really don't know what was wrong with this file.

file path error (WINDOWS) with autotest growl ( REvised)

im going through the setup on
http://www.railstutorial.org/chapters/static-pages#fig:autotest_green
and im stuck on this particular error:
ERROR READOUT: http://pastie.org/1015405
What i can see being the tell-tale issue here is the
No such file or directory - Files/rubygems-1.3.7/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb
"Program Files" has been truncated to just "Files" and hence the programs cant find what its supposed to be looking for
READOUT of pages_controller_spec.rb: http://pastie.org/1015412
Looks to me like it's an issue with a space in the filepath:
c:/Program Files/rubygems-1.3.7/rails_projects/sample_app/spec/controller s/pages_controller_spec.rb
Seems that is getting translated to
Files/rubygems-1.3.7/rails_projects/sample_app/spec/controller s/pages_controller_spec.rb
be sure to always place quotes around paths that contain a space ;)
SO i finally get what you're suggesting .. and it makes sense..
'mtime' => lambda {|file_a, file_b| File.mtime(file_b) <=> File.mtime(file_a)}
the above code is what is contained on line 7 of the "options.rb"
i tried supstituting in single as well as double quotes in the following manners:
'mtime' => lambda {|"file_a", "file_b"| File.mtime("file_b") <=> File.mtime("file_a")}
and
'mtime' => lambda {|'file_a', file_b'| File.mtime('file_b') <=> File.mtime('file_a')}
both led to new/different errors soo thats now how to do it
SADLY i think this is what i didnt want to see:
https://rspec.lighthouseapp.com/projects/5645/tickets/711-autospec-fails-when-filepaths-include-spaces

Resources