No subject

Moderator: GiD Team

Guest

No subject

Postby Guest » Thu Jul 18, 2013 9:23 am

working directories to contain no spaces in their path, thus circumventing
this problem from the start. I recommend that all people do this because it
is just good practice.

and ?batch.bch? is a relative path, you can set the full path or the current
folder must be path that contain ?batch.bch?


My .bch file is already specified by the full path, I just left it out in my
first email because I knew it wasn't the problem.

e.g. if this file is located in ?C:\temporary file\batch.bch? could use

os.chdir(?C:\\temporary file?)

os.system(command)


In the end I fixed my problem by changing directory to the GiD11 folder and
specifying just gid.exe in my call command. If you do this don't forget to
specify your script path in full.

Thanks again for the help. I hope my followup will be of value to the GiD
community.
Best wishes
Simon


------=_NextPart_000_00C8_01CE92C5.8B8365E0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"headmeta =
http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii"meta name=3DGenerator content=3D"Microsoft Word 14 =
(filtered medium)"style!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EstiloCorreo17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--/style!--[if gte mso 9]xml
o:shapedefaults v:ext=3D"edit" spidmax=3D"1026"
/xml![endif]--!--[if gte mso 9]xml
o:shapelayout v:ext=3D"edit"
o:idmap v:ext=3D"edit" data=3D"1"
/o:shapelayout/xml![endif]--/headbody lang=3DES link=3Dblue =
vlink=3Dpurplediv class=3DWordSection1p class=3DMsoNormalspan =
lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'More comments about this topic.o:p/o:p/span/pp =
class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'o:p /o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'Windows accepts ‘Linux like forward slash’ but only =
sometimes, not everywhere, and not all Windows versions =
!!o:p/o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'From Python scripts, like Tcl/Tk scripts, in general you can (and =
must) use ‘forward slash’ and this the good way because it =
is cross-platform, o:p/o:p/span/pp class=3DMsoNormalspan =
lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'but this is because Python handle it internally. In case of use =
os.sytem(command) you are lefting Python an the ‘command’ is =
interpreted by the operating system, not by Python, =
o:p/o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'then this ‘command’ is not cross-platform and you can =
only use valid shell commands and with its valid syntax: appropriated =
slash separator, Linux is case sensitive for filenames, =
etc.o:p/o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'o:p /o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'In my Python test for example this start GiD:o:p/o:p/span/pp =
class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'Import oso:p/o:p/span/pp class=3DMsoNormalspan =
lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'os.system("\"C:\\Program Files\\GiD\GiD =
11.1.5d\\gid.exe\"")o:p/o:p/span/pp =
class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'o:p /o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'but this not:o:p/o:p/span/pp class=3DMsoNormalspan =
lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'os.system("\"C:/Program Files/GiD/GiD =
11.1.5d/gid.exe\"")o:p/o:p/span/pp =
class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'it raise your related error about ‘Error setting environment =
variables’o:p/o:p/span/pp class=3DMsoNormalspan =
lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'o:p /o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'About working in folders without spaces, I recommend you as developer =
to work in a folder with spaces (and also with NON-latin names like =
Japanese characters) to know and fix all problems and create a more =
robust code.o:p/o:p/span/pp class=3DMsoNormalspan =
lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'GiD itself can work without problem if the folder has spaces (by =
default it is installed on Windows in ‘Program files’ that =
has an space).o:p/o:p/span/pp class=3DMsoNormalspan =
lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'o:p /o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'Enriqueo:p/o:p/span/pp class=3DMsoNormalspan lang=3DEN-US =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'o:p /o:p/span/pp class=3DMsoNormalspan =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'De:/span/=
bspan style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' =
gidlist-bounces at listas.cimne.upc.edu =
[mailto:gidlist-bounces at listas.cimne.upc.edu] [b]En nombre de
Simon =
BancebrEnviado el: martes, 6 de agosto de 2013 =
16:13brPara: gidlist at listas.cimne.upc.edubrAsunto: =
[GiDlist] SOLVED: GiD 11.0.4 cannot set environment variables in batch =
mode (Win7x64) (Enrique Escolano)o:p/o:p/span/pp =
class=3DMsoNormalo:p /o:p/pdivp class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'Dear Enrique, brThank you very much for =
your thoughtful response. I think I have fixed the problem with your =
help but I would like to discuss it further in order to help other =
people who may have similar problems in the future. I disagree with some =
of the things you said. o:p/o:p/pp class=3DMsoNormalGiD for =
Windows doesn?t require any environment variable.o:p/o:p/pdivp =
class=3DMsoNormal style=3D'margin-bottom:12.0pt'brOK thanks.... I'm =
glad I no longer have to worry about that. o:p/o:p/pp =
class=3DMsoNormalThe error is that you are trying to use as folder =
separator the characterbr?/? , but this is for Linux!! for Windows =
this character must be ?\?o:p/o:p/pdivp class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'brYou are correct that the forward =
slash is used by Linux and the backward slash by Windows but actually =
Windows has no trouble interpreting both correctly! brI always use the =
forward slash in such scripts because it means my scripts will also work =
cross-platform including on my Linux machines. brIf you don't believe =
me, try replacing some of your backslashes with forward slashes on the =
Windows command line! :)  brAlso, having to use the backslash =
when defining paths in Python would be hassle because, like you said, =
every single one must be escaped using a double slash and could not be =
simply copied from Windows Explorer, for example. o:p/o:p/pp =
class=3DMsoNormalnote that gid.exe is enclosed with quotes, required in =
case its path hasbrspaceso:p/o:p/pdivp class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'brFrom previous experiences working on =
these types of problems I set up my working directories to contain no =
spaces in their path, thus circumventing this problem from the start. I =
recommend that all people do this because it is just good =
practice.o:p/o:p/pblockquote =
style=3D'border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm =
6.0pt;margin-left:4.8pt;margin-right:0cm'p class=3DMsoNormaland =
?batch.bch? is a relative path, you can set the full path or the =
currentbrfolder must be path that contain =
?batch.bch?o:p/o:p/p/blockquotedivp class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'brMy .bch file is already specified by =
the full path, I just left it out in my first email because I knew it =
wasn't the problem. o:p/o:p/pp class=3DMsoNormale.g. if this =
file is located in ?C:\temporary file\batch.bch? could =
usebrbros.chdir(?C:\\temporary =
file?)brbros.system(command)o:p/o:p/pdivp =
class=3DMsoNormalbrIn the end I fixed my problem by changing =
directory to the GiD11 folder and specifying just gid.exe in my call =
command. If you do this don't forget to specify your script path in =
full. brbrThanks again for the help. I hope my followup will be of =
value to the GiD community. brBest =
wishesbrSimono:p/o:p/p/body=
/html
------=_NextPart_000_00C8_01CE92C5.8B8365E0--

Return to “2013 - 2005”

Who is online

Users browsing this forum: No registered users and 5 guests