423,851 Members | 2,762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,851 IT Pros & Developers. It's quick & easy.

Python Importing Modules

P: 4
Hi
I am aruni.I have just started to use the python.I tried to import os in my program.but it is giving me an error as "no Module named OS".I thought it as similar to sys.Can anyone tell me an sugesstion.How to use the os in my python program.
Sep 14 '07 #1
Share this Question
Share on Google+
6 Replies


bvdet
Expert Mod 2.5K+
P: 2,851
Hi
I am aruni.I have just started to use the python.I tried to import os in my program.but it is giving me an error as "no Module named OS".I thought it as similar to sys.Can anyone tell me an sugesstion.How to use the os in my python program.
Python is case-sensitive:
Expand|Select|Wrap|Line Numbers
  1. >>> import OS
  2. Traceback (most recent call last):
  3.   File "<interactive input>", line 1, in ?
  4. ImportError: No module named OS
  5. >>> import os
  6. >>> os.getcwd()
  7. 'C:\\SDS2_7.0\\macro\\macrolib'
  8. >>> 
Sep 14 '07 #2

P: 4
Python is case-sensitive:
Expand|Select|Wrap|Line Numbers
  1. >>> import OS
  2. Traceback (most recent call last):
  3.   File "<interactive input>", line 1, in ?
  4. ImportError: No module named OS
  5. >>> import os
  6. >>> os.getcwd()
  7. 'C:\\SDS2_7.0\\macro\\macrolib'
  8. >>> 
Hi..
Again i am getting error.
what i have to do to avoid this.
Sep 18 '07 #3

bartonc
Expert 5K+
P: 6,596
Hi..
Again i am getting error.
what i have to do to avoid this.
small "os". Not Capital "OS".
Sep 18 '07 #4

P: 4
small "os". Not Capital "OS".

Hi
For both the os and OS i getting error.when i opened my python exe my first statement is " 'import site' failed; use _v for traceback"
Sep 19 '07 #5

P: 1
Hi aruni,

Is the issue resolved now?? Im also having same issue

'import site' failed; use -v for traceback
Traceback (most recent call last):
File "path of file", line 51, in ?
import os, os.path, subprocess, pwd, re, socket, string, sys, syslog, time, traceback,random
ImportError: No module named os
4 Weeks Ago #6

P: 3
Hi, This has been seen if you run python 2.x when you were intending to run python v3.x eg "python myfile.py" instead of "python3 myfile.py" Cheers Nigel see https://stackoverflow.com/questions/...-for-traceback
4 Weeks Ago #7

Post your reply

Sign in to post your reply or Sign up for a free account.