Forum Index > Projects > Egg-Bot
 TSP ART: SVG generating
 |  Printable Version
By: dreamhuang (offline) on Sunday, July 03 2011 @ 11:06 AM PDT (Read 5935 times)  
dreamhuang

Hi Everybody,

I am new to Egg-Bot.
I failed when I try to generate from 002.pbm to SVG

I have put concorde.exe, linkern.exe and all .py .pbm files in C:/ root

But I got this:
----------------------------
C:\Program Files\Inkscape> python\python c:\tspart.py c:\002.pbm
Loading bitmap file c:\002.pbm ... done; 5638 stipples
Writing TSP solver input file c:\002.dhwihz.tsp ... done
Running TSP solver ...

Solver finished successfully
Loading solver results from c:\002.tour ...
Traceback (most recent call last):
File "c:\tspart.py", line 269, in <module>
if not solution.load( solfile ):
File "c:\tspsolution.py", line 82, in load
f = open( infile, 'r' )
IOError: [Errno 2] No such file or directory: 'c:\\002.tour'
-----------------------------------

"c:\\002.tour" Am I need to change some path code of tspart.py and tspsolution.py

Thanks in advance!

Best,
Dream


Forum Apprentice
Apprentice


Status: offline

Registered: 07/03/11
Posts: 2

Profile Email    
   
By: dnewman (offline) on Sunday, July 03 2011 @ 11:33 AM PDT  
dnewman

You need to place tspart.py, tspbitcity,py, tspsolution.py, and 02.pbm ALL in the directory

C:\Program FIles\Inkscape\

That is, you need to have all those files in your current directory. And, since you need to be running Python from C:\Program Files\Inkscape\, that means that those files need to be in that directory. (And, I just confirmed this by doing a test run.)

The actual issue you ran across is, I believe, that 02.tour was written by Linkern to your current working directory. (I believe that on Macs and Linux, it writes it to where you tell it to but it looks as though on Windows it writes it to the current directory regardless of what it is told to do. I've not confirmed this.)

Regards,
Dan


Cow Canyon Saddle Clear Sky Chart


Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 09/08/10
Posts: 149
Mt. Baldy,
California

Profile Email    
   
By: dreamhuang (offline) on Sunday, July 03 2011 @ 01:06 PM PDT  
dreamhuang

Dear Dan,
Thanks a lot for your reply.

I have try put files in C:\Program Files\Inkscape
but still coudn't get it:

this time it try to write in "c:\docume~1\zyq\locals~1\temp\002.r5xma8.tsp ..." strange...
I am using windows.
---------------------
C:\Program Files\Inkscape> python\python tspart.py 002.pbm
Loading bitmap file 002.pbm ... done; 5638 stipples
Writing TSP solver input file c:\docume~1\zyq\locals~1\temp\002.r5xma8.tsp ...
done
Running TSP solver ...

Solver finished successfully
Loading solver results from 002.tour ...
Traceback (most recent call last):
File "tspart.py", line 269, in <module>
if not solution.load( solfile ):
File "C:\Program Files\Inkscape\tspsolution.py", line 82, in load
f = open( infile, 'r' )
IOError: [Errno 2] No such file or directory: '002.tour'


Forum Apprentice
Apprentice

Status: offline

Registered: 07/03/11
Posts: 2

Profile Email    
   
By: Lenore (offline) on Sunday, July 03 2011 @ 01:39 PM PDT  
Lenore

If you didn't restart Inkscape after placing the files in the correct location, try restarting Inkscape and trying again.


Forum Scientist
Scientist

Status: offline

Registered: 06/15/06
Posts: 55
Sunnyvale, CA

Profile Email Website  
   
By: dnewman (offline) on Sunday, July 03 2011 @ 03:55 PM PDT  
dnewman

Quote by: dreamhuang

Dear Dan,
Thanks a lot for your reply.

I have try put files in C:\Program Files\Inkscape
but still coudn't get it:

this time it try to write in "c:\docume~1\zyq\locals~1\temp\002.r5xma8.tsp ..." strange...



The script makes a Python call to get a temporary file and on your Windows machine, the TEMP environment variable must be "c:\Documents and Settings\zyq\.....". And thus, you get a temp file with that in its path.

I am using windows.



FWIW, I tested with Windows XP SP3.

---------------------
C:\Program Files\Inkscape> python\python tspart.py 002.pbm
Loading bitmap file 002.pbm ... done; 5638 stipples
Writing TSP solver input file c:\docume~1\zyq\locals~1\temp\002.r5xma8.tsp ...
done
Running TSP solver ...

Solver finished successfully



This indicates that the solver was able to read that temporary file. So that path name for the termporary file was not a problem.

Loading solver results from 002.tour ...
Traceback (most recent call last):
File "tspart.py", line 269, in <module>
if not solution.load( solfile ):
File "C:\Program Files\Inkscape\tspsolution.py", line 82, in load
f = open( infile, 'r' )
IOError: [Errno 2] No such file or directory: '002.tour'



This means that the file 002.tour could not be found in your current working directory. I suppose it's possible that when running from a terminal window you didn't have write access to that directory? You might see if you can figure out where 002.tour *did* get written. Linkern should be writing it to your current working directory, c:\Program Files\Inkscape\.

Dan


Cow Canyon Saddle Clear Sky Chart


Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 09/08/10
Posts: 149
Mt. Baldy,
California

Profile Email    
   
By: Anonymous: Sandy Noble () on Sunday, January 22 2012 @ 07:55 AM PST  
Anonymous: Sandy Noble

Sorry to resurrect an old thread, but found it via search and was frustrated by the lack of a denouement.

The problem is that windows does not let linkern write the solution file (the *.tour) file to c:/program files/inkscape/ OR c:/.

My solution is to move the three EMS tspart python files into a folder that is writable for anyone (like my documents or c:/users/whatever/) and run the command line string from there.


Cheers to Daniel Newman for these scripts and the wiki - brilliant.

Sandy Noble
www.polargraph.co.uk





       
   
By: dnewman (offline) on Thursday, January 26 2012 @ 06:37 PM PST  
dnewman

Thanks for the kind words Sandy.

Now a question for you if you don't mind: what version of Windows are you running? Sounds like it's a more recent version that actually enforces reasonable file and directory permissions (as opposed to Windows XP and earlier where generally everyone runs as an admin and can scribble most anywhere).

I'm happy to update the script now that I'm armed with your diagnosis of the problem. Thanks much for posting it!

Prost,
Dan


Cow Canyon Saddle Clear Sky Chart


Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 09/08/10
Posts: 149
Mt. Baldy,
California

Profile Email    
   
By: Anonymous: Sandy Noble () on Saturday, January 28 2012 @ 11:05 AM PST  
Anonymous: Sandy Noble

Dan, no worries, I was running here on Windows 7. I thought an elevated command prompt would let me execute scripts that write to the program files folders, but either I was being an eejit and doing it wrong, or it doesn't.


Liberty TSP by Euphy, on Flickr

Cheers!
sandy noble





       
   
By: Windell (offline) on Saturday, January 28 2012 @ 12:10 PM PST  
Windell

For the record, I would *really* love to figure out a good, automated way to start with a .jpg file and end up with a TSP output SVG. If one of you should ever have some suggestions as to how one might approach this, please let me know. Smile


Windell H. Oskay
drwho(at)evilmadscientist.com
http://www.evilmadscientist.com/

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   
By: dnewman (offline) on Saturday, January 28 2012 @ 02:30 PM PST  
dnewman

Quote by: Windell

For the record, I would *really* love to figure out a good, automated way to start with a .jpg file and end up with a TSP output SVG. If one of you should ever have some suggestions as to how one might approach this, please let me know. Smile



A couple of students did make a start at this some time back,

http://code.google.com/p/tsp-art/

What it needs is linkern put underneath it and then an SVG output module. Maybe after that, then more consideration put into how it arrives at the "cities" (stipples).

Dan


Cow Canyon Saddle Clear Sky Chart


Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 09/08/10
Posts: 149
Mt. Baldy,
California

Profile Email    
   
By: Anonymous: giorgiodidon () on Wednesday, March 07 2012 @ 05:43 AM PST  
Anonymous: giorgiodidon

hi all, read this intesting post (thanks sandy!) and if you have time and ideas please help me reading this post: http://www.polargraph.co.uk/forum/?mingleforumaction=viewtopic&t=40.0#postid-243 thank you again giorgio





       
   
By: dnewman (offline) on Wednesday, March 07 2012 @ 09:26 AM PST  
dnewman

Quote by: giorgiodidon

hi all, read this intesting post (thanks sandy!) and if you have time and ideas please help me reading this post:
http://www.polargraph.co.uk/forum/?mingleforumaction=viewtopic&amp;t=40.0#postid-243
thank you again
giorgio



Giorgio,

I'll try to look at that thread this afternoon (California time).

Ciao,
Dan


Cow Canyon Saddle Clear Sky Chart


Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 09/08/10
Posts: 149
Mt. Baldy,
California

Profile Email    
   
By: dnewman (offline) on Wednesday, March 07 2012 @ 10:43 AM PST  
dnewman

Quote by: Sandy Noble

Sorry to resurrect an old thread, but found it via search and was frustrated by the lack of a denouement.

The problem is that windows does not let linkern write the solution file (the *.tour) file to c:/program files/inkscape/ OR c:/.

My solution is to move the three EMS tspart python files into a folder that is writable for anyone (like my documents or c:/users/whatever/) and run the command line string from there.


Cheers to Daniel Newman for these scripts and the wiki - brilliant.

Sandy Noble
www.polargraph.co.uk



I've finally gotten around to uploading a solution to this. It's at the download site,

http://code.google.com/p/eggbotcode/downloads/detail?name=tsp_art_tools_0_8_3.zip

Like some of the other intermediate files, the tour file is now also written to (and later removed from), the user's temporary file directory. It's largely historical that it was written to the current working directory: I did that as it made debugging easier for me.

The final output .svg file still defaults to the current working directory. But, as you know, you can specify an explicit output file name on the command line as the final token on the command line.

Dan


Cow Canyon Saddle Clear Sky Chart


Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 09/08/10
Posts: 149
Mt. Baldy,
California

Profile Email    
   
By: dnewman (offline) on Wednesday, March 07 2012 @ 11:01 AM PST  
dnewman

Quote by: giorgiodidon

hi all, read this intesting post (thanks sandy!) and if you have time and ideas please help me reading this post:
http://www.polargraph.co.uk/forum/?mingleforumaction=viewtopic&amp;t=40.0#postid-243
thank you again
giorgio



Okay, here's my input for what it may be worth.


hi all, i'm hving problems with TSP:
i've installed everything following evilmad wiki instruction, but if i run linkern.ee from c: root it says it cannot found cygwin1.dll (i installed cygwin packet from here: http://cygwin.com/ running setup.exe)
any help!?



You cannot launch linkern.exe with a double click. You need to make a DOS window (looks like a terminal window), and from there navigate to the disk and directory with linkern.exe, and then type "linkern" to test run the executable. If doing that gives you missing DLL errors, then there's an issue with the environment variables set for your system. (Cygwin should have set up the ones it needed.)


C:\Program Files\Inkscape>python\python C:\tspart.py --solver=c:\cygwin\bin\ C:\
dida1.pbm
Loading bitmap file C:\dida1.pbm ... done; 22293 stipples
Writing TSP solver input file C:\dida1.ol4o_b.tsp ... done
Running TSP solver ...
Traceback (most recent call last):
File "C:\tspart.py", line 253, in <module>
pipe = subprocess.Popen( cmd, shell=use_shell )
File "C:\Program Files\Inkscape\python\lib\subprocess.py", line 633, in __init
__
errread, errwrite)
File "C:\Program Files\Inkscape\python\lib\subprocess.py", line 842, in _execu
te_child
startupinfo)
WindowsError: [Error 5] Accesso negato



Fun seeing an Italian error message. While my Italian is rusty, I'm sure that's an "Access Denied" error. That error is coming from Python trying to run the command,

LINKERN -r <runs> -o <solution-file> <tsp-file>

where "LINKERN" is the full path to linkern.exe. However, for --solver, you only supplied the name of the directory where linkern.exe resides. Instead, you must specify the entire file path,

--solver c:\cygwin\bin\linkern.exe

(The confusion is that you specified only a directory path.) Hope this helps you get going.

Regards,
Dan


Cow Canyon Saddle Clear Sky Chart


Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 09/08/10
Posts: 149
Mt. Baldy,
California

Profile Email    
   
By: Anonymous: giorgiodidon () on Saturday, March 10 2012 @ 09:41 AM PST  
Anonymous: giorgiodidon

dan, it's done!
the problem was in linkern.exe path!!

thanks a lot
giorgio





       
   



 All times are PDT. The time is now 07:07 PM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to Post 
Filtered HTML Allowed 
Censored Content 

Evil Mad Scientist Forum Archives — Read only!

Please visit our new forums for new discussions.


DIY Hardware for Electronic Art


The Original Egg-Bot Kit


Octolively
Interactive LED kits


Meggy Jr RGB
LED matrix game
development kit.


Business-card sized
AVR target boards


Peggy 2
LED Pegboard kits

My Account






Lost your password?