473,378 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Module faled on school computers [solved]

23
I got my teacher to intall python on one of the computers, but python doesn't seem to want to compile modules. I used the same code I use at home, but I get

ImportError: No module named password

or something like that. Might this have something to do with some of the ungodly settings schools use to lock down computers? Or is there something else I'm missing?
Sep 22 '06 #1
8 1635
bartonc
6,596 Expert 4TB
password doesn't seem to be a library module in windows.
Maybe it's in you personal stuff in a folder in the sys.path?

import sys
print sys.path

or it could be in Lib\site-packages folder.
Sep 23 '06 #2
Bellum
23
Password is another part of the program I'm writing in the same folder, which is like 'Python Programs' or something on the desktop. From what I've seen so far, Python should automatically compile that and use it, right? That's what it does on my computer. D:
Sep 23 '06 #3
bartonc
6,596 Expert 4TB
type
import sys
print sys.path

if the folder you are working in isn't in there you can insert it like this:

sys.path.insert(0, r"D:\My Documents\Python\database")

or you can set an environment variable (advanced windows topic) called
PYTHONPATH which points to you folder

or you can save a file with the .pth extension somewhere where Python look by default with a path name in it.
Sep 23 '06 #4
Bellum
23
Hmm, thanks. I suppose I should be doing that all the time, if that's the proper way to go about it. D: I'll reserve all my thinking for tomorow. 'Tis late.

But, yeah, thanks for the help. I think I should read that section again.
Sep 23 '06 #5
bartonc
6,596 Expert 4TB
Also, if you use IDLE as your editor, when your choose Run>Run Module (F5)from the menu, IDLE automatically inserts the path of the file that you are running.
Sep 23 '06 #6
Bellum
23
UPDATE: Ok, it's Monday. I tried sys.path.append('blahblah'), which added the directory, but still didn't help create the module.


Also, sys.path doesn't show the the path on my computer, either, though the program I'm importing (or really a library of functions) is in the same folder. This isn't any different than on the school computer...

I'll remember the sites URL tomorrow (or the day after, which seems more likely) so I can try out your other suggestions. (I'm using PythonWin)
Sep 25 '06 #7
bartonc
6,596 Expert 4TB
It turns out that PythonWin doesn't insert the current working directory into sys.path but works anyway. Here's what did:

File>New
Python Script <OK>

print "hello"

File>Save
My Documents/Python
Script1.py

File>New
Python Script <OK>

import Script1

File>Save
My Documents/Python
Scrip2.py

File>Run...
D:\My Documents\Python\Script2.py <OK>

Then switch to Interactive Window and see the output of Script1.
So, for now, if you keep it simple - any module that imports another module in one folder it should work.
Sep 26 '06 #8
Bellum
23
It didn't work because I named the program Password.py where the .py was unnecessary. X_X
Sep 27 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

75
by: Howard Nease | last post by:
Hello, everyone. I would appreciate any advice that someone could give me on my future career path. Here is my situation: I am a bright Junior in a very well-respected private high school, taking...
3
by: Fernando Rodriguez | last post by:
Hi, How can I get the list of all the functions defined in the current module?
2
by: Jim Jewett | last post by:
I have often wanted to pass arguments to a module. Tyically, these are globals, such as DEBUG or VERBOSE that are set at the top of the module -- and I want to use a different value. For modules...
0
by: William Ryan | last post by:
Depending on how you deploy, an App.Config file might do the trick. You can specify the connection string there, and you can edit it programatically if need be. In my experience, the GAC is a...
1
by: Me | last post by:
I want to set up Access to use a barcode scan for admission to the lunchroom at the school I work at. We already have the scanners and computers. I just need to set up a program to recognize the...
1
by: Lloyd Taylor | last post by:
Hello, I have a simple bit of code which I have found in the forums which lists all the computer(s) in a domain. The code is: DirectoryEntry domainEntry = new...
1
by: careen | last post by:
what are the role of computers in school * is there any beefits *is there any problems * is there any changes in educatio * impact on students performance
3
by: bnashenas1984 | last post by:
Hi everyone I'v been programming a simple task and process manager which is working fine now but the problem is that my program does NOT work on some computers. I think it must have something to do...
1
by: yueying53 | last post by:
Hi all, I have a telit EVK2 evaluation kit and a gm862 module. Setup was fine in my school computers and I was even able to write a small program to send and receive sms. However when I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.