Hologram
-
have a look at Dan's
[Plugin] Hypocycloid Cam Profile Generator v1.0.0 http://sketchucation.com/forums/viewtopic.php?p=470834#p470834
it was based on a python [py/dxf] script that I couldn't get to run...
he reworked it to SU ruby, may be a simpler approach...john
-
I'm no expert on 'python' but isn't the cmd code more like this:
path_to_py argument(s)
Also have you got 'python' set up right in cmd window ?
ftype Python26.File="C:\Python26\python.exe" "%1" %
assoc .py=Python26.File*AND then run it...
IO.popen('"'+PYTHON_PATH+"\\draw_pattern.py+'" "'+base_dir+"\\"+proposal+'"')
OR
**system**('"'+PYTHON_PATH+"\\draw_pattern.py+'" "'+base_dir+"\\"+proposal+'"')
OR perhaps the .py part can't be inside "" ?
Read this about file associations... http://eli.thegreenplace.net/2010/12/14/problem-passing-arguments-to-python-scripts-on-windows/
-
Error Loading File solid_pattern.rb C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229; syntax error, unexpected $undefined, expecting ')' ...w_pattern.py+'" "'+base_dir+"\\"+proposal+'"') ^ C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229; unterminated string meets end of file C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229; syntax error, unexpected $end, expecting kEND
-
My typo !
2 missing characters...
Try:IO.popen('"'+PYTHON_PATH+"\\%(#0000FF)["+]draw_pattern.py+'" "'+base_dir+"\\"+proposal+'"')
If you view your code in Notepad++ with suitable RB syntax coloring it's clearly wrong...
-
@tig said:
If you view your code in Notepad++
I use PSPad. I install Notepad++.
Finished exporting vertex data. Running python script... Error; #<NameError; undefined local variable or method `draw_pattern' for main;Object> C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern' C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
-
Try this:
d = IO.popen('"'+PYTHON_PATH%(#0000BF)[+"\\draw_pattern.py "+]base_dir+"\\"+proposal+'"')
I misunderstood, there is no 'draw_pattern' variable ! -
Finished exporting vertex data. Running python script... Error; #<Errno;;EINVAL; Invalid argument - "C;\Python27\draw_pattern.py C;\Documents and Settings\Administrator\My Documents\Untitled.pattern"> C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `popen' C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern' C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
-
I weary... try...
d = IO.popen('"'+PYTHON_PATH+'\draw_pattern.py" "'+base_dir+'"\\"+proposal+'"')
So many permutations... -
@tig said:
I weary
Error Loading File solid_pattern.rb C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;230; syntax error, unexpected tCONSTANT, expecting ')' puts "Data export done. Python results w... ^ C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;237; syntax error, unexpected tIDENTIFIER, expecting kEND if(file_loaded("solid_pattern.rb")) ^ C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;238; syntax error, unexpected tCONSTANT, expecting kEND menu = UI.menu("Plugins"); ^ C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239; syntax error, unexpected tCONSTANT, expecting kEND menu.add_item("Make Solid Scratch Pattern...") { ExportPattern() } ^ C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;243; syntax error, unexpected tIDENTIFIER, expecting kEND file_loaded("solid_pattern.rb") ^ C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;243; unterminated string meets end of file C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;243; syntax error, unexpected $end, expecting kEND
-
I must sleep now...
BUT I think this is it...
d = IO.popen('"'+PYTHON_PATH+'\draw_pattern.py" "'+base_dir+proposal+'"')
-
Nothing worked out, did it?
Finished exporting vertex data. Running python script... Error; #<Errno;;ENOEXEC; Exec format error - "C;\Python27\draw_pattern.py" "C;\Documents and Settings\Administrator\My DocumentsUntitled.pattern"> C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `popen' C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;229;in `ExportPattern' C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
-
I assume the .py and .pattern files exist ?
Try this instead - there was a missing\
before 'proposal
':
d = system('"'+PYTHON_PATH+'\draw_pattern.py" "'+base_dir%(#0000FF)[+"\\"]+proposal+'"')
If you paste this into a Windowscmd
window [including the"
s] does it work ?
"C:\Python27\draw_pattern.py" "C:\Documents and Settings\Administrator\My Documents%(#0000FF)[\]**Untitled**.pattern"
- substitute the**Untitled**
with another name if appropriate... -
Finished exporting vertex data. Running python script... Data export done. Python results will appear as soon as they are completed Error; #<NoMethodError; private method `gets' called for false;FalseClass> C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;231;in `ExportPattern' C;/Program Files (x86)/Google/Google SketchUp 8/Plugins/solid_pattern.rb;239
http://www.screencast.com/t/lDjsrKcXTb
-
So it's working, sort of...
d
is set to the result of thesystem
call...
Then if fails at:
while d.gets != nil puts d.gets end
Because 'd
' is 'false
' !
Why no add aputs d
just after thesystem
call to see what you are getting...
I suspect it'll NOT be complex data - just success/failure true/false ??Also in the screen-cast the
.py
extension was not recognized as being associated with Python !
Go back a few posts to see my advice and the links etc, on ensuring this is set up correctly...Also in the screen-cast the file was named
Untitled.pattern**abc**
?
Why the extra characters ?When you run the
.py
what do you expect ?
If it's 'data' then I suggest you get the.py
to write it into to a [temporary] file then useIO.read
on it in Ruby to get that data...
You might need to add asleep
and test for the existence of that file before usingIO
, as once you launch the Python process it will run separately from the Ruby side... -
on mac if you drag a file to the 'cmd promt ' [i.e. Terminal.app], you get the correctly escaped full path...
you can then either harcode that path for a test or change the
system
call toputs
to see if they match...does that work on a PC?
john
-
@unknownuser said:
Also in the screen-cast the file was named Untitled.patternabc ?
I wrote it in SU in that plugin window. I know, it makes no sense, I've changed the extension. But when I kept the same name and extension the result was the same.
Robert
-
So is it an error in your .file ?
Advertisement