469,287 Members | 2,635 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,287 developers. It's quick & easy.

Newbie needs help

Greetings all,

I'm wanting to maintain what values in one file and call them in
another. The purpose being to keep a single location where url's,
login's and passwords can be maintained, then called as needed from
another file.

In file #1 I have...

import time
import os
import sys

url = 'http://zoo/'

adminlogin = 'Zebra'
adminpassword = 'Zebra12$'
---------------------------------------------

In file #2 I have the following...

from cPAMIE import PAMIE

#Imports - used to setup / control finding files
import time
import os
import sys
import loginout #name of the file retaining all url/login info
from log import log

#Create New Pamie Object
ie=PAMIE()
ie=Visible =1
t=time

adminlogin (ie,url)
if ie.findText ('Site Status: Active'):
log ('PASSED -- ADMIN Module - ADMIN Login & Admin Tab Navigation
Successful')
else:
log ('WARNING -- ADMIN Module Login & Admin Tab Navigation
FAILED')
time.sleep(2)

What am I doing incorrectly to not have file two log in when
executed. All files are in the same directory. Keep it simple...
I'm new at this.

THNX
Aug 26 '08 #1
4 924
Is the loginout file named loginout.py ? It needs to be for the
import to work. If the import works, you have to refer to those
variables within the right namespace, ie : loginout.url,
loginout.adminlogin, etc.

On Tue, Aug 26, 2008 at 12:46 PM, frankrentef <fr*********@yahoo.comwrote:
Greetings all,

I'm wanting to maintain what values in one file and call them in
another. The purpose being to keep a single location where url's,
login's and passwords can be maintained, then called as needed from
another file.

In file #1 I have...

import time
import os
import sys

url = 'http://zoo/'

adminlogin = 'Zebra'
adminpassword = 'Zebra12$'
---------------------------------------------

In file #2 I have the following...

from cPAMIE import PAMIE

#Imports - used to setup / control finding files
import time
import os
import sys
import loginout #name of the file retaining all url/login info
from log import log

#Create New Pamie Object
ie=PAMIE()
ie=Visible =1
t=time

adminlogin (ie,url)
if ie.findText ('Site Status: Active'):
log ('PASSED -- ADMIN Module - ADMIN Login & Admin Tab Navigation
Successful')
else:
log ('WARNING -- ADMIN Module Login & Admin Tab Navigation
FAILED')
time.sleep(2)

What am I doing incorrectly to not have file two log in when
executed. All files are in the same directory. Keep it simple...
I'm new at this.

THNX
--
http://mail.python.org/mailman/listinfo/python-list
Aug 26 '08 #2
On Aug 26, 11:46*am, frankrentef <frankren...@yahoo.comwrote:
Greetings all,

I'm wanting to maintain what values in one file and call them in
another. *The purpose being to keep a single location where url's,
login's and passwords can be maintained, then called as needed from
another file.

In file #1 I have...

import time
import os
import sys

url = 'http://zoo/'

adminlogin = 'Zebra'
adminpassword = 'Zebra12$'

---------------------------------------------

In file #2 I have the following...

from cPAMIE import PAMIE

#Imports - used to setup / control finding files
import time
import os
import sys
import loginout * *#name of the file retaining all url/login info
from log import log

#Create New Pamie Object
ie=PAMIE()
ie=Visible =1
t=time

adminlogin (ie,url)
if ie.findText ('Site Status: Active'):
* * log ('PASSED -- ADMIN Module - ADMIN Login & Admin Tab Navigation
Successful')
else:
* * log ('WARNING -- ADMIN Module Login & Admin Tab Navigation
FAILED')
time.sleep(2)

What am I doing incorrectly to not have file two log in when
executed. *All files are in the same directory. * Keep it simple...
I'm new at this.

THNX
Yes, the first file is named loginout.py

Would the second file need something akin to...

loginout.admin (ie,url,adminlogin)

Aug 26 '08 #3
On Tue, Aug 26, 2008 at 8:33 PM, frankrentef <fr*********@yahoo.comwrote:
>
Would the second file need something akin to...

loginout.admin (ie,url,adminlogin)
Yes. Since you're importing the whole module.

--
Marco Bizzarri
http://iliveinpisa.blogspot.com/
Aug 27 '08 #4
Help, I'm missing / still not grasping something....

My "loginout" file contains the following...

from cPAMIE import PAMIE

#Imports - used to setup / control finding files
import time
import os
import sys

url = 'http://test2/'
adminlogin = 'Gorillia'
adminpassword = 'Gorillia1$'
#Admin Login Def Function

def adminlogin(ie,url):
ie.navigate (url + 'isweb/admin/default.aspx')
time.sleep(2)
ie.textBoxSet ('AdminLogin1:txtUsername','adminlogin')
time.sleep(2)
ie.textBoxSet ('AdminLogin1:inputPassword','adminpassword')
time.sleep(2)
ie.buttonClick ('AdminLogin1:btnLogin')
time.sleep(2)
My "main" Python file contains...

from cPAMIE import PAMIE

import time
import os
import sys
import loginout
from log import log

ie=PAMIE()
ie=Visible =1
t=time

ie=PAMIE ()

#+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++
+++++++++

adminlogin (ie, url, adminlogin)
if ie.findText ('Site Status: Active'):
log ('PASSED -- ADMIN Module - ADMIN Login & Admin Tab Navigation
Successful')
else:
log ('WARNING -- ADMIN Module Login & Admin Tab Navigation
FAILED')
time.sleep(2)
All that happens is an I.E. session comes up with the url
"about:blank" in the address.

What am I doing incorrectly.
THNX
Aug 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by igmox | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.