2

So, it turned out i was missing a semi-colon from my PYTHONPATH definition. But this only got me so far. for some reason, my script did NOT work as a scheduled task (on WinXP) until I explicitly added a directory from PYTHONPATH to the top of my script.

Question is: When do I need to explicitly append something to my path and when can I simply rely on the environment variables?

2
  • How did you schedule the script? Commented Nov 17, 2010 at 20:07
  • sorry, @mark. I updated my question to show I used WinXP scheduledTasks to schedule. Commented Nov 17, 2010 at 20:11

2 Answers 2

4

Perhaps you're not running the scheduled task under the right credentials (log-in name). When you define environment variables in System Properties dialog, they can be either User-level or System-level. If you defined PYTHONPATH as User-level then your scheduled task must run as that user for it to be set properly. I believe making it System-level would mean it would apply to all users unless they have their own value defined.

Below is a screenshot showing where one sets environment variables. It's similar in both Windows XP and Windows 7. The top half of the right-hand dialog box shows the current User-level settings, and the bottom half lists all the System-level ones.

screenshot of environment variable dialog box

If PYTHONPATH appears in the list of names in the upper User-level group, you can effectively move it to the other lower one by first deleting and then adding one of the same name plus associated value to the lower System-level set. To save a little typing, you can Edit the user-level variable before you Delete it to be given a chance to first copy its current value, then Cancel-out of the operation. That way, when you make the New System-level copy you'll be able to simply paste the copied value into it.

Sign up to request clarification or add additional context in comments.

2 Comments

two things: 1.) how can I tell if I've created a system-level variable. This seems to jive with what's going on but i don't see anywhere that tells me whether the variable I've set is at the system or user level. 2.)If it IS at the user level, how could i change it to the system level?
@Ramy: I updated my answer to respond to each of your further questions.
0

If the other modules belongs to the same package you should be responsible to locate them if they are not stored in the conventional format (i.e. append the path with sys).

If the other modules are user-configurable then the user have to specify the installation path trough PYTHONPATH

1 Comment

what does it mean for modules to belong to the same package?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.