Python Forum
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pywinauto problems
#1
Apologies if this is the wrong location for the post, i wasn't sure where it fits...anyways:

I already had python 3.6 installed on windows 10 and have just also installed pywinauto
to do this i just ran >pip install pywinauto  via the command line

I have been experimenting with very basic code straight into cmd and via the python shell which works fine.
However if i create a py file via IDLE i just get an import error for 'application' see below:
 
Error:
Traceback (most recent call last):   File "C:\Users\<myuser>\Desktop\pywinauto.py", line 1, in <module>     from pywinauto import application   File "C:\Users\<myuser>\Desktop\pywinauto.py", line 1, in <module>     from pywinauto import application ImportError: cannot import name 'application'
i'm sure this is something to do with the env variables or the relevant path etc ..but i'm not proficient enough to solve the problem.

the code i've started with is:
from pywinauto import application

import time

def main():
   app = application.Application()
   app.start("Notepad.exe")
   time.sleep(3)
   app.notepad.edit.TypeKeys("Hello World")
   time.sleep(2)
   app.Notepad.menuSelect("File ->SaveAs")
   app.SveAs.edit.SetText("pywinautodemo.txt")
   app.SaveAs.Save.Click()

main()
Any help greatly appreciated!

ta
   VNC
Reply
#2
(Apr-13-2017, 10:32 AM)vnc Wrote: Apologies if this is the wrong location for the post, i wasn't sure where it fits...anyways: I already had python 3.6 installed on windows 10 and have just also installed pywinauto to do this i just ran >pip install pywinauto  via the command line I have been experimenting with very basic code straight into cmd and via the python shell which works fine. However if i create a py file via IDLE i just get an import error for 'application' see below:    Traceback (most recent call last):   File "C:\Users\<myuser>\Desktop\pywinauto.py", line 1, in <module>     from pywinauto import application   File "C:\Users\<myuser>\Desktop\pywinauto.py", line 1, in <module>     from pywinauto import application ImportError: cannot import name 'application' i'm sure this is something to do with the env variables or the relevant path etc ..but i'm not proficient enough to solve the problem. the code i've started with is: from pywinauto import application import time def main():   app = application.Application()   app.start("Notepad.exe")   time.sleep(3)   app.notepad.edit.TypeKeys("Hello World")   time.sleep(2)   app.Notepad.menuSelect("File ->SaveAs")   app.SveAs.edit.SetText("pywinautodemo.txt")   app.SaveAs.Save.Click() main() Any help greatly appreciated! ta    VNC
There is most likely something wrong with the "application" name or whatever you call it. Check on the internet, because it says it cannot import it.
Reply
#3
from pywinauto import Application # upper 'A'

app = Application()
Ref: https://github.com/pywinauto/pywinauto
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#4
(Apr-13-2017, 11:03 AM)wavic Wrote:
from pywinauto import Application # upper 'A'

app = Application()
Ref: https://github.com/pywinauto/pywinauto

Thanks tried that ..makes no difference to the error message except for an upper case A
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  MemoryError in pywinauto.findwindows.find_windows – Need Help! ktw3857 1 243 Yesterday, 04:28 PM
Last Post: itegumo
  Pywinauto typing in the wrong field EGameiro 0 677 Jun-07-2023, 10:01 PM
Last Post: EGameiro
  Help ~ coding with pywinauto NickNHartley 1 2,313 Apr-20-2023, 05:20 PM
Last Post: farshid
  pywinauto, anyone use it? thewolf 1 2,833 Mar-01-2021, 09:58 PM
Last Post: snippsat
  set_focus() in python pywinauto stearno 0 4,743 Nov-05-2020, 09:34 AM
Last Post: stearno
  Kindly asking for help with Pywinauto louloulou 0 2,017 Mar-05-2020, 06:55 PM
Last Post: louloulou
  Checking the presence of label using pywinauto module Malt 0 1,915 Jul-26-2019, 09:06 AM
Last Post: Malt
  [PyWinAuto] Please help me with Typekeys () mattroi261192 2 7,884 Apr-23-2019, 01:55 AM
Last Post: mattroi261192
  Not able to convert PYWINAUTO module automation in exe file Utkarsh29 0 2,440 Mar-19-2019, 09:39 PM
Last Post: Utkarsh29
  pywinauto timings timout error stonetr33 4 11,459 Dec-07-2016, 12:55 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020