So, even thou I have searched throughout the forums, I couldn't get a clear answer, maybe perhaps I'm a noob @ Python.
As a beginner, I don't know much about Python, and it's frustrating to search the net and not find the actual answer.
So, I'm working on this project, and I stumbled upon this thing:
what I want to to is to open the command line(I'm working in Windows 7 ultimate) from a Python file, change the directory, of whatever is there, like, from the start cd c:\\ to the actual c: directory.
Next step comes from the user, meaning, there is an input, which requires the user to enter a path, like Users\Admin\Python27 for example.
Ok, but my problem is that I can't actually get the rite path for the cmd to access it.
To make it more clear, I'm working on the py2exe convertor, which will convert files from .py to .exe
Ok, and in this process there is a file setup.py, which holds the name of the desired .py module which the user wants to convert to .exe
What I'm trying to do is to make another module .py which will do the thing of inputing the name of the module, such as accessing that module throughout python.exe so that with 1 file access, 1 name and 1 path to actual make the convertion.
I don't know if I made myself clear. So, I need help.
Below is my code from the Start.py module, which I intend to make the things described above.
'''
Created on Feb 16, 2012
@author: sin
'''
import time
import os
import sys
n = raw_input("Name of the program: ")
p = raw_input("Name the path of your Python installer: ")
print p
time.sleep(1)
filename = 'setup1.py'
fh = open(filename, 'w')
fh.write("""from distutils.core import setup
import py2exe
setup(console=[""" + "'" + str(str(n) + '.py') + "'" + "])")
print "setup(console=[" + "'" + str(str(n) + '.py') + "'" + "])"
fh.close()
print "Your file was added"
time.sleep(2)
print "Preparing opening the command line"
time.sleep(2)
print "Accessing the command line"
time.sleep(2)
sys.path.insert(0, p)
os.system('cd c:\\')
time.sleep(1)
os.system('cd ' + str(p))
time.sleep(1)
os.system('setup1.py py2exe')
I keep getting this error:
The system cannot find the path specified.