On Tue, Jan 21, 2020 at 1:51 PM David Carson <[email protected]> wrote:
>
>
> On Tue, Jan 21, 2020 at 12:33 PM Aaron Meurer <[email protected]> wrote:
>>
>> On Tue, Jan 21, 2020 at 6:24 AM David Carson <[email protected]> wrote:
>> >
>>
>> At a technical level, PuDB reads the source from the linecache module.
>> Python's import mechanism should put the source into the linecache
>> module whenever a file is first executed, so PuDB can't find the
>> source, it means that somehow that part failed. Normally this only
>> happens for automatically generated code (anything ran through exec()
>> or compile() won't be put in the linecache unless you do so manually),
>> or a C extension. To see what is going on, you would need to see if
>> your file is in linecache.cache.
>>
>
> Hmm, interesting.  The filename ("./foo.py") is a key in linecache.cache.  
> The value of that key (i.e., the file text) appears to be correct.  That gave 
> me the idea of invoking from the command line using `pwd`/foo.py instead of 
> ./foo.py.  Bingo!  Now it works.
>
> It is still unclear what the difference is.  I'm invoking from the current 
> directory, so using the dot notation should be the same thing.

I guess somehow it gets put in there as "./foo.py" but the filename
that it gets compiled with is "/full/path/to/foo.py". Pudb will use
the filename that its compiled with. The linecache dictionary only
matches if the keys are exactly the same. I don't really know how this
happens, and I can't reproduce it. It seems to me that whatever
compiles the code should use the same filename as whatever puts the
lines in the linecache. There's probably a bug here somewhere, but I
can't really say where without being able to reproduce it.

Aaron Meurer

>
>>
>> Grasping at strings, but are there odd filesystems involved here?
>
>
> Note that I do edit the script from Windows, using a mapped network drive and 
> PyCharm.  However, I cannot see how that makes any difference.  I run the 
> script from Linux.
>
> The files actually live on the Linux server.  Well, that is not entirely 
> true, now that I think about it.  The Linux server uses NIS and automounts my 
> home directory, which is located on a NetApp network storage device.
_______________________________________________
Pudb mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to