<div dir="ltr">I&#39;m not sure this is the right place for your question, but check how you capitalised &quot;filename&quot; - in one case you used &quot;fileName&quot; and then called &quot;print filename&quot; - because it is all lowercase this variable is undefined, can&#39;t be printed, and you get an error.&nbsp; You would probably have better luck posting this kind of question on a python support forum (e.g. <a href="http://bytes.com">http://bytes.com</a>).<br>
<br><div class="gmail_quote">On Mon, Jul 21, 2008 at 3:38 PM, suhail shaik &lt;<a href="mailto:suhailsqm@gmail.com">suhailsqm@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">hi ...<br><br>##################<br>#!/usr/bin/python<br>#Globals here<br>ROOTDIR = &quot;/home/qmss2/Desktop/sbd/hive2_ffmpegsvn/&quot; # Root dir where ts files are located (or recorded)<br>PNAME = &quot;/data/test/&quot;<br>

#DAILY_UPLOAD_PATH = &quot;/mmis-ss9952/newsroom/du-dev/&quot;<br><br>import os,glob<br>### MAIN ###<br>os.chdir(ROOTDIR)<br>os.mkdir(&quot;kf&quot;)<br>os.chdir(PNAME)<br>for fileName in glob.glob(&#39;*.mpg&#39;):<br>&nbsp;&nbsp;&nbsp; print filename<br>

&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; file = fileName.split(&quot;.&quot;)<br>&nbsp;&nbsp;&nbsp; print file<br>&nbsp;&nbsp;&nbsp; os.chdir(ROOTDIR+&quot;/kf&quot;)<br>&nbsp;&nbsp;&nbsp; os.mkdir(file)<br>&nbsp;&nbsp;&nbsp; command = &quot;./hive2 -k kf/&quot;+file+&quot;/ -o &quot;+file+&quot;.xml /data/test/&quot;+fileName<br>

&nbsp;&nbsp;&nbsp; print command<br>&nbsp;&nbsp;&nbsp; os.system(command)<br><br>#################<br><br>i get the following error...<br><br>File &quot;/home/qmss2/Desktop/sbd/mpg.py&quot;, line 13, in &lt;module&gt;<br>&nbsp;&nbsp;&nbsp; print filename<br>NameError: name &#39;filename&#39; is not defined<br>

<br><br>Please suggest me i am trying to read all the .mpg files from a directory..<br><br>thanks in advance ...please urgent help..<br><br><br><br></div>
<br>_______________________________________________<br>
python-uk mailing list<br>
<a href="mailto:python-uk@python.org">python-uk@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-uk" target="_blank">http://mail.python.org/mailman/listinfo/python-uk</a><br>
<br></blockquote></div><br></div>