LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   python: can't open file 'emerge\bin\emerge.py' (http://www.linuxquestions.org/questions/programming-9/python-cant-open-file-emerge%5Cbin%5Cemerge-py-617112/)

Virtuality 01-29-2008 07:08 AM

python: can't open file 'emerge\bin\emerge.py'
 
Code:

c:\kderoot\emerge\bin>python \emerge\bin\emerge.py qt python: can't open file '\emerge\bin\emerge.py': [Errno 2] No such file or directory
The problem, that file exists. I just used it when I ran 'emerge qt'.

That is now the output of 'emerge qt'.

The problem is, I just did 'emerge qt', and it attempted to install qt and all of its dependencies. It didn't find sed, so it could not install sed; qt failed due to not having sed.

I manually downloaded and installed sed. I ran 'emerge qt' once again expecting better results.

But no. It wont even try. It just says it can not find the file that is RIGHT WHERE IT IS LOOKING.

It's like saying there's a file called 'c:\1.txt' and windows saying c:\1.txt actually doesn't exist. How stupid.

How do I fix this? I suppose I should report it as a bug on python.

juergen 01-29-2008 09:49 AM

Quote:

Originally Posted by Virtuality (Post 3038698)
Code:

c:\kderoot\emerge\bin>python \emerge\bin\emerge.py qt python: can't open file '\emerge\bin\emerge.py': [Errno 2] No such file or directory
The problem, that file exists. I just used it when I ran 'emerge qt'.

[...]

I see that you are sitting in c:\kderoot\emerge\bin and trying to call a file in c:\emerge\bin\. Do those directories both exist? If so, what do you get if you cd to c:\emerge\bin\ and type
Code:

python emerge.py qt
without any path?

Virtuality 01-29-2008 06:27 PM

My first question in response is WHY did it work until it failed to install qt? This is the SECOND time it has done this and without ANY reason and NOTHING has been modified!! Also google has zero instances of this error, it exists only for me.

So I modified the batch file and set it to the correct directory, now it gives the same output as if I cd to 'c:\kderoot\emerge\bin' and do 'python emerge.py qt' :

Code:

c:\kderoot\emerge\bin>emerge qt

c:\kderoot\emerge\bin>echo emerge.bat executed
emerge.bat executed

c:\kderoot\emerge\bin>python c:\kderoot\emerge\bin\emerge.py qt
Traceback (most recent call last):
  File "c:\kderoot\emerge\bin\emerge.py", line 22, in <module>
    import utils
  File "c:\kderoot\emerge\bin\utils.py", line 32, in <module>
    WGetExecutable = os.path.join( os.getenv( "KDEROOT" ), "gnuwin32", "bin", "w
get.exe" )
  File "c:\python25\lib\ntpath.py", line 90, in join
    assert len(path) > 0
TypeError: object of type 'NoneType' has no len()

c:\kderoot\emerge\bin>

Guess python is just crap? Well I have no alternative, because I'm trying to compile Amarok on windows.

juergen 01-29-2008 10:39 PM

[QUOTE=Virtuality;3039347][...]
Code:

File "c:\kderoot\emerge\bin\utils.py", line 32, in <module>
    WGetExecutable = os.path.join( os.getenv( "KDEROOT" ), "gnuwin32", "bin", "w
get.exe" )
  File "c:\python25\lib\ntpath.py", line 90, in join
    assert len(path) > 0
TypeError: object of type 'NoneType' has no len()

[...]

So at that point, Python looks for a path that is stored in the environment variable KDEROOT and then searches in a subdirectory '\gnuwin32\bin\' for wget.exe. I assume the linebreak between the 'w' and the 'get.exe' doesn't happen in the original output, right?

So, assuming that KDEROOT contains something like 'c:\kderoot\', it would be looking for 'c:\kderoot\gnuwin32\bin\wget.exe' - and it doesn't look like it is finding it.

So, is KDEROOT set anywhere, and does wget exist in the indicated location?

Virtuality 01-29-2008 11:46 PM

Hi, thanks for responding!

If my environment variables were not set, it would have not worked the first time, and wget would of had that same error the first time. But I do have wget in the correct directory, and the variables ARE set.

When the script runs it invokes a batch file that sets all the variables (kdesettings.bat).

I don't know what could have gone wrong from running it once before. It doesn't make any logical sort of sense at all. But everything is set correctly.

This is my 'PATH' under environment variables:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Subversion\bin;c:\python25;c:\python25\scripts;c:\mingw\bin

And this is the kdesettings.bat which defines them when it executes:

@echo off
set KDEROOT=c:\kderoot
set KDECOMPILER=mingw
set PYTHONPATH=c:\python25\bin
set MSYSDIR=c:\kderoot\msys
set DOWNLOADDIR=c:\kdedownload
set KDESVNDIR=c:\kdesvn
set KDESVNSERVER=svn://anonsvn.kde.org
set KDESVNUSERNAME=username
rem set KDESVNPASSWORD=password
set SVN_SSH=plink
set directory_layout=installer
set EMERGE_BUILDTYPE=RelWithDebInfo
set EMERGE_VERBOSE=1
set EMERGE_NOCOPY=True
rem set EMERGE_BUILDTESTS=True
rem set EMERGE_PKGDSTDIR=%KDEROOT%\tmp

rem No editing should be necessary below this line (in an ideal world)
rem ##################################################################

set PATH=%PYTHONPATH%;%PATH%

echo kdesettings.bat executed
echo KDEROOT : %KDEROOT%
echo KDECOMPILER : %KDECOMPILER%
echo KDESVNDIR : %KDESVNDIR%
echo PYTHONPATH : %PYTHONPATH%
echo DOWNLOADDIR : %DOWNLOADDIR%



Thanks for help so far, looking forward to hear from you :)

Virtuality 01-30-2008 01:23 PM

I am still very much in need of help...

Here's with
import pdb
pdb.set_trace()

in utils.py


c:\kderoot\emerge\bin>emerge qt

c:\kderoot\emerge\bin>echo emerge.bat executed
emerge.bat executed

c:\kderoot\emerge\bin>python c:\kderoot\emerge\bin\emerge.py qt
> c:\kderoot\emerge\bin\utils.py(31)<module>()
-> if (os.getenv( "directory_layout" ) == "installer" ):
(Pdb) s
--Call--
> c:\python25\lib\os.py(508)getenv()
-> def getenv(key, default=None):
(Pdb) s
> c:\python25\lib\os.py(511)getenv()
-> return environ.get(key, default)
(Pdb) s
--Call--
> c:\python25\lib\os.py(449)get()
-> def get(self, key, failobj=None):
(Pdb) s
> c:\python25\lib\os.py(450)get()
-> return self.data.get(key.upper(), failobj)
(Pdb) s
--Return--
> c:\python25\lib\os.py(450)get()->None
-> return self.data.get(key.upper(), failobj)
(Pdb) s
--Return--
> c:\python25\lib\os.py(511)getenv()->None
-> return environ.get(key, default)
(Pdb) s
> c:\kderoot\emerge\bin\utils.py(34)<module>()
-> WGetExecutable = os.path.join( os.getenv( "KDEROOT" ), "gnuwin32", "bin", "wg
et.exe" )
(Pdb) s
--Call--
> c:\python25\lib\os.py(508)getenv()
-> def getenv(key, default=None):
(Pdb) s
> c:\python25\lib\os.py(511)getenv()
-> return environ.get(key, default)
(Pdb) s
--Call--
> c:\python25\lib\os.py(449)get()
-> def get(self, key, failobj=None):
(Pdb) s
> c:\python25\lib\os.py(450)get()
-> return self.data.get(key.upper(), failobj)
(Pdb) s
--Return--
> c:\python25\lib\os.py(450)get()->None
-> return self.data.get(key.upper(), failobj)
(Pdb) s
--Return--
> c:\python25\lib\os.py(511)getenv()->None
-> return environ.get(key, default)
(Pdb) s
--Call--
> c:\python25\lib\ntpath.py(59)join()
-> def join(a, *p):
(Pdb) s
> c:\python25\lib\ntpath.py(61)join()
-> path = a
(Pdb) s
> c:\python25\lib\ntpath.py(62)join()
-> for b in p:
(Pdb) s
> c:\python25\lib\ntpath.py(63)join()
-> b_wins = 0 # set to 1 iff b makes path irrelevant
(Pdb) s
> c:\python25\lib\ntpath.py(64)join()
-> if path == "":
(Pdb) s
> c:\python25\lib\ntpath.py(67)join()
-> elif isabs(b):
(Pdb) s
--Call--
> c:\python25\lib\ntpath.py(51)isabs()
-> def isabs(s):
(Pdb) s
> c:\python25\lib\ntpath.py(53)isabs()
-> s = splitdrive(s)[1]
(Pdb) s
--Call--
> c:\python25\lib\ntpath.py(116)splitdrive()
-> def splitdrive(p):
(Pdb) s
> c:\python25\lib\ntpath.py(119)splitdrive()
-> if p[1:2] == ':':
(Pdb) s
> c:\python25\lib\ntpath.py(121)splitdrive()
-> return '', p
(Pdb) s
--Return--
> c:\python25\lib\ntpath.py(121)splitdrive()->('', 'gnuwin32')
-> return '', p
(Pdb) s
> c:\python25\lib\ntpath.py(54)isabs()
-> return s != '' and s[:1] in '/\\'
(Pdb) s
--Return--
> c:\python25\lib\ntpath.py(54)isabs()->False
-> return s != '' and s[:1] in '/\\'
(Pdb) s
> c:\python25\lib\ntpath.py(86)join()
-> if b_wins:
(Pdb) s
> c:\python25\lib\ntpath.py(90)join()
-> assert len(path) > 0
(Pdb) s
TypeError: "object of type 'NoneType' has no len()"
> c:\python25\lib\ntpath.py(90)join()
-> assert len(path) > 0
(Pdb) s
--Return--
> c:\python25\lib\ntpath.py(90)join()->None
-> assert len(path) > 0
(Pdb) s
TypeError: "object of type 'NoneType' has no len()"
> c:\kderoot\emerge\bin\utils.py(34)<module>()
-> WGetExecutable = os.path.join( os.getenv( "KDEROOT" ), "gnuwin32", "bin", "wg
et.exe" )
(Pdb) s
--Return--
> c:\kderoot\emerge\bin\utils.py(34)<module>()->None
-> WGetExecutable = os.path.join( os.getenv( "KDEROOT" ), "gnuwin32", "bin", "wg
et.exe" )
(Pdb) s
TypeError: "object of type 'NoneType' has no len()"
> c:\kderoot\emerge\bin\emerge.py(22)<module>()
-> import utils
(Pdb) s
--Return--
> c:\kderoot\emerge\bin\emerge.py(22)<module>()->None
-> import utils
(Pdb) s
Traceback (most recent call last):
File "c:\kderoot\emerge\bin\emerge.py", line 22, in <module>
import utils
File "c:\kderoot\emerge\bin\utils.py", line 34, in <module>
WGetExecutable = os.path.join( os.getenv( "KDEROOT" ), "gnuwin32", "bin", "w
get.exe" )
File "c:\python25\lib\ntpath.py", line 90, in join
assert len(path) > 0
TypeError: object of type 'NoneType' has no len()

c:\kderoot\emerge\bin>


All times are GMT -5. The time now is 10:49 AM.