Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44737 > unrolled thread

Python not starting

Started byrama29065@gmail.com
First post2013-05-05 06:43 -0700
Last post2013-05-05 19:28 -0700
Articles 20 on this page of 21 — 8 participants

Back to article view | Back to comp.lang.python


Contents

  Python not starting rama29065@gmail.com - 2013-05-05 06:43 -0700
    Re: Python not starting Roy Smith <roy@panix.com> - 2013-05-05 09:51 -0400
      Re: Python not starting DRJ Reddy <rama29065@gmail.com> - 2013-05-05 07:00 -0700
        Re: Python not starting Roy Smith <roy@panix.com> - 2013-05-05 10:16 -0400
          Re: Python not starting DRJ Reddy <rama29065@gmail.com> - 2013-05-05 07:28 -0700
          Re: Python not starting Chris Angelico <rosuav@gmail.com> - 2013-05-06 01:00 +1000
            Re: Python not starting DRJ Reddy <rama29065@gmail.com> - 2013-05-05 08:11 -0700
              Re: Python not starting Chris Angelico <rosuav@gmail.com> - 2013-05-06 01:20 +1000
                Re: Python not starting DRJ Reddy <rama29065@gmail.com> - 2013-05-05 09:25 -0700
        Re: Python not starting Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-05 15:26 +0100
          Re: Python not starting DRJ Reddy <rama29065@gmail.com> - 2013-05-05 07:32 -0700
            Re: Python not starting Roy Smith <roy@panix.com> - 2013-05-05 13:55 -0400
              Re: Python not starting DRJ Reddy <rama29065@gmail.com> - 2013-05-05 11:15 -0700
                Re: Python not starting Chris Angelico <rosuav@gmail.com> - 2013-05-06 08:29 +1000
                  Re: Python not starting drjreddy7@gmail.com - 2013-05-05 20:15 -0700
                    Re: Python not starting Chris Angelico <rosuav@gmail.com> - 2013-05-06 14:02 +1000
                    Re: Python not starting Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-06 06:06 +0000
                      Re: Python not starting DRJ Reddy <rama29065@gmail.com> - 2013-05-06 03:33 -0700
    Re: Python not starting Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-05 18:55 +0000
      Re: Python not starting Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-05 14:47 -0500
      Re: Python not starting drjreddy7@gmail.com - 2013-05-05 19:28 -0700

Page 1 of 2  [1] 2  Next page →


#44737 — Python not starting

Fromrama29065@gmail.com
Date2013-05-05 06:43 -0700
SubjectPython not starting
Message-ID<9ace60b8-a07d-41bc-ac9f-507f6c61f955@googlegroups.com>
I was using python from over an year and half.Suddenly from yesterday i'm unable to run it.
The error is as follows
Traceback (most recent call last):
  File "C:\Python27\lib\site.py", line 563, in <module>
    main()
  File "C:\Python27\lib\site.py", line 546, in main
    known_paths = addsitepackages(known_paths)
  File "C:\Python27\lib\site.py", line 324, in addsitepackages
    if os.path.isdir(sitedir):
  File "C:\Python27\lib\genericpath.py", line 44, in isdir
    return stat.S_ISDIR(st.st_mode)
AttributeError: 'module' object has no attribute 'S_ISDIR'

[toc] | [next] | [standalone]


#44738

FromRoy Smith <roy@panix.com>
Date2013-05-05 09:51 -0400
Message-ID<roy-E16D26.09515805052013@news.panix.com>
In reply to#44737
In article <9ace60b8-a07d-41bc-ac9f-507f6c61f955@googlegroups.com>,
 rama29065@gmail.com wrote:

> I was using python from over an year and half.Suddenly from yesterday i'm 
> unable to run it.
> The error is as follows
> Traceback (most recent call last):
>   File "C:\Python27\lib\site.py", line 563, in <module>
>     main()
>   File "C:\Python27\lib\site.py", line 546, in main
>     known_paths = addsitepackages(known_paths)
>   File "C:\Python27\lib\site.py", line 324, in addsitepackages
>     if os.path.isdir(sitedir):
>   File "C:\Python27\lib\genericpath.py", line 44, in isdir
>     return stat.S_ISDIR(st.st_mode)
> AttributeError: 'module' object has no attribute 'S_ISDIR'

Just a wild guess, but did you happen to create a module of your own 
named "stat", which is getting imported instead of the one from the 
library?

Try doing:

>>> print stat.__file__

and see what it says.

[toc] | [prev] | [next] | [standalone]


#44739

FromDRJ Reddy <rama29065@gmail.com>
Date2013-05-05 07:00 -0700
Message-ID<c7c26e78-b786-4205-9ffa-5eb29006479c@googlegroups.com>
In reply to#44738
On Sunday, May 5, 2013 7:21:59 PM UTC+5:30, Roy Smith wrote:
> In article <9ace60b8-a07d-41bc-ac9f-507f6c61f955@googlegroups.com>,
> 
>  rama29065@gmail.com wrote:
> 
> 
> 
> > I was using python from over an year and half.Suddenly from yesterday i'm 
> 
> > unable to run it.
> 
> > The error is as follows
> 
> > Traceback (most recent call last):
> 
> >   File "C:\Python27\lib\site.py", line 563, in <module>
> 
> >     main()
> 
> >   File "C:\Python27\lib\site.py", line 546, in main
> 
> >     known_paths = addsitepackages(known_paths)
> 
> >   File "C:\Python27\lib\site.py", line 324, in addsitepackages
> 
> >     if os.path.isdir(sitedir):
> 
> >   File "C:\Python27\lib\genericpath.py", line 44, in isdir
> 
> >     return stat.S_ISDIR(st.st_mode)
> 
> > AttributeError: 'module' object has no attribute 'S_ISDIR'
> 
> 
> 
> Just a wild guess, but did you happen to create a module of your own 
> 
> named "stat", which is getting imported instead of the one from the 
> 
> library?
> 
> 
> 
> Try doing:
> 
> 
> 
> >>> print stat.__file__
> 
> 
> 
> and see what it says.

Even from command prompt i can't start python.The error is coming up.Python in Windows7 box.

[toc] | [prev] | [next] | [standalone]


#44740

FromRoy Smith <roy@panix.com>
Date2013-05-05 10:16 -0400
Message-ID<roy-AB6F78.10164805052013@news.panix.com>
In reply to#44739
> On Sunday, May 5, 2013 7:21:59 PM UTC+5:30, Roy Smith wrote:
> > In article <9ace60b8-a07d-41bc-ac9f-507f6c61f955@googlegroups.com>,

> > Just a wild guess, but did you happen to create a module of your own 
> > named "stat", which is getting imported instead of the one from the 
> > library?

In article <c7c26e78-b786-4205-9ffa-5eb29006479c@googlegroups.com>,
 DRJ Reddy <rama29065@gmail.com> wrote:
> Even from command prompt i can't start python.The error is coming up.Python 
> in Windows7 box.

I don't know Windows, but my guess is still that it's finding some other 
file called stat.py before it's finding the system library one.  Try 
doing a file system search for all files named "stat.py" and see what 
you find.  On unix, I would do "find / -name stat.py".  I assume there's 
something similar on Windows.

The other thing I would try is tracing the python process as it starts 
up.  On unix, I would do something like "strace -e trace=file python" 
and see if it's finding a stat.py in some unexpected place.  Again, I 
can only assume there's something similar on Windows.

Oh, and please don't post with Google Groups.  It double-spaces 
everything and makes your message really difficult to read.

[toc] | [prev] | [next] | [standalone]


#44742

FromDRJ Reddy <rama29065@gmail.com>
Date2013-05-05 07:28 -0700
Message-ID<5f96a641-d12e-4974-9de5-7e36a63f1238@googlegroups.com>
In reply to#44740
On Sunday, May 5, 2013 7:46:48 PM UTC+5:30, Roy Smith wrote:
> > On Sunday, May 5, 2013 7:21:59 PM UTC+5:30, Roy Smith wrote:
> 
> > > In article <9ace60b8-a07d-41bc-ac9f-507f6c61f955@googlegroups.com>,
> 
> 
> 
> > > Just a wild guess, but did you happen to create a module of your own 
> 
> > > named "stat", which is getting imported instead of the one from the 
> 
> > > library?
> 
> 
> 
> In article <c7c26e78-b786-4205-9ffa-5eb29006479c@googlegroups.com>,
> 
>  DRJ Reddy <rama29065@gmail.com> wrote:
> 
> > Even from command prompt i can't start python.The error is coming up.Python 
> 
> > in Windows7 box.
> 
> 
> 
> I don't know Windows, but my guess is still that it's finding some other 
> 
> file called stat.py before it's finding the system library one.  Try 
> 
> doing a file system search for all files named "stat.py" and see what 
> 
> you find.  On unix, I would do "find / -name stat.py".  I assume there's 
> 
> something similar on Windows.
> 
> 
> 
> The other thing I would try is tracing the python process as it starts 
> 
> up.  On unix, I would do something like "strace -e trace=file python" 
> 
> and see if it's finding a stat.py in some unexpected place.  Again, I 
> 
> can only assume there's something similar on Windows.
> 
> 
> 
> Oh, and please don't post with Google Groups.  It double-spaces 
> 
> everything and makes your message really difficult to read.

I found a stat.py in python27/idlelib i haven't created one.

[toc] | [prev] | [next] | [standalone]


#44744

FromChris Angelico <rosuav@gmail.com>
Date2013-05-06 01:00 +1000
Message-ID<mailman.1292.1367766068.3114.python-list@python.org>
In reply to#44740
On Mon, May 6, 2013 at 12:16 AM, Roy Smith <roy@panix.com> wrote:
> In article <c7c26e78-b786-4205-9ffa-5eb29006479c@googlegroups.com>,
>  DRJ Reddy <rama29065@gmail.com> wrote:
>> Even from command prompt i can't start python.The error is coming up.Python
>> in Windows7 box.
>
> I don't know Windows, but my guess is still that it's finding some other
> file called stat.py before it's finding the system library one.  Try
> doing a file system search for all files named "stat.py" and see what
> you find.  On unix, I would do "find / -name stat.py".  I assume there's
> something similar on Windows.

Or alternatively, disable site.py by invoking python -S, and then
manually import stat and see what its file is.

ChrisA

[toc] | [prev] | [next] | [standalone]


#44745

FromDRJ Reddy <rama29065@gmail.com>
Date2013-05-05 08:11 -0700
Message-ID<b8f7c4fe-2947-4143-b05d-5c1aedaebbf6@googlegroups.com>
In reply to#44744
On Sunday, May 5, 2013 8:30:59 PM UTC+5:30, Chris Angelico wrote:
> On Mon, May 6, 2013 at 12:16 AM, Roy Smith <roy@panix.com> wrote:
> 
> > In article <c7c26e78-b786-4205-9ffa-5eb29006479c@googlegroups.com>,
> 
> >  DRJ Reddy <rama29065@gmail.com> wrote:
> 
> >> Even from command prompt i can't start python.The error is coming up.Python
> 
> >> in Windows7 box.
> 
> >
> 
> > I don't know Windows, but my guess is still that it's finding some other
> 
> > file called stat.py before it's finding the system library one.  Try
> 
> > doing a file system search for all files named "stat.py" and see what
> 
> > you find.  On unix, I would do "find / -name stat.py".  I assume there's
> 
> > something similar on Windows.
> 
> 
> 
> Or alternatively, disable site.py by invoking python -S, and then
> 
> manually import stat and see what its file is.
> 
> 
> 
> ChrisA

Thanks all of you,i have done it,by disabling,but what is the permanent solution.How can i start python idle 

[toc] | [prev] | [next] | [standalone]


#44746

FromChris Angelico <rosuav@gmail.com>
Date2013-05-06 01:20 +1000
Message-ID<mailman.1293.1367767261.3114.python-list@python.org>
In reply to#44745
On Mon, May 6, 2013 at 1:11 AM, DRJ Reddy <rama29065@gmail.com> wrote:
> On Sunday, May 5, 2013 8:30:59 PM UTC+5:30, Chris Angelico wrote:
>> On Mon, May 6, 2013 at 12:16 AM, Roy Smith <roy@panix.com> wrote:
>>
>> > In article <c7c26e78-b786-4205-9ffa-5eb29006479c@googlegroups.com>,
>>
>> >  DRJ Reddy <rama29065@gmail.com> wrote:
>>
>> >> Even from command prompt i can't start python.The error is coming up.Python
>>
>> >> in Windows7 box.
>>
>> >
>>
>> > I don't know Windows, but my guess is still that it's finding some other
>>
>> > file called stat.py before it's finding the system library one.  Try
>>
>> > doing a file system search for all files named "stat.py" and see what
>>
>> > you find.  On unix, I would do "find / -name stat.py".  I assume there's
>>
>> > something similar on Windows.
>>
>>
>>
>> Or alternatively, disable site.py by invoking python -S, and then
>>
>> manually import stat and see what its file is.
>>
>>
>>
>> ChrisA
>
> Thanks all of you,i have done it,by disabling,but what is the permanent solution.How can i start python idle

Here's the steps:

1) Start Python with the -S option. You have apparently figured this
part out. This should give you a working interactive Python.

2) Type:
import stat
stat.__file__

3) See what the file is that was named there. If you created it, you
now know the problem.

4) Read Mark Lawrence's signature.

This post adds nothing to what has already been said; it's just
coalescing the previously-given advice into exact steps.

ChrisA

[toc] | [prev] | [next] | [standalone]


#44751

FromDRJ Reddy <rama29065@gmail.com>
Date2013-05-05 09:25 -0700
Message-ID<55cf0585-eae9-48b9-8fd0-e599b48b9fb0@googlegroups.com>
In reply to#44746
Chris i have seen stat.__file__. It gives me 'C:\\Python27\\lib\\stat.pyc'. What should i do now.

[toc] | [prev] | [next] | [standalone]


#44741

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-05-05 15:26 +0100
Message-ID<mailman.1291.1367764041.3114.python-list@python.org>
In reply to#44739
On 05/05/2013 15:00, DRJ Reddy wrote:
> On Sunday, May 5, 2013 7:21:59 PM UTC+5:30, Roy Smith wrote:
>> In article <9ace60b8-a07d-41bc-ac9f-507f6c61f955@googlegroups.com>,
>>
>>   rama29065@gmail.com wrote:
>>
>>> I was using python from over an year and half.Suddenly from yesterday i'm
>>> unable to run it.
>>> The error is as follows
>>
>>> Traceback (most recent call last):
>>>    File "C:\Python27\lib\site.py", line 563, in <module>
>>>      main()
>>>    File "C:\Python27\lib\site.py", line 546, in main
>>>      known_paths = addsitepackages(known_paths)
>>>    File "C:\Python27\lib\site.py", line 324, in addsitepackages
>>>      if os.path.isdir(sitedir):
>>>    File "C:\Python27\lib\genericpath.py", line 44, in isdir
>>>      return stat.S_ISDIR(st.st_mode)
>>> AttributeError: 'module' object has no attribute 'S_ISDIR'
>>
>> Just a wild guess, but did you happen to create a module of your own
>> named "stat", which is getting imported instead of the one from the
>> library?
>>
>> Try doing:
>>>>> print stat.__file__
>>
>> and see what it says.
>
> Even from command prompt i can't start python.The error is coming up.Python in Windows7 box.
>

Place the call to print stat.__file__ in the file genericpath.py 
immediately before the line that gives the attribute error.

Would you also be kind enough to read and use the guidance given in the 
link in my signature.  My eyesight is bad enough without parsing double 
spaced stuff courtesy of google groups, thanks.

-- 
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#44743

FromDRJ Reddy <rama29065@gmail.com>
Date2013-05-05 07:32 -0700
Message-ID<9d2513ed-2738-4b6f-92af-82c1faa54da2@googlegroups.com>
In reply to#44741
On Sunday, May 5, 2013 7:56:58 PM UTC+5:30, Mark Lawrence wrote:
> On 05/05/2013 15:00, DRJ Reddy wrote:
> 
> > On Sunday, May 5, 2013 7:21:59 PM UTC+5:30, Roy Smith wrote:
> 
> >> In article <9ace60b8-a07d-41bc-ac9f-507f6c61f955@googlegroups.com>,
> 
> >>
> 
> >>   rama29065@gmail.com wrote:
> 
> >>
> 
> >>> I was using python from over an year and half.Suddenly from yesterday i'm
> 
> >>> unable to run it.
> 
> >>> The error is as follows
> 
> >>
> 
> >>> Traceback (most recent call last):
> 
> >>>    File "C:\Python27\lib\site.py", line 563, in <module>
> 
> >>>      main()
> 
> >>>    File "C:\Python27\lib\site.py", line 546, in main
> 
> >>>      known_paths = addsitepackages(known_paths)
> 
> >>>    File "C:\Python27\lib\site.py", line 324, in addsitepackages
> 
> >>>      if os.path.isdir(sitedir):
> 
> >>>    File "C:\Python27\lib\genericpath.py", line 44, in isdir
> 
> >>>      return stat.S_ISDIR(st.st_mode)
> 
> >>> AttributeError: 'module' object has no attribute 'S_ISDIR'
> 
> >>
> 
> >> Just a wild guess, but did you happen to create a module of your own
> 
> >> named "stat", which is getting imported instead of the one from the
> 
> >> library?
> 
> >>
> 
> >> Try doing:
> 
> >>>>> print stat.__file__
> 
> >>
> 
> >> and see what it says.
> 
> >
> 
> > Even from command prompt i can't start python.The error is coming up.Python in Windows7 box.
> 
> >
> 
> 
> 
> Place the call to print stat.__file__ in the file genericpath.py 
> 
> immediately before the line that gives the attribute error.
> 
> 
> 
> Would you also be kind enough to read and use the guidance given in the 
> 
> link in my signature.  My eyesight is bad enough without parsing double 
> 
> spaced stuff courtesy of google groups, thanks.
> 
> 
> 
> -- 
> 
> If you're using GoogleCrap� please read this 
> 
> http://wiki.python.org/moin/GoogleGroupsPython.
> 
> 
> 
> Mark Lawrence

Sorry for double spaced stuff,how can i get rid of it.

[toc] | [prev] | [next] | [standalone]


#44764

FromRoy Smith <roy@panix.com>
Date2013-05-05 13:55 -0400
Message-ID<roy-386FB8.13555405052013@news.panix.com>
In reply to#44743
In article <9d2513ed-2738-4b6f-92af-82c1faa54da2@googlegroups.com>,
 DRJ Reddy <rama29065@gmail.com> wrote:

> > If you're using GoogleCrap� please read this 
> > 
> > http://wiki.python.org/moin/GoogleGroupsPython.
> > 
> > 
> > 
> > Mark Lawrence
> 
> Sorry for double spaced stuff,how can i get rid of it.

I don't mean to be disrespectful, but did you actually read the page you 
were asked to read?  It says, about halfway down the page, "You should 
remove the excess quoted blank lines before posting. There are several 
way to do this.", and then goes on to describe three different ways.

[toc] | [prev] | [next] | [standalone]


#44767

FromDRJ Reddy <rama29065@gmail.com>
Date2013-05-05 11:15 -0700
Message-ID<bbbd74a7-9047-4ceb-bbb2-f230d2a6eda8@googlegroups.com>
In reply to#44764
I did read and understood that while replying if > is there we will get a blank line unnecessarily.

[toc] | [prev] | [next] | [standalone]


#44786

FromChris Angelico <rosuav@gmail.com>
Date2013-05-06 08:29 +1000
Message-ID<mailman.1313.1367792950.3114.python-list@python.org>
In reply to#44767
On Mon, May 6, 2013 at 4:15 AM, DRJ Reddy <rama29065@gmail.com> wrote:
> I did read and understood that while replying if > is there we will get a blank line unnecessarily.

If you read that page, you'll know that it does NOT advocate the total
elimination of quoted text, which is what you've now done. Please
don't. Your posts now lack any form of context.

ChrisA

[toc] | [prev] | [next] | [standalone]


#44797

Fromdrjreddy7@gmail.com
Date2013-05-05 20:15 -0700
Message-ID<80b237bb-7990-4c48-9060-ca3f957de4de@googlegroups.com>
In reply to#44786
On Monday, May 6, 2013 3:59:01 AM UTC+5:30, Chris Angelico wrote:
> On Mon, May 6, 2013 at 4:15 AM, DRJ Reddy <rama29065@gmail.com> wrote:
> I did read and understood that while replying if > is there we will get a blank line unnecessarily.
> If you read that page, you'll know that it does NOT advocate the total
> elimination of quoted text, which is what you've now done. Please
> don't. Your posts now lack any form of context.
> ChrisA

Sorry ChrisA,not only him for all, for the mess i have created.It was the first time for me on google groups. 
I am very happy to inform all of you that the problem is solved. The problem was due to the prescence of duplicates for genericpath.pyc and stat.pyc.I have deleted them and new ones were generated as i started python.
Thanking all of you for assisting me in solving the issue.

[toc] | [prev] | [next] | [standalone]


#44798

FromChris Angelico <rosuav@gmail.com>
Date2013-05-06 14:02 +1000
Message-ID<mailman.1316.1367812959.3114.python-list@python.org>
In reply to#44797
On Mon, May 6, 2013 at 1:15 PM,  <drjreddy7@gmail.com> wrote:
> On Monday, May 6, 2013 3:59:01 AM UTC+5:30, Chris Angelico wrote:
>> On Mon, May 6, 2013 at 4:15 AM, DRJ Reddy <rama29065@gmail.com> wrote:
>> I did read and understood that while replying if > is there we will get a blank line unnecessarily.
>> If you read that page, you'll know that it does NOT advocate the total
>> elimination of quoted text, which is what you've now done. Please
>> don't. Your posts now lack any form of context.
>> ChrisA
>
> Sorry ChrisA,not only him for all, for the mess i have created.It was the first time for me on google groups.
> I am very happy to inform all of you that the problem is solved. The problem was due to the prescence of duplicates for genericpath.pyc and stat.pyc.I have deleted them and new ones were generated as i started python.
> Thanking all of you for assisting me in solving the issue.

Excellent! Glad it's sorted.

The .pyc problem is, if I understand correctly, more permanently
solved in newer versions of Python. So this won't ever be an issue
again :)

ChrisA

[toc] | [prev] | [next] | [standalone]


#44800

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-05-06 06:06 +0000
Message-ID<5187484f$0$21747$c3e8da3$76491128@news.astraweb.com>
In reply to#44797
On Sun, 05 May 2013 20:15:08 -0700, drjreddy7 wrote:

> I am very happy to inform all of
> you that the problem is solved. The problem was due to the prescence of
> duplicates for genericpath.pyc and stat.pyc.I have deleted them and new
> ones were generated as i started python. Thanking all of you for
> assisting me in solving the issue.


Well, I'm glad it's sorted, but the solution raises as many questions as 
it answers.

How did you get duplicate genericpath.pyc and stat.pyc files?

If they were duplicates, why didn't they have the right code in them?

It's probably not worth spending any more time investigating, but it is 
still rather mysterious.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#44814

FromDRJ Reddy <rama29065@gmail.com>
Date2013-05-06 03:33 -0700
Message-ID<66d5fd71-2f98-4206-9197-d30279e5a50f@googlegroups.com>
In reply to#44800
> How did you get duplicate genericpath.pyc and stat.pyc files?
> If they were duplicates, why didn't they have the right code in them?
> It's probably not worth spending any more time investigating, but it is  
> still rather mysterious.
> Steven

When i was running idle on 4th of May,some error came out saying Idle sub-process error i don't remember it correctly,but i wonder how my windows box kept both the files and always loaded the older one instead of new one :D.

[toc] | [prev] | [next] | [standalone]


#44769

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-05-05 18:55 +0000
Message-ID<5186ab34$0$29997$c3e8da3$5496439d@news.astraweb.com>
In reply to#44737
On Sun, 05 May 2013 06:43:25 -0700, rama29065 wrote:

> I was using python from over an year and half.Suddenly from yesterday
> i'm unable to run it. 

Well, the obvious question is, what did you do yesterday to change your 
system? Did you install any new packages? Run a Windows update? Delete 
some stuff? Something changed. What was it?


> The error is as follows
>
> Traceback (most recent call last):
>   File "C:\Python27\lib\site.py", line 563, in <module>
>     main()
>   File "C:\Python27\lib\site.py", line 546, in main
>     known_paths = addsitepackages(known_paths)
>   File "C:\Python27\lib\site.py", line 324, in addsitepackages
>     if os.path.isdir(sitedir):
>   File "C:\Python27\lib\genericpath.py", line 44, in isdir
>     return stat.S_ISDIR(st.st_mode)
> AttributeError: 'module' object has no attribute 'S_ISDIR'


This is a Python error, so Python is definitely starting. It's starting, 
hitting an error, and then failing with an exception.

Interestingly, the error is in os.path.isdir. The os module should be 
importing the ntpath module. The ntpath module tries to import _isdir 
from the nt module, and if that fails, falls back on genericpath.isdir. 
Which is what fails. So you have two problems:

- why is your nt module missing?

- why does genericpath.isdir fail?


Try running Python from the command line with the -S switch:


python -S


(you might need to use /S on Windows instead, I'm not sure.) Note that 
this is uppercase S, not lowercase. -S will disable the import of site.py 
module, which hopefully will then give you a prompt so you can run this:


import nt
print nt.__file__


which hopefully will show you have created a file called "nt.py" which is 
interfering with the actual nt file needed by Python. Get rid of that, 
and you should be right.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#44784

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2013-05-05 14:47 -0500
Message-ID<mailman.1311.1367792561.3114.python-list@python.org>
In reply to#44769
On 2013.05.05 13:55, Steven D'Aprano wrote:
> (you might need to use /S on Windows instead, I'm not sure.)
That is only a convention among Microsoft's CLI utilities. Very few others follow it (even for programs written specifically for Windows),
and it is certainly not a necessity on Windows.
-- 
CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.python


csiph-web