Dumb question on converting models with python

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
hangar18
Competent
Competent
Posts: 45
Joined: Sun Sep 04, 2011 9:10 am

Dumb question on converting models with python

Post by hangar18 »

I'm new to Python and wanted to converted a dat file back to obj so I can manipulate in wings. However, I cant even get python to work lol. Have downloaded v3.3 for Windows and at the command prompt typed (as per the model converter sticky)

>>> python c:\python33\progs\Obj2DatTex.py c:\python33\models\Cobra3.dat

But get a syntax error. Both Obj2DatTex.py and Cobra3.dat are saved in the directories outlined. What am I doing wrong?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Dumb question on converting models with python

Post by Thargoid »

You need python v2.5 or 2.6. The scripts don't work with 3.x.

Then just call them from a DOS prompt with the DAT filename as a parameter. Don't use a python console window for it.
Last edited by Thargoid on Thu May 02, 2013 6:29 am, edited 1 time in total.
hangar18
Competent
Competent
Posts: 45
Joined: Sun Sep 04, 2011 9:10 am

Re: Dumb question on converting models with python

Post by hangar18 »

Thanks, I'll install v2.6.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Dumb question on converting models with python

Post by Svengali »

Obj2DatTexNorm.py requires v2.7 (see Model converter utilities)
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Dumb question on converting models with python

Post by Diziet Sma »

<wonders if perhaps it's time all the scripts were updated to work with 3.x>
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: Dumb question on converting models with python

Post by Tricky »

Diziet Sma wrote:
<wonders if perhaps it's time all the scripts were updated to work with 3.x>
.oO(wonders if the command 2to3 will do the job)
hangar18
Competent
Competent
Posts: 45
Joined: Sun Sep 04, 2011 9:10 am

Re: Dumb question on converting models with python

Post by hangar18 »

Sorry guys am stuck...

I tried typing in a dos command box

python c:\python27\progs\Obj2DatTex.py c:\python27\models\Cobra3.dat

But get a syntax error of 'python is not recognizable command'. So I then tried....

c:\python\python.exe

and got a >>> prompt. Progress I thought...but

c:\python27\progs\Obj2DatTex.py c:\python27\models\Cobra3.dat

an invalid syntax response at the "c:" bit I tried putting python before the c:\ with a space but no joy

What am I doing wrong?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6627
Joined: Wed Feb 28, 2007 7:54 am

Re: Dumb question on converting models with python

Post by another_commander »

hangar18 wrote:
Sorry guys am stuck...

I tried typing in a dos command box

python c:\python27\progs\Obj2DatTex.py c:\python27\models\Cobra3.dat

But get a syntax error of 'python is not recognizable command'. So I then tried....

c:\python\python.exe

and got a >>> prompt. Progress I thought...but

c:\python27\progs\Obj2DatTex.py c:\python27\models\Cobra3.dat

an invalid syntax response at the "c:" bit I tried putting python before the c:\ with a space but no joy

What am I doing wrong?
The folder containing python.exe must be in your command search path. For example, if your python installation is at C:\python and the python executable is C:\python\python.exe, then you can do it by:
1. Starting up a command console window and
2. Typing in path=%path%;c:\python
Then just use the commands as you originally tried and this time you should be able to execute python.exe.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Dumb question on converting models with python

Post by Svengali »

Obj2DatTex.py expects a .obj + .mtl.
To convert back you need Dat2ObjTex.py. This should work via drag&drop (if your Python installer has set the Pathes correctly - see another_commanders post)
hangar18
Competent
Competent
Posts: 45
Joined: Sun Sep 04, 2011 9:10 am

Re: Dumb question on converting models with python

Post by hangar18 »

Many thanks gents!
Post Reply