« first day (3700 days earlier)      last day (1240 days later) » 
00:00 - 22:0022:00 - 00:00

10:06 PM
the working directory has nothing to do with imports though
I don't really understand the problem; what's wrong with the imports?
 
hmm, if im not normally mistaken when you do python folder/script.py normally when script.py imports some local module this is done relative to script.py right?
 
yes, the location of the script is added to sys.path. Not the working directory, though
 
The code I'm working on was written in an environment where these imports are instead done relative to root
 
Are you sure the problem can't be solved by installing the project?
 
unfortunately the project is more like a bundle of scripts then anything installable, I'm the one tasked with refactoring parts into modules it but it needs to continue work in that environment since everybody else uses the code there
 
10:12 PM
Then just make sure that all executable scripts are in the same directory as the package
my-project/
    my_package/
        __init__.py
    executable1.py
    executable2.py
 
yea, the issue in the main environment is that when I "open" executable1.py, it opens an environment where you can execute line by line (or select multiple lines to run in batch), when you run those lines everything is done relative to the project root and im working on content in a subdirectory
so if I have
root/
  refactor-dir/
    executable1.py
    <other_refactor_files>
on that workbench they use all the import code in executable1.py gets bumped up 1 level compared to when I'm refactoring
 
Ok, I have no clue how or why that would happen
 
its a stupid quirk of that environment that has bugged me to no end, I think it's based on the Spyder IDE. When I've worked on solo projects I've gotten away by organizing the code kind of like you said
 
if your data science team ever wants to switch to Cloudera DSW start smacking people on the head until they change their mind
 
10:25 PM
well you did say "spyder"
 
i did a test with I think josh a couple of weeks back where we did an import he knows should break everywhere but Spyder
and it worked in this env
which makes me think its some proprietary/white-labelled fork of that project
 
or just a newer version of spyder, now with even more confusing behaviour ;)
 
maybe I should just move my executable1.py to root everytime I'm refactoring and then move back before pushing
it just sucks so much
is there anyway I could use a symlink in my root folder instead?
 
If you have to move the script to run it, how will other people be able to run it in a subdir?
Wouldn't you want it to run under prod circumstances?
 
@AndrasDeak the production circumstance basically makes the executable script run like its in root
 
10:35 PM
Which is not an env you have access to?
sorry if I'm being dense but this is really weird and error-prone
 
Morning cabbage gentlemen
 
Just to make sure I'm clear, when I say root I'm just referring to the root directory of this environment. This file is organized in a subdirectory, and when you "open" the file to run it treats it like youre running in the root
 
@Skyler OK, so I'm asking whether you can run it the same way: as if it were in the root
 
are these two questions from the same user: Q1, Q2
 
then you'd know for a fact that it will also work in prod, without many opportunities of silly errors arising from copying files back and forth across directory levels
 
10:39 PM
@Skyler <shares a moment of condolences>. DS environments sure are fun, aren't they? I've been bemoaning some really weird stuff I've been facing the last few months. I don't mind too much that things need ironing out, but I can't even begin to predict how long new tasks will take because I can't see the bus coming head-on
 
@AndrasDeak in my branch of the code when I'm working in VSCode, if I move the file to root then it behaves as intended, so I can put it there
 
@roganjosh did you see the part about "[probably] based on Spyder"? ;)
@Skyler I'll take that as a "no"
 
is there a way that you can do something like python symlink_to_actual_py
and it run the python file like its in that (root) folder
cuz then I could just put the symlink in my gitignore and run things like that
 
@Skyler I don't see why python should be bothered by a symlink. Easy enough to try too.
but then your cwd will be the original path, so things will probably not resolve in the way you want them to
 
hmm, then maybe I just make a copy of that file in root that syncs on save and put that in gitignore
i know with c++ code you can pull off something like that with cmake, but how about here
the things we have to do for peace of mind
 
10:47 PM
@AndrasDeak I did :) We have ShinyProxy in the stack... somewhere, running python apps
 
in the ~cloud~
 
Which might be ok if they didn't spin up containers and inject UUIDs into all the URLs. It's kinda hard to guess what they might be and fix the routes
 
11:08 PM
it looks like the symlink route may work
 
00:00 - 22:0022:00 - 00:00

« first day (3700 days earlier)      last day (1240 days later) »