No subject

Moderator: GiD Team

Post Reply
Guest

No subject

Post by Guest »

'forward slash' and this the good way because it is cross-platform,

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,

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.



In my Python test for example this start GiD:

Import os

os.system("\"C:\\Program Files\\GiD\GiD 11.1.5d\\gid.exe\"")



but this not:

os.system("\"C:/Program Files/GiD/GiD 11.1.5d/gid.exe\"")

it raise your related error about 'Error setting environment variables'



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.

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).



Enrique



De: gidlist-bounces at listas.cimne.upc.edu
[mailto:gidlist-bounces at listas.cimne.upc.edu] En nombre de Simon Bance
Enviado el: martes, 6 de agosto de 2013 16:13
Para: gidlist at listas.cimne.upc.edu
Asunto: [GiDlist] SOLVED: GiD 11.0.4 cannot set environment variables in
batch mode (Win7x64) (Enrique Escolano)



Dear Enrique,
Thank 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.

GiD for Windows doesn?t require any environment variable.


OK thanks.... I'm glad I no longer have to worry about that.

The error is that you are trying to use as folder separator the character
?/? , but this is for Linux!! for Windows this character must be ?\?


You 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!
I always use the forward slash in such scripts because it means my scripts
will also work cross-platform including on my Linux machines.
If you don't believe me, try replacing some of your backslashes with forward
slashes on the Windows command line! :)
Also, 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.

note that gid.exe is enclosed with quotes, required in case its path has
spaces
Post Reply