« first day (3815 days earlier)      last day (1357 days later) » 

05:18
Anyone who wants a fun hard PCRE regex challenge: Regex to validate subtract adjacent substrings in equations like “abcde-cd=abe”. The accepted answer is ingenious.
 
4 hours later…
08:50
hi, I have developed a large python code. At the beggining of the program I have input values like h=10, b=5 etc. Can I put them in a separate file, read them at the beginning and send them to the modules I am defining?
09:05
...aaaand of course that's exactly how the accepted answer did it
ooooh, the second answer is very clever
Oops, I guess I should've spoilered that solution. Can a RO move that for me, please?
thanks
09:22
brief cbg folks
@enthu Are these values constants or user input?
If they're constants, every module that needs them should simply import them. Otherwise, there shouldn't be any modules that need access to those values - there should only be functions (or classes), who will receive those values as arguments
09:38
thank you, I put those in a inpt.py file, and called them like this in the main program:

import inpt
h = inpt.h
Although I feel it is such a mess to make them local with h=inpt.h... looks too ugly!
from inpt import h?
@Aran-Fey cool! can I import everything defined in inpt.py? when there are large number of variables, it should be tough calling them one by one...
You can do from input import *, but that's widely considered bad form
You can, but you almost certainly shouldn't. inpt.h ugliness is easily offset by the fact that you are explicit about where h comes from; especially since that's a vague variable name
fantastic... these simple notes have made my program considerably minimal and polished... thank you @Aran-Fey and @roganjosh
09:58
@Dodge I bet they'd nail it. Then again, I imagine that new tools such as those remote consoles to perform keyhole surgery will start making it slightly less necessary to have an absolutely stable hand. At least the machine can be made to scale 1cm moves of the hands down to sub-mm movements of the instrument (I don't actually know that they do do this kind of buffering)
10:12
@roganjosh Should I ever need some surgery (keyhole or not) - if I was told the person doing it was doing so remotely and 2k miles away or something... I'd be a bit... errr... wait what!?
What if you were told it was a robot in the cloud that would be doing the surgery? :P
There is something unsettling about the whole remoteness part though, I agree
@roganjosh Cirrus or Cumulus? :p
Oh, it has to be Nimbus. It kinda sounds like "nimble", so it's a Marketing dept. dream if it's for surgery!
I'm finding the increasing use of chatbots on sites quite annoying. I'm really tempted to tell this one that "what brought me here today" is "competitor research". I wonder if that'll fry some circuits
there was me trying to dig up a joke, dragging up some old things from basic Geography, remembered two of 'em, and both C's, then you go ruin it with Nimbus :p
We can go with Cumulonimbus as a compromise? Now it has the added benefit of sounding like a Harry Potter spell - nimble and magic
10:27
works for me... expelliarmus!
11:17
I'm running the following query:
results = cursor.execute('''
SELECT *
FROM hashbands h
GROUP BY h.hashband
HAVING COUNT(DISTINCT(h.file_id)) > 1;
''')
(in sqlite)
I'd like to add an order by clause ORDER BY h.hashband
does anyone know the syntax for doing so?
Ah:
  SELECT hashband, file_id, window_id
  FROM hashbands
  GROUP BY hashband
  HAVING COUNT(DISTINCT(file_id)) > 1
  ORDER BY hashband
No this is not right, I'm now getting hashbands that seem to have only a single file id
can anyone see an obvious reason why this would be slow?
I feel intuitively there may be a way to vectorize some of this with numpy
what is that for?
11:44
@Trajan at a glance, I'd say all those double-nested loops and recomputing the same thing over and over is a tad of a problem.
computing max_element even though it's never used probably doesn't help either, but seems more like a problem for tripping up volunteer reviewers rather than runtime.
@duhaime I'm relatively sure that Redshift would complain about that because you have no aggregators on file_id or window_id. It's been a while since I used SQLite but I'm somewhat surprised it doesn't have the same complaint
Then again, SQLite doesn't complain about a lot of things it ought to
Docker "fun" means I have a whopping 94MB of free RAM so I'm not even gonna attempt to load another file. I'll restart and have a play with the query if I get time when I'm back. Sorry that wasn't totally informative - I think you'll want a temporary table to get the counts and it seems that later editions might support the WITH ... AS syntax
12:21
@Trajan what a nice site, dpaste
@duhaime See here. Apologies for lack of context manager etc. just threw it together
@roganjosh appears I also missed some "fun" the other day... those were quite the choice of words - wow.
@JonClements You know when something just feels "off" about a person's attitude? I prodded with a stick just a tad but wasn't quite prepared for how "off" the response would be. At least it was dealt with swiftly and hopefully others don't feel uncomfortable here
tbh... I don't think I'd have seen that one coming either
I missed the whole thing even though I was there. Didn't check the room for a minute or two and it was all over
12:36
and that's how it should be - done and dusted :p
12:49
@Aran-Fey yeah, it was a single message pretty much out of the blue
13:13
@roganjosh you are a saint! Just so I understand--are we essentially running two queries here? One to get the hashbands that have more than 1 distinct file id and another to get the rows that contain those hashbands?
I anticipated this question and the honest answer is that I don't know
I have one more quick follow-up if I may: will sqlite push all query results into RAM concurrently, or will it allow one to stream data through RAM?
haha, no worries
In theory, the language should be clear enough for it to optimise the query pathway. SQL doesn't get translated into direct commands. On Redshift, this approach would allow it to optimise parts of the queries away - I hope that goes into SQLite too but I'm not confident enough to say
The fun of declarative languages :)
haha
@duhaime No, depending on how it interprets that query, many parts may be outside of RAM
Although you haven't got a server to offload onto because SQLite is local so... maybe (?)
13:17
but it should be on disk unless one makes a connection to :memory: right?
Oh, yeah, the :memory: was just for a throw-away example. Don't run it like that normally. You'll want persistence on disk so you'd need to point your connection to the actual file
That code is only useful for illustrating the SELECT query you want to do - the rest is just a cheap way to set up the data to be able to test it
Hi guys, why is pd.Index(list('abc')) in pandas not of object type string but object?
second example here. Shouldn't that be type string?
yes yes no doubt
this sounds like data is paged from disk and streamed through RAM seriatim to populate responses to a query: stackoverflow.com/questions/14156832/….
@Hakaishin The default dtype is object. If you want pandas to auto-detect the dtype, pass dtype=None
13:21
@Aran-Fey same behaviour with None
...actually, if that's true, then the first example doesn't make sense
yeah, something is weird
yeah, pandas is. And its documentation as well :|
I also like how the function signature default is not the same as the default written just right below it in the doc...
@duhaime if this is gonna be a monster query, you might want to look at doing a INNER JOIN vs the WHERE hashband IN (SELECT hashband FROM _counts) subquery. They may end up being effectively the same, but it's something untested
13:26
hmm yes it will be massive
Is there a reason you're using SQLite for massive queries?
In a nutshell the problem I'm working on is discovering & visualizing text reuse
current demo here (search for Thomas Gray): 54.203.96.203
Up until a month or so ago, this little app (github.com/YaleDHLab/intertext) relied on MongoDB (or Redis) + Node.js for building the client
But the app is meant to help researchers in the humanities who have little experience with programming find text reuse in their data collections
Oof, if you're going to expose an endpoint then I think you'll want to swap to a db that supports concurrency right away. Postgres is simple enough to set up
So we wanted to rewrite this to work with a flat-file database of simple JSON files
postgres is awesome
13:32
^^ that's the current state of the rewrite that uses no DB on the client side, just JSON flat files
the idea is users pip install intertext (not on pypi yet), run intertext --infiles "data/*.txt" and get an output folder output that can be served off a flat file server like GitHub pages or S3
so the sqlite is just an intermediary data store that accumulates the list of file_id and window_id values that contain a hashband (where a hashband is a sequence of minhash values, a file_id is just a unique id given to each input file, and window_id is just a unique id given to each sequence of k words in the given file)
But SQLite is in the mix. That will not play nice with a web endpoint so if we just focus on that single aspect, I think it's a dodgy choice and I'd swap all its functionality to postgres
Or MySQL. I mean, I don't want to dis them, I just picked my camp :P
oh no sqlite is not part of the output at all--it's just an intermediary datastructure that's used to accumulate key/value pairs that are ultimately expressed as JSON data
the web client does not use SQL, it just fetches JSON files
So when I landed on those pages, not a single query was run against SQLite? In which case, fine, I do use it as an interim step for offline data transfer
this whole rewrite was to eliminate the need for a web client that interacts with a server, because it's way easier for our users to drag some files into a git repository and host things there than it is for them to set up and babysit an EC2 instance e.g.
well the raw IP above pings Mongo, but the netlify above just reads JSON
neither uses SQL :)
we were building the hashband to text_id, window_id mappings in RAM using the LocalitySensitiveHash index (LSHIndex) from datasketch, but eventually one runs out of ram and must build that index on disk
which is what pushed me to Sqlite
Aha, ok
13:39
I hope that makes sense
In which case, yeah, I got slightly confused sorry
not at all, it's a confusing situation--everything's being rewritten
FWIW I still think postgres would still act as an interim that wouldn't all be in RAM and might be a more robust solution anyway but it's not the horror story I thought it might be :P I relied a lot on SQLite in the past and set the WAL etc. and still the odd concurrency error would just spring up
I ran minhashing on 300,000 documents from the eighteenth century to investigate whether the institution of fair use law incentivized authors to copy more text from others: earlybookmarket.com/press-piracy.html
Totally agreed, but our users have trouble setting up a db :/
so I need to use something that we can pip install and manage entirely on our own
possibly eventually we'll allow the interim datastore to be user-specifiable, so that e.g. big runs on 300K documents could use a proper DB solution
but to handle the low hanging fruit we planned to start with the simplest possible solution and then introduce more machinery
In which case, I think I'd just try activate the WAL during installation (I think you should be able to do that during install) and then, yeah, we're on the same page
13:46
I read that db.execute('PRAGMA journal_mode = OFF;') is faster than db.execute('PRAGMA journal_mode = WAL;')
is that true?
It will be faster to keep it off, but are you sure you'll never try to make writes to the DB concurrently?
yes, it's just one process that kind of prods along
can sqlite handle concurrent writes?
Or a read and a write at the same time. It just buys you some flexibility when things might deadlock
if the journal_mode is WAL?
@duhaime no, not at all
But it will allow reads on the data while a (single) write is in progress
13:48
hmm, if Sqlite can't handle concurrent writes I think it makes sense to just stick with a single process and turn the journal_mode off, because all data must be written before any is read
we essentially need to know all the files that contain a given hashband so we know which files have shared text
there's a good overview of the minhash + hashband algorithm in Mining of Massive Datasets if you're curious about the core algorithm: infolab.stanford.edu/~ullman/mmds/ch3n.pdf
well thanks for all your help @roganjosh!
No worries, and thanks for the link :) Best of luck!
14:16
@Hakaishin backwards compatibility
String dtype is very new, so you only get it if you ask for it. Default is string -> object dtype.
For backwards-compatibility, object dtype remains the default type we infer a list of strings to

In [1]: pd.Series(["a", "b", "c"])
Out[1]:
0    a
1    b
2    c
dtype: object

To explicitly request string dtype, specify the dtype

In [2]: pd.Series(["a", "b", "c"], dtype="string")
Out[2]:
0    a
1    b
2    c
dtype: string
14:47
@MisterMiyagi i couldnt see a way around it, otherwise you ended up precomupting everything anyway
but thank you
 
2 hours later…
16:19
Umm, has pytest's output always had syntax highlighting? I think I'm noticing that for the first time. Or maybe it's just the first time I'm seeing it on Windows?
17:04
cbg, how do I go about testing "threaded api requests" if I am working with a api service that rate limits me for 50 requests a day?
by testing I mean, how to make sure my code works (threaded request calls vs non threaded calls), by the time I debug I end up exhausting my api quota
@python_user can you mock out the api? So you aren't doing network stuff in your tests?
I mean, want I want to test here is to actually see if threading the requests calls gives me a time improvement
if I mock these I dont really perform a network IO right?
maybe profiling is the word I should have used, apologies
Is the api fairly consistent in the time it takes to respond? You could just simulate the delay if it is predictable.
that seems like a reasonable thing I can do, thanks
17:13
yup that is what I am going to do, replace get calls with sleep calls
@python_user what is a threaded request here?
Unless the API takes minutes to respond, then I don't understand what the issue is
And by minutes, I mean (24*60) / 50
Thread(target=requests.get, args=('site',))it takes ~30 seconds to respond for a get call
and then do .start() to make the calls, that is what I meant when I said threaded request
Well that's significantly less than the ~28 min/per request that your allowance boils down to?
So why wouldn't you just have a sync request and a sleep? In this case, it seems like your test will just eat into your API limits and screw you over anyway?
In other words, your testing is actually destructive to your main code if you get a measly 50 requests a day
I assume what @python_user is trying to do is multiple requests in a short(er) amount of time using threading, otherwise I'm not sure what the advantage would be, since network time is unlikely to be a bottleneck solved by threading?
that also makes sense, the 50 request / day is the free plan btw, so once I know this is something that works I would spend on the next plan
17:23
Alternative option....get a completely different account for testing, so that production code is not impacted by testing?
To put it in context, I'm pushing 400 requests/sec through requests-futures. I don't see why you'd need to try threading anything on that API limit
what toonarmycaptain pointed out is what I am trying
Then fire them all off async and your entire day's allocation is gone in one go? Something doesn't add up, sorry
ok, let me try to be a bit more clear
If you wanna fire all your 50 requests off in one go rather than have 30 sec waits between sync requests, I can give you the code for that
17:27
@roganjosh I think the plan is trying to test code works, and when proven functional, the intention would be to move to a paid plan with a limit of a LOT more than 50 requests.
Whether the API is gonna like that coming in async.... well that's another question :P
Side note @roganjosh cbg, how have you been?
so think of this as flask app that just has a text box, user types in a comma separated value (eg: apple, orange), my app splits this and does api calls for all values, so this is where thread comes in
@toonarmycaptain Mega busy but holding out thanks mate, you? Indeed is has been a while!
and again toonarmy captain is right
17:29
But where does this 50 APi calls/day limit come from?
the api service (3rd party), who gives me the key
But a single user of your site is gonna kill your limit in a handful of requests?
if I use the free plan then yes, but right now I want to have a working setup using threads
<totally being Devil's advocate whilst also not quite following>
@python_user you can't test it on that scale IMO
1 sec
@roganjosh three kids including bub at home has been busy. We've been ok. Recently finished laying wood floor in place of all the carpet.
17:33
@python_user
Mar 23 at 0:32, by roganjosh
OSRM is fast enough that I should be able to set up a net to catch the problem queries but I bet they won't error when they're not part of the torrent of queries being sent
I did come across that conversation earlier, let me re read this and see how I can make use of that
<hint> They don't (as it transpired from my testing)
@toonarmycaptain Sounds like a decent, practical approach :P
@python_user I don't think you can. With 50 requests, you could fire off your 10 workers across those requests but it's nothing close to telling you what it's gonna do in prod
ok, I will have to rethink this then, thanks for the support josh and cap
And that's not just against requests-futures but also asyncio and trio and... well everything else. If just doesn't put the full load on the server if it'll start kicking requests after 50
Nginx or Apache, or some other, will probably step in after your API limit and just pretend it's handling your requests. Certainly if it takes 30 secs for a real response, I'd want one of those guard-keepers
I haven't even gone that far, still on werkzeug :D
17:45
Not on your side, on their side :)
I mean, faking things out with a mock-api that'll respond with a delay might work for you, if you're just trying to find out if things are quicker with threading (although with concurrent requests and predicable latency, it would almost certainly be quicker).
Your bottleneck/issue is likely to be number of connections, if someone inputs, say, a movie script, or a dozen users input the lyrics to a song, you're going to end up with hundreds or thousands of API calls at once.
I have a hard limit on the values that can be entered, so 1000 calls will not be possible though
@python_user The API takes 30 secs to give a real response. You get 50 req/day. That sounds like it's super-heavy to handle for them so you don't have direct access to their service. You'll (whether you know it) have your requests reverse-proxied through something like nginx that will just start handling the requests
I need to understand more about reverse proxies before I can ask anything related to what you mentioned, I just know nginx helps with that
I followed Miguel's tutorial to set up a flask on a nginx server a year back, other than I have no idea
The bottom line; 50 requests to this service are not gonna tell you a whole lot about how anything will work in a paid subscription
17:54
going with what you said, I will try asking the company if they can afford a paid subscription
they can afford, the real question is will they :D
Good luck with the "well, roganjosh told me" angle :P
laurel, the way I tell would be "experts told me" and toss in some of my rate limited code to show them I cant proceed any further
a dude called food said it's inevitable
me being in an Indian company that would make perfect sense
haha
extra expert points :P
18:10
Can I ask, roughly, what it is you're querying them for? 30 secs is a pretty long time
ok, so I said apple, oranges as a value, so what actually goes as an input is an image along with this, the api does some image processing and returns coordinates for apple if found in image, and the same for orange or any other value
the api must be able to accept apple and orange in a single request but it doesn't
If you were in a paid subscription, how many calls for that do you get?
it depends, it is not a public API service, my company is using some other companies services, so once we figure out if this is going to be profitable for us, we will go and ask for a price based on our analysis
One would hope that they can respond faster than 30 secs. I think that's another angle; throughput is gonna be slow here anyway. I don't want it to come back and bite me that "50 requests isn't enough to test this" if we neglect the fact that each request is pretty slow, too, regardless of the limit
I guess they have better systems for paid plans, the endpoint would be a different powerful server
I dont know how fast that will be though
18:23
Ask them?
I still have to have my requests threaded dont I?
I will send out an email, pretty sure its weekend so Monday is when they will respond
Not necessarily because you don't know what the response time is or what your limits might be
You can thread I/O tasks fine - will they start dropping concurrent requests? Who knows
in any case I have an excuse to not have this job done now, API limit exceeded
so tomorrow is when I will have to re focus on things you have mentioned
AAB
AAB
18:44
cbg all,
In python say I have a function that does some operation and it can return success or failure or something like limit reached what the best way to code it?
I was planning to use a int value to know the outcome but any better way to do it?
based on the return value a JSON response is sent with success,failure,max limit reached
raise an exception if something goes wrong?
AAB
AAB
I read somewhere using status codes is bad and I should raise exceptions intead is that a use case for me?
Or are you asking how to encode this success/error result as json?
Is this in the context of django like your other questions? If so, you're missing quite a bit of context from your question @AAB
AAB
AAB
@roganjosh yes related to a django app
18:50
Then you need to state that
AAB
AAB
@Aran-Fey I just want to let the user know he has reached the max limit for today. Its not an error like I cant reach the DB or run a query should I raise the exception for that?
Otherwise people are guessing at what you're saying. You're responding to an API request so you really should be sending a response code
AAB
AAB
@roganjosh sorry about that but even outside django in any other scenario how should code be written for the above case?
Do I need to raise an exception if the user reach his max limit?
so something like try : except e1: except2: ??
It should raise an exception, yes
You can raise an exception, but do limits even make sense if it's code on the user's computer?
AAB
AAB
18:54
@roganjosh If request is not broken/wrong and only the user has reached his max limit should I not return HTTP 200?
The first thing I'd do is just open the source code and edit your limit out if it's code on my laptop
AAB
AAB
@roganjosh no the limits are on the server
So it is just in the context of django
AAB
AAB
@Aran-Fey thanks so have 2 exception handlers one for the limit reached error another for say db error? and then based on which exception hit the message changes?
I need to go to the shops and I'm a bit grumpy sorry because I just had a whole load of work dumped on me for Monday. I'll go try walk it out - apologies. But I do think you need to be clear
18:56
@AAB yup
AAB
AAB
@roganjosh haha no issues hope something cheers you up, well to be honest I was wondering how even in normal situations code like that should be handled like say a python script can delete files successfully, fail or delete a few files so how should things be coded in that scenario?
@Aran-Fey @roganjosh In case of API failure should the resposne code be 4xx something?
even if the user sent everything fine but because his limit has exceeded he cant proceed?
should 200 be returned only during success? or can I return 200 with paylod as failure and error message?
That should be in the 400 range, probably. 429 Too Many Requests is also there
Sending too many requests is ultimately still the client's mistake
You can use 200 for everything, but some people will hate you for that
AAB
AAB
@Aran-Fey :P
I think it's a bad idea, but plenty of big companies do that, so... there must be some kind of advantage. Probably.
Maybe.
Potentially.
AAB
AAB
@Aran-Fey big companies send 200 always :P
btw any scenario when status codes should be used instead of exceptions?
or is using status code just bad way to write code
I still get so confused when writing classes or any other functions should it do just one thing or 1 or 2 I get soo confused :|
any way to improve on this?
19:06
Status codes are never a good idea. Sometimes (rarely), making an Enum of possible results is ok.
@AAB That's easy, every function should do 1 thing
@Aran-Fey I kinda see it as...well server returned a page fine, the fact that the page is displaying the verdict of "YOU HAVE A PROBLEM" is peripheral. Kinda like when I mistype my email password, I get a 200 page status, but a "haha you didn't get the right password" message.
AAB
AAB
I have silly questions in my mind about classes like should I pass arguments to them or should they operate on the instance variables, how should values be returned?. At work, I was told that I should not write class methods without arguments.(code was java)
So...I guess what I'm saying is what is returned depends on what is consuming the data...functions should probably raise exceptions and let the caller decide... Webpages for user to read should probably be 200s with sensible error messages. Bad pages or instances where the server is deciding there's a problem (as opposed to "user has played too many games today") such as page not existing, should tell the user/client browser there's an issue with a 4xx/5xx status code etc.
Is that fair?
AAB
AAB
@toonarmycaptain :P I was wondering the same thing
@Aran-Fey I really need to learn how to design my classes and write decent code :P
@toonarmycaptain Sounds fair, although I don't know enough about how the internet works to draw a clear line between where to use status 200 and where to use error statuses
19:20
You're talking, probably, about scraping though, @toonarmycaptain?
In which case "200: I rendered a denied page" is perfectly fine. That's different to querying an endpoint with a limit on it
I was just trying to push some context to "never use status codes".
Yes, that was kinda my point - you might do things differently for an API and for a webpage designed to be viewed by a user.
I couldn't give two yams what response code someone got if my site stopped then doing what I didn't want them to do. If it's an API call then it's reasonably accepted that they might exceed their request quota and I should respond appropriately
19:54
896
A: Importing files from different folder

joeyNothing wrong with: from application.app.folder.file import func_name Just make sure folder also contains an __init__.py, this allows it to be included as a package. Not sure why the other answers talk about PYTHONPATH.

if I want to import a module from an address like this, how should I do it according to this answer? "D:\my folder\ my sub folder\file.py"
Have you looked into python packages/modules etc.?
no, I will check it now
I suspect what you're wanting to do now (could be wrong) is to pull things out of a file that has nothing to do with your current package. In which case, you're making a spaghetti-code setup that's, frankly, going to break all the time
@roganjosh I am using API of a software which works with python and has its own packages. I am trying to make my own code (which is a very long code) modular and slice it to smaller codes in different files. My files are in different root from the software's modules. So the python core looks at software's root and do not find my modules which are in a different root...
sorry if I can not explain in professional terms and keywords. I am beginner in these topics...
Well, I'm afraid I don't fully understand what you've said but it sounds like you're trying to make a "wrapper" around the original software
20:03
thank you...
But that won't work if they're in different places in your file system. At best you'll get it working on your computer, but it likely won't work anywhere else
I assume the original software isn't something that anyone, for example I, could just download via pip?
no it is not on pip, it has its own gui and installation root. umm... when the software is installed on a system, and my modules are in working local root, the software usually recognizes them.
I mean, when my code is not modular, and I call software packages like this, from softwarepackage import *, it works
when I want to import things like this, it fails:
from softwarepackage import *
from myownpackage import *
Interesting
I actually have no idea how that works...! Are you on Windows?
Yes, I have always been using windows, but I think I should shift to linux... I am little by little feeling that some of my needs can not be addressed in windows.
Well then that seems very odd to me. It's as though they gave you a .exe or a .msi and it, very helpfully, pooped out a legitimate python package for you at the same time as installing it via the GUI. Am I missing something?
20:13
umm, I afraid it is not like this. The software is developed and has a GUI. Backend in C and Python. To give the user the ability to parametrize and automate modelings, they have prepared an API with python. So it is not a package which is installed with the exe file. I think you suspect it should be a pip package and it is made a msi/exe file for easy installation.
To your last sentence; no, I expected the opposite. I expected it came with an installer and everything would be garbled, usually, but somehow you got some python files
so we are probably having similar understanding about it. It is a software which is installed using exe file. Python packages are built it and an added feature to ease the modelings.
I honestly don't think I have anything to add to help you, sorry. This all seems rather odd to me, so I have no idea what I'm talking about at this point
Part of the problem is by my side. I have low knowledge of python so this causes me not to be able to correctly ask my question here. So, most of the time I do not succeed to formulate my questions for people here.
Thank you by the way :) @roganjosh
21:23
467
A: How to import a module given the full path?

Daryl SpitzerThe advantage of adding a path to sys.path (over using imp) is that it simplifies things when importing more than one module from a single package. For example: import sys # the mock-0.3.1 dir contains testcase.py, testutils.py & mock.py sys.path.append('/foo/bar/mock-0.3.1') from testcase imp...

@roganjosh this solved my issue and my program works well now.
It solves your immediate problem. I was more curious about the general setup. That approach won't transfer well anywhere else
In any case, I'm glad it works for you
@roganjosh exactly this is what I am thinking now... probably should look for some 'current directory' to make it more general in case files move to another root...
@roganjosh thank you indeed. I am beginner in programming terms, these little steps make me so energetic in reading more and making my codes better...
You're welcome, though it sucks in this case that I can't give you suggestions on what to read up on here because I've got myself confused sorry
no problem at all, I find some solutions by searching the keywords I find between the answers I receive here. I learn from any comment here. :) I am an active learner! Thanks indeed.

« first day (3815 days earlier)      last day (1357 days later) »