os.getcwd() doesn't return the current working directory

234 views
Skip to first unread message

Kadir Çakır

unread,
Feb 26, 2014, 11:02:34 AM2/26/14
to kivy-...@googlegroups.com
I put the kivy apps folder a "text.txt" file. I want to read it from Kivy app, but file = open("text.txt", r) doesn't return that I want. I'm testing it from Windows for now. When I call os.getcwd() it prints C:\Kivy-1.8.0-py3.3-win32, not my current working directory. Any help? Thanks!

Kadir Çakır

unread,
Feb 26, 2014, 11:35:28 AM2/26/14
to kivy-...@googlegroups.com
I created a package and it's working well on Android. I can open the txt and read it.

Gerhard Venter

unread,
Feb 26, 2014, 6:16:02 PM2/26/14
to kivy-...@googlegroups.com
You can do:

runpath = os.path.dirname(os.path.realpath(sys.argv[0]))
os.chdir(runpath)


On Thu, Feb 27, 2014 at 3:05 AM, Kadir Çakır <kadirca...@gmail.com> wrote:
I created a package and it's working well on Android. I can open the txt and read it.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages