471,887 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

Python Importing Modules

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
6 14873
bvdet
2,851 Expert Mod 2GB
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
aruni
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
6,596 Expert 4TB
Hi..
Again i am getting error.
what i have to do to avoid this.
small "os". Not Capital "OS".
Sep 18 '07 #4
aruni
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
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
Nov 11 '18 #6
rodnaz
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
Nov 13 '18 #7

Post your reply

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

Similar topics

4 posts views Thread by Edmond Rusjan | last post: by
10 posts views Thread by Andrew Dalke | last post: by
1 post views Thread by Sorin Schwimmer | last post: by
reply views Thread by Kurt B. Kaiser | last post: by
7 posts views Thread by brasse | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.